aboutsummaryrefslogtreecommitdiffstats
path: root/python/task_server
diff options
context:
space:
mode:
Diffstat (limited to 'python/task_server')
-rw-r--r--python/task_server/__main__.py4
-rw-r--r--python/task_server/globeop.py14
2 files changed, 12 insertions, 6 deletions
diff --git a/python/task_server/__main__.py b/python/task_server/__main__.py
index a5ccf8a9..2fb1f1e6 100644
--- a/python/task_server/__main__.py
+++ b/python/task_server/__main__.py
@@ -33,7 +33,7 @@ if args.download:
for fund in ("SERCGMAST", "BOWDST"):
download_data(engine, args.date, fund)
elif args.upload:
- time = datetime.datetime.now().time()
- date = datetime.datetime.combine(args.date, time)
for fund in ("SERCGMAST", "BOWDST"):
+ time = datetime.datetime.now().time()
+ date = datetime.datetime.combine(args.date, time)
upload_data(engine, date, fund)
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")