Commit 517485f7 authored by Dr.李's avatar Dr.李

fixed calculation bug

parent 57df73cd
...@@ -490,8 +490,8 @@ def fd_fund_mktv(security_ids, trade_dt): ...@@ -490,8 +490,8 @@ def fd_fund_mktv(security_ids, trade_dt):
ISVALID = 1 ISVALID = 1
ORDER BY REPORTDATE ORDER BY REPORTDATE
""" """
shares_df = read_sql(query).sort_values("SECURITYID").reset_index(drop=True) shares_df = read_sql(query).sort_values(["SECURITYID", "REPORTDATE"]).reset_index(drop=True)
shares_df = shares_df.groupby("SECURITYID", as_index=False).last() shares_df = shares_df.groupby("SECURITYID").last().reset_index()
df = pd.merge(nav_df[["SECURITYID", "UNITNAV", "NAVGRTD"]], shares_df[["SECURITYID", "ENDFDSHARE"]], on="SECURITYID") df = pd.merge(nav_df[["SECURITYID", "UNITNAV", "NAVGRTD"]], shares_df[["SECURITYID", "ENDFDSHARE"]], on="SECURITYID")
df["MKTV"] = df["UNITNAV"] * df["ENDFDSHARE"] df["MKTV"] = df["UNITNAV"] * df["ENDFDSHARE"]
return df return df
......
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