aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/futures.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/futures.py b/python/futures.py
index 46aaf115..98e1cd23 100644
--- a/python/futures.py
+++ b/python/futures.py
@@ -23,15 +23,15 @@ def nextIMMDates(startdate, length = 8):
return r
if len(sys.argv)>1:
- workdate = datetime.datetime.strptime(sys.argv[1], "%Y-%m-%d").date()
+ workdate = datetime.datetime.strptime(sys.argv[1], "%Y-%m-%d")
else:
- workdate = datetime.date.today()
+ workdate = datetime.datetime.today()
# get next 8 futures maturities
-contracts = ["GE" + monthcodes[d.month-1] + str(d.year)[-1:] for d in nextIMMDates(workdate)]
+contracts = ["GE" + monthcodes[d.month-1] + str(d.year)[-1:] for d in nextIMMDates(workdate.date())]
#putting a historic date doesn't work
if sys.version_info >= (3,3):
- ts = int(workdate*1000)
+ ts = int(datetime.datetime.timestamp(workdate) * 1000)
else:
ts = datetime.datetime.strftime(workdate, '%s') + '000'
@@ -41,7 +41,7 @@ quotes = json.loads(r.text)
central = pytz.timezone('US/Central')
with open(os.path.join(common.root, "data", "Yield Curves",
- "futures-{0}.csv".format(workdate)), "w") as fh:
+ "futures-{0}.csv".format(workdate.date())), "w") as fh:
for q in quotes[u'marketDataInfoAsStringList'][u'message']:
q['tradeDate'] = q['tradeDate'].strip(' ').strip()
tradedate = datetime.datetime.strptime(q['tradeDate'],