tushare는 모든 주식 일선 데이터를 mysql 데이터베이스에 가져옵니다.
862 단어 stock 프로젝트 요약
import time
import tushare
def get_stock_list():
# ,
data = tushare.get_stock_basics()
# ,
return data.index
def get_stock_hist_data(code, start='2010-01-01',
end=time.strftime('%Y-%m-%d', time.localtime())):
#
# tushare get_hist_data()
# :
# date:
# code:
# open:
# high:
# close:
# low:
data = tushare.get_hist_data(code, start, end)
#
stock_list = []
# ( - - - - - )
temp = zip(data.index, [code for x in range(len(data.index))], data.open,
data.close, data.high, data.low)
for i in temp:
stock_list.append(i)
# , ,
return stock_list[::-1]