diff options
Diffstat (limited to 'python/task_server/globeop.py')
| -rw-r--r-- | python/task_server/globeop.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/python/task_server/globeop.py b/python/task_server/globeop.py index 560dcee3..0fa225dc 100644 --- a/python/task_server/globeop.py +++ b/python/task_server/globeop.py @@ -164,6 +164,12 @@ def insert_todb(engine, workdate: datetime.date, fund="SERCGMAST"): if not report_file.exists(): continue df = fun(report_file) + if workdate >= datetime.date(2022, 11, 25): + match report: + case "Valuation" | "Pnl": + df.loc[~df.invid.isin(["USD", "EUR"]), "custacctname"] = df.loc[ + ~df.invid.isin(["USD", "EUR"]) + ].custacctname.str.replace("V0NSCLMAMB", "159260.1") if report == "Valuation": period_end_date = pd.Timestamp(df.periodenddate[0]) sql_str = ( @@ -199,14 +205,14 @@ def upload_bond_marks(engine, workdate: datetime.datetime, fund): ), ) df.rename(columns={"identifier": "IDENTIFIER", "price": "Price"}, inplace=True) - fullpath = DAILY_DIR / str(d) / f"securitiesNpv{workdate:%Y%m%d_%H%M%S}.csv" + fullpath = DAILY_DIR / str(d) / f"securitiesNpv{workdate:%Y%m%d_%H%M%S}_{fund}.csv" df.to_csv(fullpath, index=False) match fund: case "SERCGMAST": server = FtpClient.from_creds("globeop", folder="incoming") case "BOWDST": server = SftpClient.from_creds("hm_globeop", folder="incoming/gopricing") - server.put(fullpath) + server.put(fullpath, f"securitiesNpv{workdate:%Y%m%d_%H%M%S}.csv") logger.info("upload bond marks done") @@ -222,14 +228,14 @@ JOIN cds USING (security_id)""", fund, ), ) - fullpath = DAILY_DIR / str(d) / f"otcNpv{workdate:%Y%m%d}.csv" + fullpath = DAILY_DIR / str(d) / f"otcNpv{workdate:%Y%m%d}_{fund}.csv" df.to_csv(fullpath, index=False) match fund: case "SERCGMAST": server = FtpClient.from_creds("globeop", folder="incoming") case "BOWDST": server = SftpClient.from_creds("hm_globeop", folder="incoming/gopricing") - server.put(fullpath) + server.put(fullpath, f"otcNpv{workdate:%Y%m%d}.csv") logger.info("upload cds marks done") |
