Commit f9396627 authored by 赵杰's avatar 赵杰

添加组合数据到html

parent 5d8b6382
......@@ -16,42 +16,56 @@ print(d)
# 几月综述部分
total_cost = df["total_cost"]/10000
now_yield = round((df['contribution_decomposition']-1)*100,2)
index_yield = round((df["index_result"]["return_ratio"]-1)*100, 2)
now_withdrawal = round(df["max_drawdown"][0]*100,2)
index_withdrawal = round(df["index_result"]["max_drawdown"][0]*100, 2)
monthly_return_performance_pic = '_'.join((ifa_id, customer_id, '20201109', 'monthly_return_performance.png'))
image_dir = './img/'
monthly_return_performance_pic = image_dir + monthly_return_performance_pic
# 组合数据
group_result = d["default"]
now_month_income = int(group_result["cur_month_profit"]) # 本月收益
now_year_income = int(group_result["cur_year_profit"]) # 今年累计收益
totoal_rate_of_return = round((group_result['contribution_decomposition']-1)*100, 2) # 累计收益率
month_rise = round(group_result["cur_month_profit_ratio"]*100, 2) # 本月涨幅
year_totoal_rate_of_return = round(group_result["cur_year_profit_ratio"]*100, 2) # 今年累计收益率
annualised_return = round(group_result["return_ratio_year"]*100, 2) # 年化收益率
volatility = round(group_result["volatility"]*100, 2)
max_withdrawal = round(group_result["max_drawdown"][0]*100, 2)
sharpe_ratio = round(group_result["sharpe"], 2)
cost_of_investment = int(group_result["total_cost"]) # 投资成本
final_balance = int(group_result["total_cost"] + group_result["cumulative_profit"]) # 期末资产
total_profit = int(group_result["cumulative_profit"]) # 累计盈利
index_section_return = round((group_result["index_result"]["return_ratio"]-1)*100, 2)
index_annualised_return = round(group_result["index_result"]["return_ratio_year"]*100, 2) # 年化收益率
index_volatility = round(group_result["index_result"]["volatility"]*100, 2)
index_max_withdrawal = round(group_result["index_result"]["max_drawdown"][0]*100, 2)
index_sharpe_ratio = round(group_result["index_result"]["sharpe"], 2)
# 全部数据
data = {'customer_name':'成龙', 'customer_gender':'女',
'year_month':'2020年10月', 'ifa_company':'飞度工作室',
'title':'10月综述', 'brand_name':'飞度工作室',
'customer_old':42, 'customer_level':'平衡型',
'position_years':'5年', 'planned_allocation_amount':2000.00,
'now_allocation_amount':total_cost, 'now_yield':now_yield, 'expected_yield':20,
'now_withdrawal':now_withdrawal, 'expected_withdrawal':20,
'now_year_income':172623,'now_month_income':94477,'totoal_rate_of_return':19.99,
'month_rise':19.99, 'year_totoal_rate_of_return':19.32,
'annualised_return': 56.19, 'cost_of_investment':1000000,
'final_balance':2000400, 'total_profit':172623,
'latest_worth_day':'2020-11-05',
'index_comparison':{'section_return':5.75, 'annualized_returns': 0.40,
'volatility':2.29, 'max_withdrawal':2.15, 'sharpe_ratio':3.05},
'index_comparison_500':{'section_return':5.75, 'annualized_returns': 0.40,
'volatility':2.29, 'max_withdrawal':2.15, 'sharpe_ratio':3.05},
'monthly_return_performance_pic':monthly_return_performance_pic
'now_allocation_amount':total_cost, 'now_yield':now_yield, 'index_yield':index_yield, 'expected_yield':20,
'now_withdrawal':now_withdrawal, 'index_withdrawal': index_withdrawal, 'expected_withdrawal': 20,
'now_year_income':now_year_income,'now_month_income':now_month_income,'totoal_rate_of_return':totoal_rate_of_return,
'month_rise':month_rise, 'year_totoal_rate_of_return':year_totoal_rate_of_return,
'annualised_return': annualised_return, 'cost_of_investment': cost_of_investment,
'final_balance':final_balance, 'total_profit':total_profit,
'latest_worth_day':'2020-11-05',
'index_comparison':{'section_return': totoal_rate_of_return, 'annualized_returns': annualised_return,
'volatility':volatility, 'max_withdrawal':max_withdrawal, 'sharpe_ratio': sharpe_ratio},
'index_comparison_500':{'section_return':index_section_return, 'annualized_returns': index_annualised_return,
'volatility':index_volatility, 'max_withdrawal':index_max_withdrawal, 'sharpe_ratio':index_sharpe_ratio},
'monthly_return_performance_pic':monthly_return_performance_pic,
}
......
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