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.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/python/intex/load_indicative.py b/python/intex/load_indicative.py
index 145325df..ac2bb8ab 100644
--- a/python/intex/load_indicative.py
+++ b/python/intex/load_indicative.py
@@ -143,22 +143,23 @@ def upload_deal_data(conn, filename):
for key in ["Orig Deal Bal", "Tranche Orig Bal"]:
if line[key]:
line[key] = sanitize_float(line[key])
- if line['Deal CUSIP List']:
- line['Deal CUSIP List'] = line['Deal CUSIP List'].split(",")
+
sqlstr = "INSERT INTO deal_indicative VALUES( %(Deal/Tranche ID)s, %(Deal Name)s, " \
"%(Collateral Manager)s, %(Deal Issue 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)"
- try:
- with conn.cursor() as c:
- c.execute(sqlstr, line)
- except (psycopg2.DataError, KeyError) as detail:
- logger.error(detail)
- continue
- with conn.cursor() as c:
- if line['Paid Down']:
- c.execute("UPDATE deal_indicative SET paid_down=%s WHERE dealname=%s",
- (line['Paid Down'], dealname))
+ 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 Name)s'
+ if line['Deal CUSIP List']:
+ line['Deal CUSIP List'] = line['Deal CUSIP List'].split(",")
+ try:
+ with conn.cursor() as c:
+ c.execute(sqlstr, line)
+ except (psycopg2.DataError, KeyError) as detail:
+ logger.error(detail)
+ continue
if dealname not in deallist1 or line['Latest Update'] not in deallist1[dealname]:
sqlstring = \
"INSERT INTO clo_universe " \