aboutsummaryrefslogtreecommitdiffstats
path: root/python/load_intex_collateral.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/load_intex_collateral.py')
-rw-r--r--python/load_intex_collateral.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/python/load_intex_collateral.py b/python/load_intex_collateral.py
index c2cb9c19..a7a0336b 100644
--- a/python/load_intex_collateral.py
+++ b/python/load_intex_collateral.py
@@ -26,14 +26,6 @@ def sanitize_float(intex_float):
intex_float = float(intex_float)
return intex_float
-def get_latest_dealupdate(workdate):
- with open(os.path.join(common.root, "data", "clo_universe_intex_" + workdate + ".txt")) as fh:
- dr = csv.DictReader(fh, dialect='excel-tab')
- deal_table = {line['Deal,Tr/CUSIP/ISIN']:
- datetime.datetime.strptime(line['Latest Update'], '%b %d, %Y').date() \
- for line in dr if 'Paid' not in line['Latest Update'] and line['Latest Update']}
- return deal_table
-
def upload_data(dealnames, workdate, conn):
for dealname in dealnames:
#dealname, updatedate = line.rstrip().split()
@@ -97,12 +89,8 @@ def upload_data(dealnames, workdate, conn):
sqlstr = "select distinct(updatedate) from et_collateral where dealname= %s"
old_update_dates = [date[0] for date in query_db(sqlstr, params=(dealname,), one=False)]
- deal_table = get_latest_dealupdate(workdate)
- try:
- updatedate = deal_table[dealname]
- except KeyError as detail:
- print(detail)
- pdb.set_trace()
+ sqlstr = 'select max("Latest Update") from clo_universe where dealname= %s'
+ updatedate = query_db(sqlstr, params=(dealname,))[0]
reinsert = False
if updatedate in old_update_dates: