aboutsummaryrefslogtreecommitdiffstats
path: root/python/markit/import_quotes.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/markit/import_quotes.py')
-rw-r--r--python/markit/import_quotes.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/python/markit/import_quotes.py b/python/markit/import_quotes.py
index dabdd3b3..1be496d9 100644
--- a/python/markit/import_quotes.py
+++ b/python/markit/import_quotes.py
@@ -288,10 +288,12 @@ def insert_cds(database, workdate: datetime.date):
except TypeError:
logger.error(f"{curve_key.full_ticker} never existed")
else:
- if (workdate - date).days < 20: # we copy over the old curve
+ sc = SpreadCurve.from_bytes(curve, True)
+ if (
+ workdate - sc.base_date
+ ).days < 20 or sc.defaulted: # we copy over the old curve
# check if there was an event of default
# in that case, mark the curve as defaulted
- sc = SpreadCurve.from_bytes(curve, True)
if not sc.defaulted:
defaulted = None
if event_date := default_table.get(cid, False):
@@ -306,7 +308,9 @@ def insert_cds(database, workdate: datetime.date):
"DO UPDATE SET curve=excluded.curve, redcode=excluded.redcode",
(workdate, cid, sen.name, redcode, curve),
)
- logger.info(f"Using {date} curve for {curve_key.ticker}")
+ logger.info(
+ f"Using {sc.base_date} curve for {curve_key.ticker}"
+ )
else:
logger.error(
"Could not find suitable curve for "