Commit 3a23edc9 authored by pengxiong's avatar pengxiong

样式

parent 3e6b279e
......@@ -35,10 +35,10 @@ class UserCustomerDataAdaptor:
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)
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)
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.fund_nav_total, self.fund_cnav_total = self.get_customer_fund_nav_data()
self.index_df = self.get_customer_index_nav_data()
......
......@@ -634,9 +634,12 @@ class PortfolioDiagnose(object):
# 覆盖的基金名称
strategy_name_evaluate = "".join(uniqe_strategy_name)[:-1]
if len(uniqe_strategy) / float(len(strategy_list)) > 0.6:
strategy_distribution_evaluate = "策略上有一定分散"
else:
try:
if len(uniqe_strategy) / float(len(strategy_list)) > 0.6:
strategy_distribution_evaluate = "策略上有一定分散"
else:
strategy_distribution_evaluate = "策略分散程度不高"
except ZeroDivisionError:
strategy_distribution_evaluate = "策略分散程度不高"
# 相关性
if len(self.abandon_fund_corr) > 0:
......
......@@ -117,6 +117,7 @@ def draw_contribution_chart(xlabels, product_list, cumulative):
ax1.set_xticks(loc)
ax1.set_xticklabels(xlabels)
ax1.yaxis.set_major_formatter(FuncFormatter(to_percent))
ax1.grid(axis='y')
# temp_rate = np.zeros(max_x_count)
# for i in range(len(product_list)):
# temp_rate += product_list[i]['data']
......
......@@ -216,7 +216,6 @@ class DataIntegrate:
'title': '10月综述',
'brand_name': '小飞象<br>工作室',
'customer_old': 42, 'customer_level': '平衡型',
# 'new_evaluation': self.new_evaluation,
'position_years': '5年', 'planned_allocation_amount': 2000.00,
'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,
......@@ -273,5 +272,5 @@ class DataIntegrate:
if __name__ == '__main__':
start = time.time()
DataIntegrate()
DataIntegrate(ifa_id='189138514712358912',customer_id='6716613796058116091')
print('耗时{}秒'.format(round(time.time()-start, 2)))
......@@ -8,7 +8,7 @@
from app.api.engine import tamp_user_engine, tamp_order_engine, TAMP_SQL
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
Base = declarative_base()
......@@ -36,25 +36,25 @@ class Customer(Base):
def call_month_report(ifauser_id, ifauser_name, customer_id, customer_name):
print('开始制作IFA: {}, 客户: {}的基金月报'.format(ifauser_name, customer_name))
try:
DataIntegrate(ifauser_id, customer_id, '{}_{}_.pdf'.format(ifauser_name, customer_name))
except:
print("发生异常,下一个走起!")
# print('开始制作IFA: {}, 客户: {}的基金月报'.format(ifauser_name, customer_name))
# try:
DataIntegrate(ifauser_id, customer_id, '{}_{}_.pdf'.format(ifauser_name, customer_name))
# except IndexError:
# print("发生异常,下一个走起!")
with TAMP_SQL(tamp_user_engine) as tamp_user, TAMP_SQL(tamp_order_engine) as tamp_order:
tamp_user_session = tamp_user.session
# 获取所有 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
# for ifauser in ifausers:
for ifauser in ifausers:
# 获取某个 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
for customer in customers:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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