aboutsummaryrefslogtreecommitdiffstats
path: root/python/clo_universe.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/clo_universe.py')
-rw-r--r--python/clo_universe.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/clo_universe.py b/python/clo_universe.py
index 75d8fd72..47dfb65d 100644
--- a/python/clo_universe.py
+++ b/python/clo_universe.py
@@ -7,10 +7,19 @@ import pdb
import re
import sys
import common
+import psycopg2
def convertToNone(s):
return None if s=="-" or s=="" or s == "NR" else s
+def sanitize_float(intex_float):
+ intex_float = intex_float.replace(",", "")
+ if "(" in intex_float:
+ intex_float = - float(intex_float[1:-1])
+ else:
+ intex_float = float(intex_float)
+ return intex_float
+
def upload_data(workdate, conn, cursor):
cursor.execute("select dealname, max(\"Latest Update\") from clo_universe group by dealname")
deallist = dict(cursor.fetchall())
@@ -42,7 +51,7 @@ def upload_data(workdate, conn, cursor):
"CDO Pct of Assets that are Structured Finance Obligations",
"CDO Defaulted Security Balance (Reported)"]:
if line[key]:
- line[key] = line[key].replace(",", "")
+ line[key] = sanitize_float(line[key])
dealname = line['Deal,Tr/CUSIP/ISIN']
line['defaultedbal'] = line["CDO Defaulted Security Balance (Reported)"]
line['Deal CUSIP List'] = line['Deal CUSIP List'].split(",")