diff options
| -rw-r--r-- | python/strat_cash_realloc.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/python/strat_cash_realloc.py b/python/strat_cash_realloc.py index 0bfafce0..c2d8b696 100644 --- a/python/strat_cash_realloc.py +++ b/python/strat_cash_realloc.py @@ -1,12 +1,13 @@ from dataclasses import replace -from serenitas.ops.funds import Bowdst +from serenitas.ops.funds import Service from serenitas.ops.trade_dataclasses import WireDeal import datetime from serenitas.analytics.dates import prev_business_day from collateral.common import CASH_STRATEGY_MAPPING, STRATEGY_CASH_MAPPING -def generate_csv(date, fund="BOWDST"): +def generate_csv(date, fund): + service = Service[fund] with WireDeal._conn.cursor() as c: c.execute( "SELECT 1 FROM wires WHERE trade_date=%s AND fund=%s AND author='auto'", @@ -35,10 +36,10 @@ def generate_csv(date, fund="BOWDST"): if not WireDeal._insert_queue: return for wire in WireDeal.commit(returning=True): - Bowdst.staging_queue.append(wire.to_globeop("NEW")) - buf, dest = Bowdst.build_buffer("wire") - Bowdst.upload(buf, dest.name) - Bowdst().clear() + service.push(wire, "NEW") + buf, dest = service.build_buffer("wire") + service.upload(buf, dest.name) + service().clear() if __name__ == "__main__": @@ -54,4 +55,4 @@ if __name__ == "__main__": ) args = parser.parse_args() - generate_csv(args.workdate) + generate_csv(args.workdate, "BOWDST") |
