aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/cusip_universe.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/python/cusip_universe.py b/python/cusip_universe.py
index b389aee0..471b0aae 100644
--- a/python/cusip_universe.py
+++ b/python/cusip_universe.py
@@ -16,7 +16,10 @@ def sanitize_float(intex_float):
if "(" in intex_float:
intex_float = - float(intex_float[1:-1])
else:
- intex_float = float(intex_float)
+ try:
+ intex_float = float(intex_float)
+ except ValueError:
+ pdb.set_trace()
return intex_float
def upload_data(workdate, conn, cursor):
@@ -42,7 +45,8 @@ def upload_data(workdate, conn, cursor):
cursor.execute(sqlstring, (line['CUSIP'],))
curr_date = cursor.fetchone()
if not curr_date or curr_date[0] < dealupdate[dealname]:
- deals_to_update.append(dealname)
+ if dealname in deals_to_update:
+ deals_to_update.append(dealname)
line['updatedate'] = dealupdate[dealname]
for key in ['Curr Balance', 'Orig Balance', 'Orig Attachment Point',
'Curr Attachment Point', 'Orig Detachment Point',
@@ -61,13 +65,19 @@ def upload_data(workdate, conn, cursor):
"%(Orig Attachment Point)s, %(Orig Detachment Point)s, %(Curr Attachment Point)s," \
"%(Curr Detachment Point)s, %(Floater Index)s, %(Floater Spread)s, " \
"%(updatedate)s)"
- cursor.execute(sqlstring, line)
+ try:
+ cursor.execute(sqlstring, line)
+ except psycopg2.DataError:
+ pdb.set_trace()
print "uploaded: {0}".format(line['CUSIP'])
conn.commit()
for dealname in deals_to_update:
- cursor.execute("SELECT p_cusip, p_curr_subordination, "\
- "p_curr_thickness from et_deal_subordination(%s)",
- (dealname,))
+ try:
+ cursor.execute("SELECT p_cusip, p_curr_subordination, "\
+ "p_curr_thickness from et_deal_subordination(%s)",
+ (dealname,))
+ except psycopg2.DataError:
+ pdb.set_trace()
data = cursor.fetchall()
data = [ (t[1], t[2], t[0], dealupdate[dealname]) for t in data]
cursor.executemany("UPDATE cusip_universe SET subordination = %s, "