diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/markit/cds.py | 1 | ||||
| -rw-r--r-- | python/markit/import_quotes.py | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/python/markit/cds.py b/python/markit/cds.py index 8aecb904..1a2e0dae 100644 --- a/python/markit/cds.py +++ b/python/markit/cds.py @@ -8,7 +8,6 @@ import zipfile import time
from env import BASE_DIR
from pandas.tseries.offsets import BDay
-import pandas as pd
logger = logging.getLogger(__name__)
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 " |
