diff options
| -rw-r--r-- | python/markit_tranche_quotes.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/markit_tranche_quotes.py b/python/markit_tranche_quotes.py index 7e766de5..611ed129 100644 --- a/python/markit_tranche_quotes.py +++ b/python/markit_tranche_quotes.py @@ -4,6 +4,8 @@ import io import pytz import requests from serenitas.utils.db import dbconn +from functools import partial, lru_cache +from quote_parsing.parse_emails import get_current_version params = { "username": "serenitasreports", @@ -43,7 +45,7 @@ def convert_float(s): serenitasdb = dbconn("serenitasdb") - +get_version = lru_cache()(partial(get_current_version, conn=serenitasdb)) 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) @@ -67,6 +69,8 @@ for d in csv.DictReader(f, fieldnames=headers): ) d["series"] = int(d["series"]) d["attachment"], d["detachment"] = int(d["attachment"]), int(d["detachment"]) + if d["version"] == "": + d["version"] = get_version(d["index"], d["series"], d["quotedate"].date()) ref = convert_float(d["reference"]) if d["ticker"] == "CDX-NAHY": if d["contributor"] == "MS" and ref > 115.0: |
