Python学习日记–股票数据抓取

发布于 2016-04-02  4007 次阅读


完整代码

from matplotlib.finance import _quotes_historical_yahoo
from datetime import date
import pandas as pd

def search(name):
today=date.today()
start=(today.year,today.month-1,today.day)
quotes=_quotes_historical_yahoo(name,start,today)
df=pd.DataFrame(quotes)
print(df)

def getName():
str=input("input the name of stock\n")
return str

str=getName()
search(str)

下图是查询苹果的最近一个月的股票信息QQ图片20160402120154