diff options
Diffstat (limited to 'python/collateral/wells.py')
| -rw-r--r-- | python/collateral/wells.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/python/collateral/wells.py b/python/collateral/wells.py index 028b5683..64917c10 100644 --- a/python/collateral/wells.py +++ b/python/collateral/wells.py @@ -3,15 +3,18 @@ from . import DAILY_DIR, SftpClient2 from .common import compare_notionals, STRATEGY_CASH_MAPPING -def download_files(*args, **kwargs): +def download_files(*args, fund="Serenitas", **kwargs): + if fund != "Serenitas": + return sftp = SftpClient2.from_creds("wells") - sftp.download_files("/RECEIVE/339425_DATO2", DAILY_DIR / "Wells_reports") + sftp.download_files("/RECEIVE/339425_DATO2", DAILY_DIR / fund / "Wells_reports") -def collateral(d, positions, *, engine, **kwargs): +def collateral(d, positions, *, engine, fund="Serenitas", **kwargs): account = "A5882186" file_name = ( DAILY_DIR + / fund / "Wells_reports" / f"OTC_CDS_Position_Activity_{account}_{d:%m%d%Y}.csv" ) @@ -77,6 +80,7 @@ def collateral(d, positions, *, engine, **kwargs): df = df.rename(columns={"folder": "Strategy", "currency": "Currency"}) df_margin = pd.read_csv( DAILY_DIR + / fund / "Wells_reports" / f"OTC_Moneyline_Activity_{account}_{d:%m%d%Y}.csv", ) @@ -106,9 +110,7 @@ def collateral(d, positions, *, engine, **kwargs): table_cols[-2] = "Current IM" df_margin["Current Excess Deficit"] += df_margin["Pending Amount"] place_holders = ",".join(["%s"] * (len(table_cols) - 1)) - # pomme = (f"INSERT INTO fcm_moneyline VALUES(%s, 'WFNSCLMFCM', {place_holders})" - # f"ON CONFLICT (date, account, currency) DO UPDATE " - # f"({','.join(update_cols)}) = ({','.join(['EXCLUDED.'+c for c in update_cols])})) + with engine.connect() as conn: conn.execute( f"INSERT INTO fcm_moneyline VALUES(%s, 'WFNSCLMFCM', {place_holders})" |
