Commit 3a23edc9 authored by pengxiong's avatar pengxiong

样式

parent 3e6b279e
...@@ -35,10 +35,10 @@ class UserCustomerDataAdaptor: ...@@ -35,10 +35,10 @@ class UserCustomerDataAdaptor:
p_end_date = pd.to_datetime(end_date).date() p_end_date = pd.to_datetime(end_date).date()
p_end_date = datetime.date(year=p_end_date.year, month=p_end_date.month, day=1) - datetime.timedelta(days=1) p_end_date = datetime.date(year=p_end_date.year, month=p_end_date.month, day=1) - datetime.timedelta(days=1)
self.end_date = pd.to_datetime(str(p_end_date)) self.end_date = pd.to_datetime(str(p_end_date))
# self.end_date = pd.to_datetime("2020-11-23") self.end_date = pd.to_datetime("2020-12-04")
p_start_date = datetime.date(year=p_end_date.year, month=p_end_date.month, day=1) p_start_date = datetime.date(year=p_end_date.year, month=p_end_date.month, day=1)
self.month_start_date = p_start_date self.month_start_date = p_start_date
# self.month_start_date = pd.to_datetime("2020-11-16") self.month_start_date = pd.to_datetime("2020-11-1")
self.user_customer_order_df = self.get_user_customer_order_data() self.user_customer_order_df = self.get_user_customer_order_data()
self.fund_nav_total, self.fund_cnav_total = self.get_customer_fund_nav_data() self.fund_nav_total, self.fund_cnav_total = self.get_customer_fund_nav_data()
self.index_df = self.get_customer_index_nav_data() self.index_df = self.get_customer_index_nav_data()
......
...@@ -634,10 +634,13 @@ class PortfolioDiagnose(object): ...@@ -634,10 +634,13 @@ class PortfolioDiagnose(object):
# 覆盖的基金名称 # 覆盖的基金名称
strategy_name_evaluate = "".join(uniqe_strategy_name)[:-1] strategy_name_evaluate = "".join(uniqe_strategy_name)[:-1]
try:
if len(uniqe_strategy) / float(len(strategy_list)) > 0.6: if len(uniqe_strategy) / float(len(strategy_list)) > 0.6:
strategy_distribution_evaluate = "策略上有一定分散" strategy_distribution_evaluate = "策略上有一定分散"
else: else:
strategy_distribution_evaluate = "策略分散程度不高" strategy_distribution_evaluate = "策略分散程度不高"
except ZeroDivisionError:
strategy_distribution_evaluate = "策略分散程度不高"
# 相关性 # 相关性
if len(self.abandon_fund_corr) > 0: if len(self.abandon_fund_corr) > 0:
fund_corr_name = [str(group_order_df[group_order_df["fund_id"] == f_id]["fund_name"].values[0]) + "和" for fund_corr_name = [str(group_order_df[group_order_df["fund_id"] == f_id]["fund_name"].values[0]) + "和" for
......
...@@ -117,6 +117,7 @@ def draw_contribution_chart(xlabels, product_list, cumulative): ...@@ -117,6 +117,7 @@ def draw_contribution_chart(xlabels, product_list, cumulative):
ax1.set_xticks(loc) ax1.set_xticks(loc)
ax1.set_xticklabels(xlabels) ax1.set_xticklabels(xlabels)
ax1.yaxis.set_major_formatter(FuncFormatter(to_percent)) ax1.yaxis.set_major_formatter(FuncFormatter(to_percent))
ax1.grid(axis='y')
# temp_rate = np.zeros(max_x_count) # temp_rate = np.zeros(max_x_count)
# for i in range(len(product_list)): # for i in range(len(product_list)):
# temp_rate += product_list[i]['data'] # temp_rate += product_list[i]['data']
......
...@@ -216,7 +216,6 @@ class DataIntegrate: ...@@ -216,7 +216,6 @@ class DataIntegrate:
'title': '10月综述', 'title': '10月综述',
'brand_name': '小飞象<br>工作室', 'brand_name': '小飞象<br>工作室',
'customer_old': 42, 'customer_level': '平衡型', 'customer_old': 42, 'customer_level': '平衡型',
# 'new_evaluation': self.new_evaluation,
'position_years': '5年', 'planned_allocation_amount': 2000.00, 'position_years': '5年', 'planned_allocation_amount': 2000.00,
'now_allocation_amount': self.total_cost, 'now_yield': self.now_yield, 'index_yield': self.index_yield, 'now_allocation_amount': self.total_cost, 'now_yield': self.now_yield, 'index_yield': self.index_yield,
'expected_yield': 20, 'now_annualised_return': self.now_annualised_return, 'expected_yield': 20, 'now_annualised_return': self.now_annualised_return,
...@@ -273,5 +272,5 @@ class DataIntegrate: ...@@ -273,5 +272,5 @@ class DataIntegrate:
if __name__ == '__main__': if __name__ == '__main__':
start = time.time() start = time.time()
DataIntegrate() DataIntegrate(ifa_id='189138514712358912',customer_id='6716613796058116091')
print('耗时{}秒'.format(round(time.time()-start, 2))) print('耗时{}秒'.format(round(time.time()-start, 2)))
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
from app.api.engine import tamp_user_engine, tamp_order_engine, TAMP_SQL from app.api.engine import tamp_user_engine, tamp_order_engine, TAMP_SQL
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, Integer from sqlalchemy import Column, String, Integer, and_
from app.utils.jinjia2html import DataIntegrate from app.utils.jinjia2html import DataIntegrate
Base = declarative_base() Base = declarative_base()
...@@ -36,25 +36,25 @@ class Customer(Base): ...@@ -36,25 +36,25 @@ class Customer(Base):
def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name): def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
print('开始制作IFA: {}, 客户: {}的基金月报'.format(ifauser_name, customer_name)) # print('开始制作IFA: {}, 客户: {}的基金月报'.format(ifauser_name, customer_name))
try: # try:
DataIntegrate(ifauser_id, customer_id, '{}_{}_.pdf'.format(ifauser_name, customer_name)) DataIntegrate(ifauser_id, customer_id, '{}_{}_.pdf'.format(ifauser_name, customer_name))
except: # except IndexError:
print("发生异常,下一个走起!") # print("发生异常,下一个走起!")
with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order: with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order:
tamp_user_session = tamp_user.session tamp_user_session = tamp_user.session
# 获取所有 ifauser # 获取所有 ifauser
ifausers = tamp_user_session.query(IfaUser).all() ifausers = tamp_user_session.query(IfaUser).filter(IfaUser.id.in_(['USER_INFO15916072577875'])).all()
tamp_order_session = tamp_order.session tamp_order_session = tamp_order.session
# for ifauser in ifausers: # for ifauser in ifausers:
for ifauser in ifausers: for ifauser in ifausers:
# 获取某个 ifa 的所有 customer # 获取某个 ifa 的所有 customer
customers = tamp_order_session.query(Ifa_Customer).\ customers = tamp_order_session.query(Ifa_Customer).\
filter_by(ifa_id = ifauser.id).all() filter(and_(Ifa_Customer.ifa_id == ifauser.id, Ifa_Customer.customer_id.in_(['6716613804182482944', '6716613804966817792']))).all()
# 循环这个 ifa 的所有 customer # 循环这个 ifa 的所有 customer
for customer in customers: for customer in customers:
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment