我想一次下载多个行使价的数据。下面的功能可以正常工作,但适用于单行使价。
def download_nifty_option_data(self):
expiry_date_prev_month = get_expiry_date(year=2018, month=11)
#Adding one day
expiry_date_prev_month = expiry_date_prev_month + datetime.timedelta(days=1)
expiry_date_this_month = get_expiry_date(year=2018, month=12)
print expiry_date_this_month
date1 = datetime.datetime.strptime(str(expiry_date_prev_month), "%Y-%m-%d")
date2 = datetime.datetime.strptime(str(expiry_date_this_month), "%Y-%m-%d")
nifty_opt = get_history(symbol="NIFTY",
start=date(date1.year, date1.month, date1.day),
end=date(date2.year, date2.month, date2.day),
index=True,
option_type='CE',
strike_price=10900,
expiry_date=date(2018, 12, 27))
#nifty = get_history(symbol="NIFTY", start=date(2015, 1, 1), end=date(2018, 12, 13), index=True)
nifty_opt.to_csv(self.download_dir + 'nifty_opt.csv', index=True)
print 'Data downloaded successfully!'
有什么办法可以传递多重执行价格?我正在跟踪此链接,但无法在那里解决。