import tushare as ts
a = ts.get_k_data('150228', ktype='60')
获取月线
获取代码表
获取月线
获取代码表
a = ts.get_stock_basics()
读取沪深300数据保存在excel中import tushare as ts
读取沪深300数据保存在excel中import tushare as ts
df = ts.get_hist_data('399300', ktype='M')
#直接保存
df.to_csv('c:/399300.csv')
#选择保存
df.to_csv('c:/399300_2.csv',columns=['open','close'])