aboutsummaryrefslogtreecommitdiffstats
path: root/python/report_ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/report_ops')
-rw-r--r--python/report_ops/custodians.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/report_ops/custodians.py b/python/report_ops/custodians.py
index eab6cb9f..587ef6a0 100644
--- a/python/report_ops/custodians.py
+++ b/python/report_ops/custodians.py
@@ -11,9 +11,11 @@ from dataclasses import dataclass
_sql = (
"INSERT INTO bond_csv_upload (allocationid, identifier, principal, interest) SELECT id, identifier, principal_payment, "
- "accrued_payment FROM bond_trades WHERE trade_date=%s AND account=%s AND tradeid IS NOT NULL ON CONFLICT DO NOTHING RETURNING *"
+ "accrued_payment FROM bond_trades WHERE trade_date=%s AND account=%s AND tradeid IS NOT NULL ON CONFLICT DO NOTHING RETURNING allocationid;"
)
+_bond_query = "SELECT * FROM bond_trades WHERE id in %s;"
+
def upload_to_custodian(account, trade_date, conn, upload):
_fund = {"BBH": "BRINKER", "UMB": "UMB"}
@@ -26,6 +28,10 @@ def upload_to_custodian(account, trade_date, conn, upload):
account,
),
)
+ tids = tuple(row.allocationid for row in c)
+ if not tids:
+ return
+ c.execute(_bond_query, (tids,))
for row in c:
trade = BondDeal.from_dict(**row._asdict(), scaled=True)
match account: