aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/clo_universe.py6
-rw-r--r--python/cusip_numbers.py2
-rw-r--r--python/cusip_universe.py2
-rw-r--r--python/download_daily.py2
-rw-r--r--python/fixup.py25
-rw-r--r--python/intex_scenarios.py2
-rw-r--r--python/list_dealnames.py6
-rw-r--r--python/load_bloomberg_data.py2
-rw-r--r--python/load_intex_collateral.py16
-rw-r--r--python/load_markit_data.py4
-rw-r--r--python/select_clean.py12
-rw-r--r--python/trade_booking.py6
-rw-r--r--python/upload_daily.py4
13 files changed, 23 insertions, 66 deletions
diff --git a/python/clo_universe.py b/python/clo_universe.py
index d794ee2f..03904c53 100644
--- a/python/clo_universe.py
+++ b/python/clo_universe.py
@@ -69,10 +69,10 @@ def upload_data(workdate, conn, cursor):
cursor.execute(sqlstring, line)
deallist[dealname] = line['Latest Update']
except psycopg2.DataError as detail:
- print detail
+ print(detail)
pdb.set_trace()
except KeyError as detail:
- print detail
+ print(detail)
pdb.set_trace()
conn.commit()
@@ -84,4 +84,4 @@ if __name__ == "__main__":
upload_data(workdate, common.conn, common.cursor)
common.cursor.close()
common.conn.close()
- print "done"
+ print("done")
diff --git a/python/cusip_numbers.py b/python/cusip_numbers.py
index 142a8e6b..881ec6fa 100644
--- a/python/cusip_numbers.py
+++ b/python/cusip_numbers.py
@@ -28,4 +28,4 @@ for dealname in dealnames:
"VALUES(%s, %s, %s, %s)", data)
conn.commit()
conn.close()
-print "done"
+print("done")
diff --git a/python/cusip_universe.py b/python/cusip_universe.py
index bd024d4d..4dc9c998 100644
--- a/python/cusip_universe.py
+++ b/python/cusip_universe.py
@@ -71,7 +71,7 @@ def upload_data(workdate, conn, cursor):
cursor.execute(sqlstring, line)
except psycopg2.DataError:
pdb.set_trace()
- print "uploaded: {0}".format(line['CUSIP'])
+ print("uploaded: {0}".format(line['CUSIP']))
conn.commit()
for dealname in deals_to_update:
try:
diff --git a/python/download_daily.py b/python/download_daily.py
index 3816e5bf..97b76595 100644
--- a/python/download_daily.py
+++ b/python/download_daily.py
@@ -36,7 +36,7 @@ def download_data(workdate):
for filename in [pnlfile, valuationfile]:
with open(os.path.join(root, str(workdate), "Reports", filename), "wb") as fh:
ftp.retrbinary('RETR ' + filename, fh.write)
- print "downloaded {0}".format(filename)
+ print("downloaded {0}".format(filename))
if os.name=='nt':
gpg = gnupg.GPG(gpgbinary = r'"c:\\Program Files (x86)\\GNU\\GnuPG\\gpg2.exe"',
diff --git a/python/fixup.py b/python/fixup.py
deleted file mode 100644
index 8b939ff5..00000000
--- a/python/fixup.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import csv
-import os.path
-import pdb
-
-if os.name=='nt':
- root = "//WDSENTINEL/share/CorpCDOs/"
-elif os.name=='posix':
- root = "/home/share/CorpCDOs/"
-
-root = os.path.join(root, "data")
-fh1 = open(os.path.join(root, "clo_universe_intex_2012-11-20.txt"))
-fh2 = open(os.path.join(root, "clo_universe_intex_2012-11-21.txt"))
-
-dr1 = csv.DictReader(fh1, dialect = 'excel-tab')
-dr2 = csv.DictReader(fh2, dialect = 'excel-tab')
-
-for line1 in dr1:
- line2 = dr2.next()
- if line1['Deal,Tr/CUSIP/ISIN'] != line2['Deal,Tr/CUSIP/ISIN']:
- pdb.set_trace()
- if line1['Latest Update'] != line2['Latest Update']:
- print '{0}: {1} {2}: {3}'.format(line1['Deal,Tr/CUSIP/ISIN'], line1['Latest Update'],
- line2['Deal,Tr/CUSIP/ISIN'], line2['Latest Update'])
-
-
diff --git a/python/intex_scenarios.py b/python/intex_scenarios.py
index 1700d6ec..5fb0c799 100644
--- a/python/intex_scenarios.py
+++ b/python/intex_scenarios.py
@@ -189,7 +189,7 @@ def generate_scenarios(workdate, dealnames, conn, cursor):
fhsss.close()
fhrecovery.close()
fhcdr.close()
- print "generated scenarios for: {0}".format(dealname)
+ print("generated scenarios for: {0}".format(dealname))
if __name__ == "__main__":
if len(sys.argv) > 1:
diff --git a/python/list_dealnames.py b/python/list_dealnames.py
deleted file mode 100644
index 8d6a09d4..00000000
--- a/python/list_dealnames.py
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /usr/bin/python2
-import os
-filenames = os.listdir("/home/guillaume/share/CorpCDOs/Collaterals")
-
-for name in sorted([fn.split(",")[0].lower() for fn in filenames]):
- print name
diff --git a/python/load_bloomberg_data.py b/python/load_bloomberg_data.py
index fcd4bed4..d7b453cb 100644
--- a/python/load_bloomberg_data.py
+++ b/python/load_bloomberg_data.py
@@ -62,4 +62,4 @@ for filename in os.listdir(root):
common.cursor.close()
common.conn.close()
-print "done"
+print("done")
diff --git a/python/load_intex_collateral.py b/python/load_intex_collateral.py
index 8a5c0ffa..aa6c793a 100644
--- a/python/load_intex_collateral.py
+++ b/python/load_intex_collateral.py
@@ -42,7 +42,7 @@ def upload_data(dealnames, workdate, conn, cursor):
dr = csv.DictReader(fh, dialect = 'excel-tab')
missingfields = set(fields) - set(dr.fieldnames)
if "LoanX ID" in missingfields:
- print "LoanX ID column is missing. Probably an error in exporting from intex"
+ print("LoanX ID column is missing. Probably an error in exporting from intex")
pdb.set_trace()
data = []
for line in dr:
@@ -55,7 +55,7 @@ def upload_data(dealnames, workdate, conn, cursor):
if line['LoanX ID']:
line['LoanX ID'] = line['LoanX ID'].upper()
if len(line['LoanX ID']) > 8:
- print "dubious id found: {0}".format(line['LoanX ID'])
+ print("dubious id found: {0}".format(line['LoanX ID']))
line['LoanX ID'] = line['LoanX ID'][:8]
try:
# make sure the string is utf8 safe
@@ -65,7 +65,7 @@ def upload_data(dealnames, workdate, conn, cursor):
line['Reinvest Collat'] = True
line['Issuer'] = line['ID Number']
except AttributeError as detail:
- print dealname
+ print(dealname)
if 'Spread' in missingfields or not line['Spread']:
line['Spread'] = line['Gross Margin']
@@ -98,7 +98,7 @@ def upload_data(dealnames, workdate, conn, cursor):
try:
updatedate = deal_table[dealname]
except KeyError as detail:
- print detail
+ print(detail)
pdb.set_trace()
reinsert = False
@@ -107,7 +107,7 @@ def upload_data(dealnames, workdate, conn, cursor):
cursor.execute(sqlstr, (dealname, updatedate))
currlen = cursor.fetchone()[0]
if currlen <> len(data):
- print "{0} has {1} rows in the database and current collateral file has {2}".format(dealname, currlen, len(data))
+ print("{0} has {1} rows in the database and current collateral file has {2}".format(dealname, currlen, len(data)))
sqlstr = "DELETE FROM et_collateral where dealname = %s and updatedate = %s"
cursor.execute(sqlstr, (dealname, updatedate))
conn.commit()
@@ -133,10 +133,10 @@ def upload_data(dealnames, workdate, conn, cursor):
try:
cursor.execute(sqlstr, (dealname, updatedate) + tuple(row))
except psycopg2.DataError as detail:
- print detail
+ print(detail)
pdb.set_trace()
except psycopg2.IntegrityError as detail:
- print detail
+ print(detail)
# crazy hack intex unique id is not really unique
conn.rollback()
# make sure the loan name is unique by tagging it
@@ -159,4 +159,4 @@ if __name__ == "__main__":
upload_data(dealnames, workdate, common.conn, common.cursor)
common.cursor.close()
common.conn.close()
- print "done"
+ print("done")
diff --git a/python/load_markit_data.py b/python/load_markit_data.py
index e048e8d0..892bf2e5 100644
--- a/python/load_markit_data.py
+++ b/python/load_markit_data.py
@@ -34,7 +34,7 @@ for filename in os.listdir(os.path.join(root, "data", "markit")):
datetime.datetime.strptime(line['Final Maturity'], '%d-%b-%y')
except ValueError:
if line['Final Maturity'] !='':
- print 'Maturity non empty'
+ print('Maturity non empty')
if line['Depth'] == 'implied':
line['Depth'] = 0
try:
@@ -50,4 +50,4 @@ for filename in os.listdir(os.path.join(root, "data", "markit")):
common.conn.commit()
common.cursor.close()
common.conn.close()
-print "done"
+print("done")
diff --git a/python/select_clean.py b/python/select_clean.py
deleted file mode 100644
index f08fc0b2..00000000
--- a/python/select_clean.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import os
-root = "/home/guillaume/share/CorpCDOs/Collaterals"
-for dealname in os.listdir(root):
-
- with open( os.path.join(root, dealname), "r") as fh:
- # import pdb; pdb.set_trace()
- header = fh.readline().rstrip().split("\t")
- if "Underlying Deal" in header:
- print dealname
- line = fh.readline().split("\t")
- if line[0] == "Sum/WAVG":
- print dealname
diff --git a/python/trade_booking.py b/python/trade_booking.py
index 0cd3022f..4d72f2a1 100644
--- a/python/trade_booking.py
+++ b/python/trade_booking.py
@@ -28,7 +28,7 @@ def list_trade_files():
if "trade" in f)
account_number = "602382.1"
-print "HEADER|" + datetime.strftime(date.today(), "%Y%m%d")
+print("HEADER|" + datetime.strftime(date.today(), "%Y%m%d"))
n_trades = 0
broker_codes = get_broker_codes()
@@ -64,6 +64,6 @@ for trade_file in list_trade_files():
tradestring += \
"{0}|{1}|3|3|3||||||||||||||".format(tradedate,
settledate)
- print tradestring
+ print(tradestring)
-print "TRAILER|{0}".format(n_trades)
+print("TRAILER|{0}".format(n_trades))
diff --git a/python/upload_daily.py b/python/upload_daily.py
index 57788a87..327d5f82 100644
--- a/python/upload_daily.py
+++ b/python/upload_daily.py
@@ -34,7 +34,7 @@ for i in range(10):
os.path.join(root, str(startdate), newfile_to_upload))
except OSError:
pass
- print "moved file from {0}".format(workdatestr)
+ print("moved file from {0}".format(workdatestr))
ftp = FTP('ftp.globeop.com')
ftp.login('srntsftp', config.ftp_password)
ftp.cwd('incoming')
@@ -42,4 +42,4 @@ for i in range(10):
ftp.storbinary('STOR ' + newfile_to_upload, fh)
break
-print "done"
+print("done")