aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/markit_tranche_quotes.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/python/markit_tranche_quotes.py b/python/markit_tranche_quotes.py
index 93df191b..234bbed6 100644
--- a/python/markit_tranche_quotes.py
+++ b/python/markit_tranche_quotes.py
@@ -8,7 +8,8 @@ from db import dbconn
params = {"username": "serenitasreports",
"password": "_m@rk1t_",
"reportUri": "/MarkitQuotes/CLIENTS/AllTrancheQuotes",
- "exportType": "csv"}
+ "exportType": "csv",
+ "START_TIME": "11/13/2017"}
r = requests.get("https://quotes.markit.com/reports/runReport",
params=params)
@@ -25,7 +26,7 @@ sql_str = f"""INSERT INTO tranche_quotes(quotedate, index, series, version, teno
trancheupfrontbid, trancheupfrontmid, trancheupfrontask,
trancherunningbid, trancherunningmid, trancherunningask,
indexrefprice, indexrefspread, tranchedelta, quotesource, markit_id)
- VALUES({",".join(["%s"]*18)})"""
+ VALUES({",".join(["%s"]*18)}) ON CONFLICT DO NOTHING"""
def get_latest_quote_id(db):
with db.cursor() as c:
@@ -45,8 +46,6 @@ markit_id = get_latest_quote_id(serenitasdb)
headers = [h.lower() for h in next(f).split(",")]
count = 0
for d in csv.DictReader(f, fieldnames=headers):
- if int(d['quote_id']) <= markit_id:
- continue
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']]