我正在使用下面的代码下载股票报价,并且已经意识到DataReader返回的报价与我可以通过他们的网页从Yahoo下载的报价不同。 但我无法弄清楚问题是雅虎Feed还是DataReader。 有没有人有这种问题的经验?
def downloadQuotes(start_date, end_date, symbols, provider=PROVIDER):
import pandas.io.data as web
quotes = web.DataReader(symbols, provider, start_date, end_date)
if len(quotes.major_axis) == 0:
# show error message
raise SystemExit
# change symbols to panel items
quotes = quotes.transpose(2, 1, 0)
print quotes['VWESX']['Adj Close'][0:23]
...
这些来自网页(只有最后一个字段很重要):
1989-12-29,8.24,8.24,8.24,8.24,000,1.56
1989-12-28,8.25,8.25,8.25,8.25,000,1.55
1989-12-27,8.24,8.24,8.24,8.24,000,1.55
1989-12-26,8.25,8.25,8.25,8.25,000,1.55
1989-12-22,8.29,8.29,8.29,8.29,000,1.56
1989-12-21,8.31,8.31,8.31,8.31,000,1.56
1989-12-20,8.31,8.31,8.31,8.31,000,1.56
1989-12-19,8.31,8.31,8.31,8.31,000,1.56
1989-12-18,8.31,8.31,8.31,8.31,000,1.56
1989-12-15,8.30,8.30,8.30,8.30,000,1.56
1989-12-14,8.30,8.30,8.30,8.30,000,1.56
1989-12-13,8.30,8.30,8.30,8.30,000,1.56
1989-12-12,8.30,8.30,8.30,8.30,000,1.56
1989-12-11,8.30,8.30,8.30,8.30,000,1.56
1989-12-08,8.29,8.29,8.29,8.29,000,1.56
1989-12-07,8.29,8.29,8.29,8.29,000,1.56
1989-12-06,8.30,8.30,8.30,8.30,000,1.56
1989-12-05,8.31,8.31,8.31,8.31,000,1.56
1989-12-04,8.31,8.31,8.31,8.31,000,1.56
1989-12-01,8.30,8.30,8.30,8.30,000,1.56
以及以上代码中的这些:
1989-12-01 1.55
1989-12-04 1.56
1989-12-05 1.56
1989-12-06 1.55
1989-12-07 1.55
1989-12-08 1.55
1989-12-11 1.55
1989-12-12 1.55
1989-12-13 1.55
1989-12-14 1.55
1989-12-15 1.55
1989-12-18 1.56
1989-12-19 1.56
1989-12-20 1.56
1989-12-21 1.56
1989-12-22 1.55
1989-12-26 1.55
1989-12-27 1.54
1989-12-28 1.55
1989-12-29 1.55
谢谢,
JM