aboutsummaryrefslogtreecommitdiffstats
path: root/python/process_queue.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/process_queue.py')
-rw-r--r--python/process_queue.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/process_queue.py b/python/process_queue.py
index 42e666a3..0bb705e7 100644
--- a/python/process_queue.py
+++ b/python/process_queue.py
@@ -688,12 +688,19 @@ def bond_trade_process(conn, session, trade):
bbg_data["INT_ACC"] * currentface / 100.0
)
principal_payment = trade["PrincipalPayment"] = currentface * trade["price"] / 100.0
+ if trade["accrued"] is None:
+ trade["accrued"] = bbg_data["INT_ACC"]
+ else:
+ if trade["accrued"] != bbg_data["INT_ACC"]:
+ logging.error(
+ f"{trade['accrued']} does not match bbg amount of {bbg_data['INT_ACC']}"
+ )
with conn.cursor() as c:
c.execute(
- "UPDATE bonds SET principal_payment = %s, accrued_payment = %s "
+ "UPDATE bonds SET principal_payment = %s, accrued_payment = %s, accrued=%s "
"WHERE id = %s",
- (principal_payment, accrued_payment, int(trade["id"])),
+ (principal_payment, accrued_payment, bbg_data["INT_ACC"], int(trade["id"])),
)
# mark it at buy price
if trade["buysell"]: