diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/markit_tranche_quotes.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/python/markit_tranche_quotes.py b/python/markit_tranche_quotes.py index 234bbed6..36753711 100644 --- a/python/markit_tranche_quotes.py +++ b/python/markit_tranche_quotes.py @@ -22,6 +22,7 @@ index_mapping = {'ITRAXX-Europe': 'EU', 'ITRAXX-Xover': 'XO', 'CDX-NAIG': 'IG', 'CDX-NAHY': 'HY'} + sql_str = f"""INSERT INTO tranche_quotes(quotedate, index, series, version, tenor, attach, detach, trancheupfrontbid, trancheupfrontmid, trancheupfrontask, trancherunningbid, trancherunningmid, trancherunningask, @@ -39,8 +40,8 @@ def convert_float(s): serenitasdb = dbconn('serenitasdb') -runningdict1 = {0: 500, 3:100, 7:100, 15: 25} -runningdict2 = {0: 500, 3:500, 7:500, 10:100, 15:100, 30:100} +runningdict1 = {0: 500, 3: 100, 7: 100, 15: 25} +runningdict2 = {0: 500, 3: 500, 7: 500, 10: 100, 15: 100, 30: 100} markit_id = get_latest_quote_id(serenitasdb) headers = [h.lower() for h in next(f).split(",")] @@ -92,12 +93,14 @@ for d in csv.DictReader(f, fieldnames=headers): d['delta'] = convert_float(d['delta']) with serenitasdb.cursor() as c: + if d['contributor'] == 'BROWNSTONE': + d['contributor'] = 'BIG' c.execute(sql_str, (d['quotedate'], d['index'], d['series'], d['version'], d['tenor'], d['attachment'], d['detachment'], d['upfront_bid'], d.get('upfront_mid'), d['upfront_ask'], d['spread_bid'], d.get('spread_mid'), d['spread_ask'], d.get('indexrefprice'), d.get('indexrefspread'), d['delta'], d['contributor'], d['quote_id'])) - count +=1 + count += 1 serenitasdb.commit() print(f"loaded {count} new quotes") |
