aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/position.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/position.py b/python/position.py
index e1bccf15..873cc9ac 100644
--- a/python/position.py
+++ b/python/position.py
@@ -319,6 +319,7 @@ def populate_cashflow_history(engine, session, workdate=None, fund="SERCGMAST"):
fixed_coupons = {"XS0306416982 Mtge": 7.62, "91927RAD1 Mtge": 6.77}
conn = engine.raw_connection()
for k, v in data.items():
+ identifier = securities.loc[k, "identifier"]
if "HIST_CASH_FLOW" in v:
to_insert = v["HIST_CASH_FLOW"].merge(
v["MTG_HIST_CPN"],
@@ -355,8 +356,9 @@ def populate_cashflow_history(engine, session, workdate=None, fund="SERCGMAST"):
else: # damn you XS0299146992 !
continue
else:
- logging.error("No cashflows for the given security")
- identifier = securities.loc[k, "identifier"]
+ logging.error(f"No cashflows for security {identifier}")
+ continue
+
to_insert["identifier"] = identifier
with conn.cursor() as c:
c.execute("DELETE FROM cashflow_history WHERE identifier=%s", (identifier,))