aboutsummaryrefslogtreecommitdiffstats
path: root/python/intex/load_indicative.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/intex/load_indicative.py')
-rw-r--r--python/intex/load_indicative.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/python/intex/load_indicative.py b/python/intex/load_indicative.py
index 89e87e1e..3686aa85 100644
--- a/python/intex/load_indicative.py
+++ b/python/intex/load_indicative.py
@@ -98,11 +98,11 @@ def upload_cusip_data(conn, filename):
conn.commit()
def upload_deal_data(conn, filename):
- sqlstr = "select dealname, array_agg(\"Latest Update\") from clo_universe group by dealname"
+ sqlstr = 'SELECT dealname, array_agg("Latest Update") FROM clo_universe GROUP BY dealname'
with conn.cursor() as c:
c.execute(sqlstr)
deallist1 = dict(c)
- sqlstr = "select dealname from deal_indicative"
+ sqlstr = "SELECT dealname FROM deal_indicative"
with conn.cursor() as c:
c.execute(sqlstr)
deallist2 = [d[0] for d in c]
@@ -125,7 +125,8 @@ def upload_deal_data(conn, filename):
line["Paid Down"] = re.sub("Paid Down: ","", line["Latest Update"])
line["Latest Update"] = line["Paid Down"]
for field in ["Deal Closing Date", "Deal Termination Date", "Reinv End Date", \
- "Latest Update", "Pay Day", "Deal First Pay Date", "Paid Down"]:
+ "Latest Update", "Pay Day", "Deal First Pay Date", "Paid Down",
+ "Deal's Last Refi Date"]:
if line[field]:
try:
line[field] = datetime.datetime.strptime(line[field], '%b %d, %Y').date()
@@ -135,24 +136,22 @@ def upload_deal_data(conn, filename):
if line["Pay Day"]:
line["Pay Day"] = line["Pay Day"].day
for key in ["Principal Collection Account", "Interest Collection Account",
- "Curr Deal Bal", "Tranche Curr Bal", "CDOpercent", "defaultedbal"]:
+ "Curr Deal Bal", "Tranche Curr Bal", "CDOpercent", "defaultedbal",
+ "Orig Deal Bal", "Tranche Orig Bal"]:
if line[key]:
line[key] = sanitize_float(line[key])
line['Deal/Tranche ID'] = line['Deal/Tranche ID'].lower()
dealname = line['Deal/Tranche ID']
if dealname not in deallist2:
- for key in ["Orig Deal Bal", "Tranche Orig Bal"]:
- if line[key]:
- line[key] = sanitize_float(line[key])
-
- sqlstr = "INSERT INTO deal_indicative VALUES( %(Deal/Tranche ID)s, %(Deal Name)s, " \
- "%(Collateral Manager)s, %(Deal Closing Date)s, %(Deal Termination Date)s, " \
- "%(Pay Day)s, %(Reinv End Date)s, %(Deal First Pay Date)s, %(Orig Deal Bal)s, " \
- "%(Tranche Orig Bal)s, %(Deal CUSIP List)s, %(Paid Down)s)"
+ sqlstr = "INSERT INTO deal_indicative VALUES( %(Deal/Tranche ID)s, " \
+ "%(Deal Name)s, %(Collateral Manager)s, " \
+ "%(Deal Closing Date)s, %(Pay Day)s, " \
+ "%(Deal First Pay Date)s, %(Paid Down)s)"
else:
- #we always update Deal Cusip List and paid_down
- sqlstr = 'UPDATE deal_indicative SET "Deal Cusip List"=%(Deal CUSIP List)s, ' \
- 'paid_down=%(Paid Down)s WHERE dealname=%(Deal/Tranche ID)s'
+ #we always update paid_down
+ sqlstr = 'UPDATE deal_indicative SET paid_down=%(Paid Down)s ' \
+ 'WHERE dealname=%(Deal/Tranche ID)s'
+
if line['Deal CUSIP List']:
line['Deal CUSIP List'] = line['Deal CUSIP List'].split(",")
try:
@@ -167,7 +166,9 @@ def upload_deal_data(conn, filename):
"VALUES (%(Deal/Tranche ID)s, %(Curr Deal Bal)s, %(Tranche Curr Bal)s, " \
"%(Tranche Factor)s, %(Principal Collection Account)s, " \
"%(Interest Collection Account)s, %(CDOpercent)s, %(defaultedbal)s, " \
- "%(Coupon)s, %(Latest Update)s)"
+ "%(Coupon)s, %(Latest Update)s, %(Deal's Last Refi Date)s, " \
+ "%(Deal CUSIP List)s, %(Deal Termination Date)s, %(Reinv End Date)s, " \
+ "%(Orig Deal Bal)s, %(Tranche Orig Bal)s)"
try:
with conn.cursor() as c:
c.execute(sqlstring, line)