aboutsummaryrefslogtreecommitdiffstats
path: root/python/upload_umb_bonds.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/upload_umb_bonds.py')
-rw-r--r--python/upload_umb_bonds.py28
1 files changed, 1 insertions, 27 deletions
diff --git a/python/upload_umb_bonds.py b/python/upload_umb_bonds.py
index 1c000ebb..b6d75339 100644
--- a/python/upload_umb_bonds.py
+++ b/python/upload_umb_bonds.py
@@ -2,33 +2,7 @@ import argparse
import datetime
from serenitas.ops.trade_dataclasses import BondDeal
from serenitas.ops.funds import UMB
-
-
-def upload_to_umb(trade_date, upload):
- sql_query = (
- "SELECT bonds.*, bond_allocation.notional, fund, custodian, "
- "cash_account, "
- "counterparties.name, dtc_number "
- "FROM bonds "
- "INNER JOIN bond_allocation ON bond_allocation.tradeid=bonds.id "
- "INNER JOIN accounts USING (code) "
- "INNER JOIN counterparties ON counterparties.code = bonds.cp_code "
- "WHERE fund= %s and trade_date = %s "
- )
- with BondDeal._conn.cursor() as c:
- c.execute(
- sql_query,
- (
- "SERCGMAST",
- args.trade_date,
- ),
- )
- for row in c:
- UMB.stage(row._asdict(), trade_type="bond", redis_pipeline=None)
- buf, dest = UMB.build_buffer("bond")
- if upload:
- UMB.upload(buf, dest)
-
+from serenitas.ops.custodians import upload_to_umb
if __name__ == "__main__":
parser = argparse.ArgumentParser()