diff options
Diffstat (limited to 'python/baml.py')
| -rw-r--r-- | python/baml.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/baml.py b/python/baml.py index 07f3f11c..fab7b768 100644 --- a/python/baml.py +++ b/python/baml.py @@ -6,6 +6,7 @@ from serenitas.utils.env import DAILY_DIR from urllib.parse import urlsplit, parse_qs, urlunsplit from serenitas.utils.db import dawn_engine import datetime +from serenitas.analytics.dates import prev_business_day logger = logging.getLogger(__name__) @@ -48,11 +49,14 @@ def load_cash_report(workdate: datetime.date): "Local Currency", "Account Name", "Portfolio ID", + "Information As Of", ], ) df = ( df[df["Asset Class"] == "CASH AND EQUIVALENTS"] - .groupby(["Local Currency", "Account Name", "Portfolio ID"]) + .groupby( + ["Local Currency", "Account Name", "Portfolio ID", "Information As Of"] + ) .sum() ) df = df.reset_index().rename( @@ -61,11 +65,12 @@ def load_cash_report(workdate: datetime.date): "Local Currency": "currency_code", "Account Name": "account_name", "Local Market Value": "balance", + "Information As Of": "date", }, axis=1, ) + df["date"] = pd.to_datetime(df["date"]) df["fund"] = "SERCGMAST" - df["date"] = workdate df.to_sql("cash_balances", dawn_engine, if_exists="append", index=False) |
