diff options
Diffstat (limited to 'python/collateral_calc.py')
| -rw-r--r-- | python/collateral_calc.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/collateral_calc.py b/python/collateral_calc.py index 960921ed..e17b95d3 100644 --- a/python/collateral_calc.py +++ b/python/collateral_calc.py @@ -580,13 +580,14 @@ if __name__ == "__main__": keys=["GS", "MS", "CITI", "WF", "BAML"], names=["broker", "strategy"]).reset_index() df.strategy = df.strategy.str.replace("^(M_|SER_)?", "", 1) + df = df[["date", "broker", "strategy", "Amount", "Currency"]] conn = dbconn('dawndb') sql_str = ("INSERT INTO strategy_im VALUES(%s, %s, %s, %s, %s) " "ON CONFLICT (date, strategy, broker) DO UPDATE " "SET currency=EXCLUDED.currency, amount=EXCLUDED.amount") with conn.cursor() as c: for t in df.itertuples(index=False): - c.execute(sql_str, (args.workdate, *t)) + c.execute(sql_str, t) conn.commit() conn.close() if args.send_email: |
