-
-
Save adxrgh/d1110fa8e2fc77a2fbe329af9d32723a to your computer and use it in GitHub Desktop.
[k线 with pynance] #tags:ts,plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
import tushare as ts | |
import pynance as pn | |
ticker=input('input your ticker:') | |
t=ts.get_k_data(ticker) | |
x=t.set_index('date')#设置日期为索引 | |
x.index=x.index.to_datetime()#将索引转为日期格式 | |
x.index.names=['Date']#为索引指定名称 | |
x.volume=x.volume.astype(int)#转换为整数格式 | |
x.rename(columns={'volume':'Volume'},inplace=True)#volume名称修改 | |
y=x[['open','high','low','close','Volume']] | |
pn.chart.candlestick(y) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment