def history_dates(mkt_id):
url = _build_url('pricehistory/pricehistory_selectcontract.cfm')
response = requests.get(url=url, params={'Market_ID': mkt_id})
dfs = pd.read_html(response.text, index_col=0)
# Expect a singleton list
assert len(dfs) == 1
df = dfs[0]
mon_str = df.ix['Month:'][1]
months = [dt.datetime.strptime(s[:3], '%b').month for s in mon_str.split()]
year_str = df.ix['Year'][1]
years = [int(s) for s in year_str.split()]
return itertools.product(years, months)
评论列表
文章目录