aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/import_quotes.py2
-rw-r--r--python/intex/intex_scenarios.py3
-rw-r--r--python/load_cf.py2
-rw-r--r--python/markit_cds.py3
-rw-r--r--python/task_server/globeop.py4
-rw-r--r--python/yieldcurve.py7
6 files changed, 9 insertions, 12 deletions
diff --git a/python/import_quotes.py b/python/import_quotes.py
index 589f3924..589e9033 100644
--- a/python/import_quotes.py
+++ b/python/import_quotes.py
@@ -70,7 +70,7 @@ def get_current_tickers(database, workdate):
def insert_cds(database, workdate):
all_tickers, markit_bbg_mapping = get_current_tickers(database, workdate)
- filename = "cds eod {0}.csv".format(datetime.datetime.strftime(workdate, "%Y%m%d"))
+ filename = "cds eod {%Y%m%d}.csv".format(workdate)
colnames = ['Upfront'+tenor for tenor in ['6m', '1y', '2y', '3y', '4y', '5y', '7y', '10y']]
sqlstr = "INSERT INTO cds_quotes(date, curve_ticker, upfrontbid, upfrontask," \
"runningbid, runningask, source, recovery) VALUES(%s, %s, %s, %s, %s, %s, %s, %s)"
diff --git a/python/intex/intex_scenarios.py b/python/intex/intex_scenarios.py
index 2650b25a..eece4876 100644
--- a/python/intex/intex_scenarios.py
+++ b/python/intex/intex_scenarios.py
@@ -60,8 +60,7 @@ def get_reinvenddate(dealname):
sqlstr = 'SELECT reinv_end_date from deal_indicative where dealname=%s'
reinvenddate = query_db(sqlstr, params = (dealname,))[0]
if reinvenddate:
- reinvenddate = reinvenddate.strftime("%Y%m%d")
- return reinvenddate
+ return reinvenddate.strftime("%Y%m%d")
else:
raise Exception("missing reinvestment end date")
diff --git a/python/load_cf.py b/python/load_cf.py
index ca4c1fb5..0b998863 100644
--- a/python/load_cf.py
+++ b/python/load_cf.py
@@ -65,7 +65,7 @@ def get_configfile(dealname, tradedate):
def get_dist(date):
distfile = os.path.join(root, "Scenarios", "Calibration",
- "marketdata-{0}.RData".format(date.strftime("%Y-%m-%d")))
+ "marketdata-{%Y-%m-%d}.RData".format(date))
dist = ro.r.load(distfile)
return {"L": np.array(dist[0]),"R": np.array(dist[1])}
diff --git a/python/markit_cds.py b/python/markit_cds.py
index 05b7e9a7..bd004d3d 100644
--- a/python/markit_cds.py
+++ b/python/markit_cds.py
@@ -55,13 +55,12 @@ if __name__=="__main__":
else:
workdate = pd.datetime.today()-BDay(1)
historical = False
- strworkdate = pd.datetime.strftime(workdate, "%Y%m%d")
payload = {'user': 'GuillaumeHorel',
'password': 'password',
'version': '5',
'format': 'csv',
'report': 'FIXED_COUPON',
- 'date': strworkdate,
+ 'date': workdate.strftime("%Y%m%d"),
'type': 'CDS'}
download_cds_data(payload)
payload.update({'type':'CredIndex','version':4})
diff --git a/python/task_server/globeop.py b/python/task_server/globeop.py
index d252d415..0c5a82a9 100644
--- a/python/task_server/globeop.py
+++ b/python/task_server/globeop.py
@@ -113,8 +113,8 @@ def upload_data(startdate):
file_to_upload = filelist[0][0]
newfile_to_upload = file_to_upload
if workdate < startdate:
- newfile_to_upload = "securitiesNpv{0}.csv".format(
- datetime.datetime.strftime(datetime.datetime.today(), "%Y%m%d_%H%M%S"))
+ newfile_to_upload = "securitiesNpv{%Y%m%d_%H%M%S}.csv".\
+ format(datetime.datetime.today())
# due to the way the drive is mounted, we get an exception when copy
# tries to change permissions
try:
diff --git a/python/yieldcurve.py b/python/yieldcurve.py
index 7f27fe67..2dadf311 100644
--- a/python/yieldcurve.py
+++ b/python/yieldcurve.py
@@ -13,10 +13,9 @@ import matplotlib.pyplot as plt
def getMarkitIRData(date = datetime.date.today()):
basedir = os.path.join(root, "data", "Yield Curves")
- datestr = date.strftime("%Y%m%d")
- filename = "InterestRates_USD_{0}.xml".format(datestr)
+ filename = "InterestRates_USD_{%Y%m%d}.xml".format(date)
if not os.path.exists(os.path.join(basedir, filename)):
- r = requests.get('http://www.markit.com/news/InterestRates_USD_{0}.zip'.format(datestr))
+ r = requests.get('http://www.markit.com/news/InterestRates_USD_{%Y%m%d}.zip'.format(date))
if "x-zip" in r.headers['content-type']:
with zipfile.ZipFile(BytesIO(r.content)) as z:
z.extractall(path = os.path.join(root, "data", "Yield Curves"))
@@ -38,7 +37,7 @@ def getMarkitIRData(date = datetime.date.today()):
def get_futures_data(date = datetime.date.today()):
futures_file = os.path.join(root, "data", "Yield Curves",
- "futures-{0}.csv".format(date.strftime("%Y-%m-%d")))
+ "futures-{%Y-%m-%d}.csv".format(date)
with open(futures_file) as fh:
quotes = [float(line.split(",")[1]) for line in fh]
return quotes