aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/markit_tranche_quotes.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/markit_tranche_quotes.py b/python/markit_tranche_quotes.py
index 611ed129..894ec56a 100644
--- a/python/markit_tranche_quotes.py
+++ b/python/markit_tranche_quotes.py
@@ -54,6 +54,7 @@ headers = [h.lower() for h in next(f).strip().split(",")]
count = 0
for d in csv.DictReader(f, fieldnames=headers):
+
d["quotedate"] = datetime.datetime.strptime(d["time"], "%m/%d/%Y %H:%M:%S")
d["quotedate"] = d["quotedate"].replace(tzinfo=pytz.UTC)
d["index"] = index_mapping[d["ticker"]]
@@ -81,7 +82,10 @@ for d in csv.DictReader(f, fieldnames=headers):
else:
d["indexrefprice"] = ref
for k in ["_bid", "_mid", "_ask"]:
- d["upfront" + k] = d["price" + k]
+ if d["price" + k]:
+ d["upfront" + k] = d["price" + k]
+ elif d["spread" + k]:
+ d["upfront" + k] = d["spread" + k]
d["spread" + k] = (
0 if d["series"] in [9, 10] and d["attachment"] == 10 else 500
)