Commit 79fec9c9 authored by 赵杰's avatar 赵杰

shift

parent 0004379c
...@@ -502,7 +502,7 @@ class UserCustomerDataAdaptor: ...@@ -502,7 +502,7 @@ class UserCustomerDataAdaptor:
# actual_share_dict[cur_fund_id] = cur_fund_share # actual_share_dict[cur_fund_id] = cur_fund_share
for p_fund_id_ in p_outside_order_df["fund_id"].unique(): for p_fund_id_ in p_outside_order_df["fund_id"].unique():
cnav_df[p_fund_id_ + "_earn"] = (cnav_df[p_fund_id_ + "_profit"] * cnav_df[p_fund_id_ + "_share"]).apply( cnav_df[p_fund_id_ + "_earn"] = (cnav_df[p_fund_id_ + "_profit"] * cnav_df[p_fund_id_ + "_share"].shift(1)).fillna(0).apply(
lambda x: float(x)).fillna(0) lambda x: float(x)).fillna(0)
cnav_df[p_fund_id_ + "_cum_earn"] = cnav_df[p_fund_id_ + "_earn"].cumsum().fillna(0) cnav_df[p_fund_id_ + "_cum_earn"] = cnav_df[p_fund_id_ + "_earn"].cumsum().fillna(0)
cnav_df[p_fund_id_ + "_net_amount"] = cnav_df[p_fund_id_ + "_cum_earn"].apply(lambda x: Decimal(x)) + \ cnav_df[p_fund_id_ + "_net_amount"] = cnav_df[p_fund_id_ + "_cum_earn"].apply(lambda x: Decimal(x)) + \
...@@ -666,7 +666,7 @@ class UserCustomerDataAdaptor: ...@@ -666,7 +666,7 @@ class UserCustomerDataAdaptor:
# actual_share_dict[cur_fund_id] = cur_fund_share # actual_share_dict[cur_fund_id] = cur_fund_share
for p_fund_id_ in p_outside_order_df["fund_id"].unique(): for p_fund_id_ in p_outside_order_df["fund_id"].unique():
cnav_df[p_fund_id_ + "_earn"] = (cnav_df[p_fund_id_ + "_profit"] * cnav_df[p_fund_id_ + "_share"]).apply(lambda x: float(x)).fillna(0) cnav_df[p_fund_id_ + "_earn"] = (cnav_df[p_fund_id_ + "_profit"] * cnav_df[p_fund_id_ + "_share"].shift(1)).fillna(0).apply(lambda x: float(x)).fillna(0)
cnav_df[p_fund_id_ + "_cum_earn"] = cnav_df[p_fund_id_ + "_earn"].cumsum().fillna(0) cnav_df[p_fund_id_ + "_cum_earn"] = cnav_df[p_fund_id_ + "_earn"].cumsum().fillna(0)
cnav_df[p_fund_id_ + "_net_amount"] = cnav_df[p_fund_id_ + "_cum_earn"].apply(lambda x: Decimal(x)) + cnav_df[p_fund_id_ + "_amount"] cnav_df[p_fund_id_ + "_net_amount"] = cnav_df[p_fund_id_ + "_cum_earn"].apply(lambda x: Decimal(x)) + cnav_df[p_fund_id_ + "_amount"]
for p_fund_id_ in p_inter_order_df["fund_id"].unique(): for p_fund_id_ in p_inter_order_df["fund_id"].unique():
......
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