aboutsummaryrefslogtreecommitdiffstats
path: root/python/populate_tranche_cashflows.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/populate_tranche_cashflows.py')
-rw-r--r--python/populate_tranche_cashflows.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/populate_tranche_cashflows.py b/python/populate_tranche_cashflows.py
index 1a7264d5..a76aabaf 100644
--- a/python/populate_tranche_cashflows.py
+++ b/python/populate_tranche_cashflows.py
@@ -49,18 +49,18 @@ def insert_tranche_cashflows(
with dawndb.cursor() as c:
for tranche_id, principal, accrued in data:
c.execute(
- "INSERT INTO tranche_cashflows VALUES(%s, %s, %s, %s, %s)",
+ "INSERT INTO tranche_cashflows VALUES(%s, %s, %s, %s, %s) ON CONFLICT ON CONSTRAINT tranche_cashflows_pkey DO NOTHING",
(auction_date + bus_day, tranche_id, principal, accrued, "USD"),
)
dawndb.commit()
def insert_tranche_accrued(d: datetime.date, dawndb, fund="SERCGMAST"):
- portf = get_tranche_portfolio(d, dawndb, fund=fund)
+ portf = get_tranche_portfolio(d, dawndb, funds=(fund,))
with dawndb.cursor() as c:
for t in portf:
c.execute(
- "INSERT INTO tranche_cashflows(date, tranche_id, accrued, currency) "
+ "INSERT INTO tranche_cashflows(date, tranche_id, accrued, currency) ON CONFLICT ON CONSTRAINT tranche_cashflows_pkey DO NOTHING"
"VALUES(%s, %s, %s, %s)",
(
t.cs["payment_dates"][0],
@@ -100,4 +100,4 @@ if __name__ == "__main__":
serenitas.analytics._include_todays_cashflows = True
for fund in ("SERCGMAST", "BOWDST", "BRINKER", "ISOSEL"):
- insert_tranche_accrued(datetime.date(2022, 9, 19), dawndb, fund)
+ insert_tranche_accrued(datetime.date(2022, 12, 16), dawndb, fund)