Commit 9b2205d5 authored by 赵杰's avatar 赵杰

组合收益率等修复

parent efe0d5cd
...@@ -522,14 +522,14 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor): ...@@ -522,14 +522,14 @@ class UserCustomerResultAdaptor(UserCustomerDataAdaptor):
# nav_net_amount_df = resample(return_ratio_df, self.trade_cal_date, freq_max) # nav_net_amount_df = resample(return_ratio_df, self.trade_cal_date, freq_max)
nav_net_amount_df["sum_net_amount"] = nav_net_amount_df[fund_id_list_amount].sum(axis=1).apply(lambda x: Decimal.from_float(x)) nav_net_amount_df["sum_net_amount"] = nav_net_amount_df[fund_id_list_amount].sum(axis=1).apply(lambda x: Decimal.from_float(x))
for amount_name in fund_id_list: for amount_name in fund_id_list:
# price = nav_net_amount_df[amount_name].dropna() price = nav_net_amount_df[amount_name].dropna()
# profit = price.diff().fillna(Decimal(0)) profit = price.diff().fillna(Decimal(0))
# profit_ratio_new = profit / price.shift(1) profit_ratio_new = profit / price.shift(1)
# profit_ratio_old = nav_net_amount_df[amount_name+"_profit_ratio"] profit_ratio_old = nav_net_amount_df[amount_name+"_profit_ratio"]
# nan_index = profit_ratio_new[pd.isna(profit_ratio_new)].index nan_index = profit_ratio_new[pd.isna(profit_ratio_new)].index
# profit_ratio_new[nan_index] = profit_ratio_old[nan_index] profit_ratio_new[nan_index] = profit_ratio_old[nan_index]
#
# nav_net_amount_df[amount_name + "_profit_ratio"] = profit_ratio_new nav_net_amount_df[amount_name + "_profit_ratio"] = profit_ratio_new
nav_net_amount_df[amount_name+"_amount_ratio"] = nav_net_amount_df[amount_name+"_net_amount"]/(nav_net_amount_df["sum_net_amount"]) nav_net_amount_df[amount_name+"_amount_ratio"] = nav_net_amount_df[amount_name+"_net_amount"]/(nav_net_amount_df["sum_net_amount"])
fund_profit_ratio = nav_net_amount_df[amount_name + "_profit_ratio"].dropna() + 1 fund_profit_ratio = nav_net_amount_df[amount_name + "_profit_ratio"].dropna() + 1
......
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