diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/cusip_universe.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/python/cusip_universe.py b/python/cusip_universe.py index d88a44e0..a8bf08a5 100644 --- a/python/cusip_universe.py +++ b/python/cusip_universe.py @@ -23,11 +23,12 @@ cursor = conn.cursor() prog = re.compile("\((.*)\)") -cursor.execute("delete from cusip_universe") +# cursor.execute("delete from cusip_universe") +workdate = '2012-12-11' count = 0 -for i in xrange(9): - cusip_universe_file = "TrInfo{0}.txt".format(i+1) - with open( os.path.join(root, "data", cusip_universe_file), "r") as fh: + +for cusip_universe_file in os.listdir(os.path.join(root, "data", "Trinfo_" + workdate)): + with open( os.path.join(root, "data", "Trinfo_" + workdate, cusip_universe_file), "r") as fh: dr = csv.DictReader(fh, dialect='excel-tab') data = [] for line in dr: @@ -63,6 +64,10 @@ for i in xrange(9): "%(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)" + + sqlstring = "UPDATE cusip_universe SET Curr_Balance = %(Curr Balance)s, Factor = %(Factor)s" \ + ", Curr_moody = %(Curr Moody)s, Curr_attach = %(Curr Attachment Point)s" + try: cursor.execute(sqlstring, line) except psycopg2.DataError as error: |
