Commit 015b6122 authored by 赵杰's avatar 赵杰

修复中证500的年化等,添加FOF判断策略分类

parent 1c6df9f2
......@@ -818,12 +818,12 @@ class PortfolioDiagnose(object):
index_return["new_index_return"] = (index_return["index"] - start_index_return) / (1 + start_index_return)
index_return_ratio = index_return["new_index_return"].values[-1]
index_return_ratio_year = annual_return(index_return["new_index_return"].values[-1],
index_return["new_index_return"], n_freq)
index_volatility = volatility(index_return["new_index_return"] + 1, n_freq)
index_return["new_index_return"], 250)
index_volatility = volatility(index_return["new_index_return"] + 1, 250)
index_drawdown = max_drawdown(index_return["new_index_return"] + 1)
index_sim = simple_return(index_return["new_index_return"]+1)
index_exc = excess_return(index_sim, BANK_RATE, n_freq)
index_sharpe = sharpe_ratio(index_exc, index_sim, n_freq)
index_exc = excess_return(index_sim, BANK_RATE, 250)
index_sharpe = sharpe_ratio(index_exc, index_sim, 250)
# 收益对比数据
return_compare_df = pd.merge(index_return[["new_index_return"]], old_return_df[["cum_return_ratio"]],
......
......@@ -434,7 +434,9 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
# 基金持仓数据
total_market_values = p_sum_profit + p_total_amount # 月末总市值
fund_hoding_info = {"fund_strategy_name": dict_substrategy[int(row["substrategy"])], "fund_name": row["fund_name"]}
if "长富" in row["fund_name"] or "盈沛" in row["fund_name"]:
fund_strategy_name = "FOF"
fund_hoding_info = {"fund_strategy_name": fund_strategy_name, "fund_name": row["fund_name"]}
fund_hoding_info["confirm_date"] = row["confirm_share_date"].strftime("%Y-%m-%d")
fund_hoding_info["hold_year"] = "%.2f" % round((self.end_date - pd.to_datetime(row["confirm_share_date"])).days/365.0, 2) # 存续年数
fund_hoding_info["market_values"] = round((float(row["confirm_share"]) * (fund_basic_info["cur_cnav"] - confirm_cnav) + float(row["confirm_amount"]))/10000, 2)
......
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