aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/insert_tranche_quotes.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/python/insert_tranche_quotes.py b/python/insert_tranche_quotes.py
index 9c5f9f78..9a7ddb93 100644
--- a/python/insert_tranche_quotes.py
+++ b/python/insert_tranche_quotes.py
@@ -142,8 +142,37 @@ def insert_quotes(year=2014, quote_dir=None):
'trancherunningbid' : trancherunningbid,
'trancherunningmid' : trancherunningmid,
'trancherunningask' : trancherunningask,
- 'index' : 'EU',
- })
+ 'index' : 'EU'})
+ elif csvdict['Ticker'] == 'ITRAXX-Xover':
+ if attach<35:
+ ## the quote is sometimes in Price Bid, sometimes in Bid/Ask
+ ## so we try both
+ trancheupfrontbid = convert(csvdict['Price Bid'])
+ trancheupfrontask = convert(csvdict['Price Ask'])
+ if trancheupfrontbid is None:
+ trancheupfrontbid = convert(csvdict['Bid'])
+ trancheupfrontask = convert(csvdict['Ask'])
+ try:
+ trancheupfrontmid = (trancheupfrontbid + trancheupfrontask)/2
+ except TypeError:
+ trancheupfrontmid = None
+ trancherunningbid = trancherunningask = trancherunningmid = 500
+ else:
+ trancherunningbid= convert(csvdict['Bid'])
+ trancherunningask= convert(csvdict['Ask'])
+ try:
+ trancherunningmid = (trancherunningbid + trancherunningask)/2
+ except TypeError:
+ trancherunningmid = None
+ trancheupfrontbid = trancheupfrontmid = trancheupfrontask = 0
+ d.update({'indexrefspread': int(float(csvdict['Ref'])),
+ 'trancheupfrontbid' : trancheupfrontbid,
+ 'trancheupfrontmid' : trancheupfrontmid,
+ 'trancheupfrontask' : trancheupfrontask,
+ 'trancherunningbid' : trancherunningbid,
+ 'trancherunningmid' : trancherunningmid,
+ 'trancherunningask' : trancherunningask,
+ 'index' : 'XO'})
data.append(d)
with engine.connect() as conn:
for i, l in enumerate(data):