import pandas as pd
import tushare as ts
from pyecharts import Kline,Bar,Overlap, Grid
pro = ts.pro_api('your token')
#利用tushare获取股票日K走势
def plot_kline(code,start,end):
if code.startswith('6'):
code=code+'.SH'
else:
code=code+'.SZ'
#K线图
df=pro.daily(ts_code=code,adj='hfq',start_date=start,end_date=end)
df.index=pd.to_datetime(df.trade_date)
df=df.sort_index()
grid = Grid()
attr=[str(t) for t in df.index.strftime('%Y%m%d')]
v=df[['open','close','low','high']].values
kline = Kline("K线图",title_text_size=15)
kline.add("", attr, v.round(1),is_datazoom_show=True,)
# 成交量
bar = Bar()
bar.add("", attr, df['vo