diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/load_indicative.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/python/load_indicative.py b/python/load_indicative.py index 03dad396..864d609e 100644 --- a/python/load_indicative.py +++ b/python/load_indicative.py @@ -53,25 +53,26 @@ def upload_cusip_data(conn, filename): line['updatedate'] = dealupdate[dealname] try: for key in ['Curr Balance', 'Orig Balance', 'Orig Attachment Point', - 'Curr Attachment Point', 'Orig Detachment Point', - 'Curr Detachment Point', 'Factor', 'Coupon', 'Floater Spread']: + 'Curr Attachment Point (def at par)', 'Orig Detachment Point', + 'Curr Detachment Point (def at par)', 'Factor', 'Coupon', 'Floater Spread']: if line[key]: line[key] = sanitize_float(line[key]) line[key] = convertToNone(line[key]) except ValueError: continue - + line['Curr Attachment Point'] = line['Curr Attachment Point (def at par)'] + line['Curr Detachment Point'] = line['Curr Detachment Point (def at par)'] if "Curr Moody" not in line: line['Curr Moody'] = line['Orig Moody'] - sqlstring = "INSERT INTO cusip_universe(Cusip, ISIN, dealname, tranche, " \ + sqlstring = "INSERT INTO cusip_universe(Cusip, ISIN, \"Bloomberg Ticker\", dealname, tranche, " \ "Coupon, Orig_Balance, Curr_Balance, Factor, Orig_Moody, Curr_Moody, " \ "Orig_Attach, Orig_Detach, Curr_Attach, Curr_Detach, Floater_Index, " \ - "Spread, updatedate)" \ - "VALUES (%(CUSIP)s, %(ISIN)s, %(dealname)s, %(tranche)s, %(Coupon)s, " \ + "Spread, updatedate) " \ + "VALUES(%(CUSIP)s, %(ISIN)s, %(Bloomberg Ticker)s, %(dealname)s, %(tranche)s, %(Coupon)s, " \ "%(Orig Balance)s, %(Curr Balance)s, %(Factor)s, %(Orig Moody)s, %(Curr Moody)s, " \ - "%(Orig Attachment Point)s, %(Orig Detachment Point)s, %(Curr Attachment Point)s," \ - "%(Curr Detachment Point)s, %(Floater Index)s, %(Floater Spread)s, " \ - "%(updatedate)s)" + "%(Orig Attachment Point)s, %(Orig Detachment Point)s, "\ + "%(Curr Attachment Point)s, %(Curr Detachment Point)s, " \ + "%(Floater Index)s, %(Floater Spread)s, %(updatedate)s)" try: with conn.cursor() as c: c.execute(sqlstring, line) @@ -100,7 +101,7 @@ def upload_deal_data(conn, filename): dr = csv.DictReader(fh, dialect='excel-tab') data = [] for line in dr: - if not line ['Deal Name'] or (line['Deal Name'] == 'Unknown Security'): + if not line['Deal Name, Tranche Name'] or (line['Deal Name, Tranche Name'] == 'Unknown Security'): continue if not line['Latest Update']: break @@ -124,13 +125,14 @@ def upload_deal_data(conn, filename): "CDO Defaulted Security Balance (Reported)"]: if line[key]: line[key] = sanitize_float(line[key]) - dealname = line['Deal,Tr/CUSIP/ISIN'] + + dealname = line['Deal/Tranche ID'] line['defaultedbal'] = line["CDO Defaulted Security Balance (Reported)"] line['Deal CUSIP List'] = line['Deal CUSIP List'].split(",") if dealname not in deallist or line['Latest Update'] > deallist[dealname]: sqlstring = \ "INSERT INTO clo_universe " \ - "VALUES (%(Deal,Tr/CUSIP/ISIN)s, %(Deal Name)s, %(Collateral Manager)s, %(Orig Deal Bal)s," \ + "VALUES (%(Deal/Tranche ID)s, %(Deal Name)s, %(Collateral Manager)s, %(Orig Deal Bal)s," \ "%(Curr Deal Bal)s, %(Tranche Orig Bal)s, %(Tranche Curr Bal)s, %(Tranche Factor)s," \ "%(Collection Account Principal Balance)s," \ "%(Collection Account Interest Balance)s, %(CDOpercent)s, %(defaultedbal)s, " \ |
