aboutsummaryrefslogtreecommitdiffstats
path: root/python/yieldcurve.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/yieldcurve.py')
-rw-r--r--python/yieldcurve.py7
1 files changed, 3 insertions, 4 deletions
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