import pandas as pd
from bokeh.plotting import figure, output_file, show
import akshare as ak
df = ak.stock_zh_a_hist(symbol="000001", period="daily", start_date="20220701", end_date='20220820',
adjust="")
# df = pd.DataFrame(AAPL)
print(df)
print(type(df))
df['date'] = pd.to_datetime(df['日期'])
print(df['date'])
# # output_file("datetime.html")
# create a new plot with a datetime axis type
p = figure(plot_width=800, plot_height=250, x_axis_type="datetime")
p.line(df['date'], df['收盘'], color='navy', alpha=0.5)
show(p)
[030量化交易] python互交式显示 bokeh绘制收盘价格
最新推荐文章于 2024-08-15 01:55:01 发布