注意: pyecharts本身存在bug , 如果绘图出现空白 , ctrl shift p 搜索 "信任notebook" ,点击信任 , 如果网页一直处于加载状态可以多刷新几次页面试试
还有问题的话可以重新建立一个notebook执行上述步骤
效果图:
用于在研究中获取回测信息,并将买卖点绘制在K线图中, 使用了pyecharts库 , 动手能力强的小伙伴们可以自己使用返回的overlip添加技术指标等显示在图上
(1) 初始化, 获取回测信息
回测ID(backtestId):每个回测的唯一标识
TRADE_PLOT(ID = "回测ID")
初始化后将获得 trade_data 属性 , 是回测的所有交易记录详情
(2) 设置需要查看的标的(标的必须存在于交易列表中)
set_security('601866.XSHG' ,fq_date="last_day" ,forward_day=20 )
(3) 绘图
overlap = trade_plot.plot_base_bar() #绘制K线图
overlap
后续您也也可以自己添加副图或者主图指标到K线图中去 , 同时上传了py文件 plot_k.py , 可以直接上传到研究中 ,使用时 from plot_k import * 就可以直接调用了
注意: 如果绘图出现空白 , ctrl+shift+p 搜索 "信任notebook" ,点击信任 , 多刷新几次页面¶
还有问题的话可以重新建立一个notebook执行上述步骤¶
import pandas as pd
from jqdata import *
import talib
from pyecharts import *
class TRADE_PLOT(object):
def __init__(self,ID,security = None):
online('https://cdn.bootcss.com/echarts/4.1.0.rc2') #可能因为网络/pyecharts问题加载不出图像 , 网页没有加载的话可能需要多刷新几次
self.ID = ID #回测ID
self.security = security #绘制K图的标的选择
self.trade_data = self.get_trade_info(self.ID,self.security) #交易详情
self.price_data = None
def get_trade_info(self,ID,security):
'''获取交易数据'''
data = pd.DataFrame(get_backtest(ID).get_orders())
data['trade_date'] = pd.to_datetime(data.time).apply(lambda x : pd.to_datetime(x).date())
return data
def set_security(self , security,forward_day=20,fq_date="last_day"):
""" 设置需要查看的标的
security = None , #需要查看的标的代码
forward_day = 20 , #K线图第一次交易及最后一次交易前后回溯的交易日个数(剔除停牌)
fq_date="last_day #复权基准日, 默认K线的结束日期 ,其他可选参数详见API , get_bars"""
self.security = security
self.trade_data_security = self.trade_data[self.trade_data.security==security]
if len(self.trade_data_security) ==0:
print ('交易记录中没有该标的'.format(self.security))
self.price_data = self.get_price_data(self.security,self.trade_data_security,forward_day,fq_date)
def get_price_data(self,security,trade_data,forward_day,fq_date):
'''获取价格数据'''
# start_date= get_trade_days(end_date = trade_data.trade_date.iloc[0],count=forward_day)[0]
last_date = trade_data.trade_date.iloc[-1] + datetime.timedelta(days = (forward_day*2 + 1))
_after_days = get_trade_days(start_date=trade_data.trade_date.iloc[-1], end_date=last_date)
end_date = _after_days[:forward_day][-1]
day_range = get_trade_days( trade_data.trade_date.iloc[0] ,end_date)
count = len(day_range)+forward_day
if fq_date == 'last_day':
fq_date = end_date
p_df = pd.DataFrame(get_bars(security,end_dt=end_date,count=count,include_now=True,fq_ref_date=fq_date,
fields=['date','open', 'high', 'low', 'close','volume'])).set_index('date')
# get_price(security,end_date =end_date ,start_date= start_date ,fq=fq )
return p_df
def plot_base_bar(self):
'''K线买卖点图'''
security = self.security
trade_data_security = self.trade_data_security
price_data = self.price_data
kline = Kline(get_security_info(security).display_name,)
kline.add(security,price_data.index , price_data.loc[:,['open','close','low','high']].values,
is_datazoom_show=True,datazoom_range=[0,len(price_data)*2], datazoom_type= "both")
kline._option['series'][0]['itemStyle']={'normal':{'color':'#ef232a', 'color0': '#14b143','borderColor': '#ef232a', 'borderColor0': '#14b143'}}
es = EffectScatter("trade")
buy_data = trade_data_security[trade_data_security.action== 'open']
#symbol: 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
es.add('buy',buy_data.trade_date , buy_data.price,symbol='triangle')#symbol_size=20,is_label_show=True)
buy_data = trade_data_security[trade_data_security.action== 'close']
es.add('sell',buy_data.trade_date , buy_data.price,symbol='diamond')#,is_label_show=True)
es._option['series'][0]['itemStyle']={'normal':{'color':['#1d18ad']}}#, 'color0': '#140012'}}
es._option['series'][1]['itemStyle']={'normal':{'color':['#140012']}}
bar = Bar()
bar.add("volume", price_data.index, price_data["volume"].values,is_datazoom_show=True,
tooltip_tragger="axis", is_legend_show=True, is_yaxis_show=False, yaxis_max=10*(price_data["volume"].max()))
es2 = EffectScatter("除权标识")
factor = get_price(security,start_date=price_data.index[0],end_date=price_data.index[-1],
fields='factor',fq='post').factor.drop_duplicates(keep='first')[1:]
factor.index = factor.index.date
# print (factor)
es2.add('除权标识',factor.index , factor.values ,is_datazoom_show=True,
tooltip_tragger="axis", is_legend_show=True, is_yaxis_show=True, yaxis_max=factor.max()*10)
overlap = Overlap(height=400,width=990)
overlap.add(kline) #K线主图
overlap.add(es2,yaxis_index=1, is_add_yaxis=True) #除权标记
overlap.add(es) # 买卖点信息
overlap.add(bar,yaxis_index=2, is_add_yaxis=True) #成交量图
return overlap
def plot_m_k(self,end_date,count,unit='5m',fq_ref_date=None):
'''绘制分钟/bar线图'''
security = self.security
price_data = pd.DataFrame(get_bars(security,end_dt=end_date,unit=unit,fq_ref_date=fq_ref_date,count=count,
fields=['date','open','close','low','high','volume'],include_now=True)).set_index('date')
kline = Kline(get_security_info(security).display_name+' {}线'.format(unit))
kline.add(security,price_data.index , price_data.loc[:,['open','close','low','high']].values,
is_datazoom_show=True,datazoom_range=[0,len(price_data)], datazoom_type= "both")
kline._option['series'][0]['itemStyle']={'normal':{'color':'#ef232a', 'color0': '#14b143','borderColor': '#ef232a', 'borderColor0': '#14b143'}}
overlap = Overlap(height=400,width=990)
bar = Bar()
bar.add("volume", price_data.index, price_data["volume"].values,is_datazoom_show=True,
tooltip_tragger="axis", is_legend_show=True, is_yaxis_show=False, yaxis_max=10*max(price_data["volume"]))
overlap.add(kline)
overlap.add(bar,yaxis_index=1, is_add_yaxis=True)
return overlap
初始化, 获取回测信息¶
回测ID(backtestId):每个回测的唯一标识
初始化后将获得 trade_data 属性 , 是回测的所有交易记录详情
trade_plot = TRADE_PLOT(ID = "d3f8331cc9591c2d8d85cf2aaa348a23") #回测ID , backtestID
trade_plot.trade_data #全部交易详情
# trade_plot.trade_data.groupby("security")['security'].count().sort_values(ascending=False) #查看各个标的的交易次数
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
action | amount | commission | filled | gains | limit_price | match_time | price | security | security_name | side | status | time | type | trade_date | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | open | 8300 | 13.32 | 8300 | 0.0 | 0 | 2016-06-01 09:30:00 | 5.35 | 600350.XSHG | 山东高速 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
1 | open | 8500 | 13.39 | 8500 | 0.0 | 0 | 2016-06-01 09:30:00 | 5.25 | 600018.XSHG | 上港集团 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
2 | open | 6500 | 13.28 | 6500 | 0.0 | 0 | 2016-06-01 09:30:00 | 6.81 | 601158.XSHG | 重庆水务 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
3 | open | 6900 | 13.31 | 6900 | 0.0 | 0 | 2016-06-01 09:30:00 | 6.43 | 601699.XSHG | 潞安环能 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
4 | open | 7000 | 13.40 | 7000 | 0.0 | 0 | 2016-06-01 09:30:00 | 6.38 | 000540.XSHE | 中天城投 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
5 | open | 3500 | 13.11 | 3500 | 0.0 | 0 | 2016-06-01 09:30:00 | 12.49 | 000686.XSHE | 东北证券 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
6 | open | 600 | 11.76 | 600 | 0.0 | 0 | 2016-06-01 09:30:00 | 65.32 | 000963.XSHE | 华东医药 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
7 | open | 2000 | 12.85 | 2000 | 0.0 | 0 | 2016-06-01 09:30:00 | 21.41 | 000895.XSHE | 双汇发展 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
8 | open | 4900 | 13.42 | 4900 | 0.0 | 0 | 2016-06-01 09:30:00 | 9.13 | 600016.XSHG | 民生银行 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
9 | open | 8400 | 13.36 | 8400 | 0.0 | 0 | 2016-06-01 09:30:00 | 5.30 | 000937.XSHE | 冀中能源 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
10 | open | 2100 | 13.06 | 2100 | 0.0 | 0 | 2016-06-01 09:30:00 | 20.73 | 600703.XSHG | 三安光电 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
11 | open | 1800 | 13.08 | 1800 | 0.0 | 0 | 2016-06-01 09:30:00 | 24.23 | 601238.XSHG | 广汽集团 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
12 | open | 5000 | 13.40 | 5000 | 0.0 | 0 | 2016-06-01 09:30:00 | 8.93 | 600717.XSHG | 天津港 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
13 | open | 2400 | 12.98 | 2400 | 0.0 | 0 | 2016-06-01 09:30:00 | 18.03 | 601009.XSHG | 南京银行 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
14 | open | 10400 | 13.45 | 10400 | 0.0 | 0 | 2016-06-01 09:30:00 | 4.31 | 601866.XSHG | 中海集运 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
15 | open | 9200 | 13.36 | 9200 | 0.0 | 0 | 2016-06-01 09:30:00 | 4.84 | 600028.XSHG | 中国石化 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
16 | open | 2800 | 13.20 | 2800 | 0.0 | 0 | 2016-06-01 09:30:00 | 15.72 | 002500.XSHE | 山西证券 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
17 | open | 10800 | 13.41 | 10800 | 0.0 | 0 | 2016-06-01 09:30:00 | 4.14 | 600157.XSHG | 永泰能源 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
18 | open | 3000 | 13.36 | 3000 | 0.0 | 0 | 2016-06-01 09:30:00 | 14.84 | 002142.XSHE | 宁波银行 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
19 | open | 5200 | 13.24 | 5200 | 0.0 | 0 | 2016-06-01 09:30:00 | 8.49 | 600089.XSHG | 特变电工 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
20 | open | 800 | 12.01 | 800 | 0.0 | 0 | 2016-06-01 09:30:00 | 50.06 | 002007.XSHE | 华兰生物 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
21 | open | 1300 | 12.76 | 1300 | 0.0 | 0 | 2016-06-01 09:30:00 | 32.73 | 601318.XSHG | 中国平安 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
22 | open | 5200 | 13.23 | 5200 | 0.0 | 0 | 2016-06-01 09:30:00 | 8.48 | 601992.XSHG | 金隅股份 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
23 | open | 1100 | 12.38 | 1100 | 0.0 | 0 | 2016-06-01 09:30:00 | 37.53 | 002252.XSHE | 上海莱士 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
24 | open | 1700 | 13.06 | 1700 | 0.0 | 0 | 2016-06-01 09:30:00 | 25.60 | 300024.XSHE | 机器人 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
25 | open | 2900 | 13.18 | 2900 | 0.0 | 0 | 2016-06-01 09:30:00 | 15.15 | 600111.XSHG | 北方稀土 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
26 | open | 1700 | 12.72 | 1700 | 0.0 | 0 | 2016-06-01 09:30:00 | 24.95 | 600867.XSHG | 通化东宝 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
27 | open | 3500 | 13.37 | 3500 | 0.0 | 0 | 2016-06-01 09:30:00 | 12.73 | 601555.XSHG | 东吴证券 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
28 | open | 5500 | 13.36 | 5500 | 0.0 | 0 | 2016-06-01 09:30:00 | 8.10 | 600369.XSHG | 西南证券 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
29 | open | 10200 | 13.37 | 10200 | 0.0 | 0 | 2016-06-01 09:30:00 | 4.37 | 600578.XSHG | 京能电力 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
946 | open | 400 | 5.00 | 400 | 0.0 | 0 | 2016-06-30 09:30:00 | 32.65 | 002230.XSHE | 科大讯飞 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
947 | open | 1200 | 5.00 | 1200 | 0.0 | 0 | 2016-06-30 09:30:00 | 11.92 | 600153.XSHG | 建发股份 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
948 | open | 1400 | 5.00 | 1400 | 0.0 | 0 | 2016-06-30 09:30:00 | 10.35 | 600021.XSHG | 上海电力 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
949 | open | 3400 | 5.00 | 3400 | 0.0 | 0 | 2016-06-30 09:30:00 | 4.33 | 600578.XSHG | 京能电力 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
950 | open | 6500 | 5.00 | 6500 | 0.0 | 0 | 2016-06-30 09:30:00 | 2.31 | 000725.XSHE | 京东方A | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
951 | open | 2100 | 5.00 | 2100 | 0.0 | 0 | 2016-06-30 09:30:00 | 6.95 | 600583.XSHG | 海油工程 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
952 | open | 1400 | 5.00 | 1400 | 0.0 | 0 | 2016-06-30 09:30:00 | 10.68 | 601800.XSHG | 中国交建 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
953 | open | 3800 | 5.00 | 3800 | 0.0 | 0 | 2016-06-30 09:30:00 | 3.90 | 601991.XSHG | 大唐发电 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
954 | open | 300 | 5.00 | 300 | 0.0 | 0 | 2016-06-30 09:30:00 | 40.67 | 601336.XSHG | 新华保险 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
955 | open | 200 | 5.00 | 200 | 0.0 | 0 | 2016-06-30 09:30:00 | 67.45 | 300017.XSHE | 网宿科技 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
956 | open | 800 | 5.00 | 800 | 0.0 | 0 | 2016-06-30 09:30:00 | 17.96 | 601607.XSHG | 上海医药 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
957 | open | 2300 | 5.00 | 2300 | 0.0 | 0 | 2016-06-30 09:30:00 | 6.47 | 601006.XSHG | 大秦铁路 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
958 | open | 1400 | 5.00 | 1400 | 0.0 | 0 | 2016-06-30 09:30:00 | 10.19 | 601186.XSHG | 中国铁建 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
959 | open | 800 | 5.00 | 800 | 0.0 | 0 | 2016-06-30 09:30:00 | 16.96 | 600816.XSHG | 安信信托 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
960 | open | 600 | 5.00 | 600 | 0.0 | 0 | 2016-06-30 09:30:00 | 24.07 | 600637.XSHG | 东方明珠 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
961 | open | 2700 | 5.00 | 2700 | 0.0 | 0 | 2016-06-30 09:30:00 | 5.51 | 601118.XSHG | 海南橡胶 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
962 | open | 2800 | 5.00 | 2800 | 0.0 | 0 | 2016-06-30 09:30:00 | 5.26 | 601106.XSHG | 中国一重 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
963 | open | 1600 | 5.00 | 1600 | 0.0 | 0 | 2016-06-30 09:30:00 | 9.34 | 600704.XSHG | 物产中大 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
964 | open | 1000 | 5.00 | 1000 | 0.0 | 0 | 2016-06-30 09:30:00 | 13.86 | 600959.XSHG | 江苏有线 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
965 | open | 2100 | 5.00 | 2100 | 0.0 | 0 | 2016-06-30 09:30:00 | 7.09 | 601390.XSHG | 中国中铁 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
966 | open | 800 | 5.00 | 800 | 0.0 | 0 | 2016-06-30 09:30:00 | 17.90 | 600485.XSHG | 信威集团 | long | done | 2016-06-30 09:30:00 | market | 2016-06-30 |
967 | close | 900 | 11.01 | 900 | -144.0 | 0 | 2016-06-30 14:35:00 | 6.68 | 002146.XSHE | 荣盛发展 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
968 | close | 400 | 10.70 | 400 | 12.0 | 0 | 2016-06-30 14:35:00 | 14.24 | 001979.XSHE | 招商蛇口 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
969 | close | 9700 | 410.58 | 9700 | 679.0 | 0 | 2016-06-30 14:35:00 | 32.56 | 000858.XSHE | 五粮液 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
970 | close | 700 | 10.78 | 700 | 28.0 | 0 | 2016-06-30 14:35:00 | 8.25 | 600674.XSHG | 川投能源 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
971 | close | 600 | 9.99 | 600 | -144.0 | 0 | 2016-06-30 14:35:00 | 8.31 | 000876.XSHE | 新希望 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
972 | close | 1000 | 10.86 | 1000 | 22.5 | 0 | 2016-06-30 14:35:00 | 5.86 | 600705.XSHG | 中航资本 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
973 | close | 300 | 10.10 | 300 | -195.0 | 0 | 2016-06-30 14:35:00 | 17.01 | 002450.XSHE | 康得新 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
974 | close | 1000 | 14.37 | 1000 | 20.0 | 0 | 2016-06-30 14:35:00 | 9.37 | 601009.XSHG | 南京银行 | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
975 | close | 1200 | 12.67 | 1200 | -48.0 | 0 | 2016-06-30 14:35:00 | 6.39 | 000069.XSHE | 华侨城A | long | done | 2016-06-30 14:35:00 | market | 2016-06-30 |
976 rows × 15 columns
设定股票后可以获取的属性 :
- 当前标的交易记录 trade_data_security ;
- 前证券的行情数据 price_data
set_security(self , security,p_f_day=20,fq_date="last_day")
- security = None : 需要查看的标的代码
- forward_day = 20 : K线图第一次交易及最后一次交易前后回溯的交易日个数(剔除停牌)
- fq_date="last_day" : 复权基准日
last_day : 以K线的结束日期为基准日 (和回测较为接近)
None : 不复权
具体日期 : 以某一天价格点位为参照物,进行的前复权或后复权。设置为datetime.datetime.now()即返回前复权数据 ; 更多关于动态复权解释)
""" 设置需要查看的标的
security = None , #需要查看的标的代码
p_f_day = 20 , #K线图第一次交易及最后一次交易前后回溯的交易日个数(剔除停牌)
fq_date="last_day #复权基准日, 默认K线的结束日期 ,其他可选参数详见API , get_bars"""
trade_plot.set_security('601866.XSHG' ,fq_date="last_day" ,forward_day=20 ) #设置需要查看的标的,复权基准日及K线回溯天数,None为不复权
# trade_plot.price_data #查看当前证券的行情数据
trade_plot.trade_data_security #当前证券交易记录
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
action | amount | commission | filled | gains | limit_price | match_time | price | security | security_name | side | status | time | type | trade_date | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14 | open | 10400 | 13.45 | 10400 | 0.0 | 0 | 2016-06-01 09:30:00 | 4.31 | 601866.XSHG | 中海集运 | long | done | 2016-06-01 09:30:00 | market | 2016-06-01 |
345 | close | 10400 | 55.43 | 10400 | -2184.0 | 0 | 2016-06-13 14:35:00 | 4.10 | 601866.XSHG | 中海集运 | long | done | 2016-06-13 14:35:00 | market | 2016-06-13 |
overlap = trade_plot.plot_base_bar() #绘制K线图
overlap
require.config({
paths: {
'echarts': 'https://cdn.bootcss.com/echarts/4.1.0.rc2/echarts.min'
}
});
require(['echarts'], function(echarts) {
var myChart_21948ca9ffe54c889d0ae39d6c9e9aaf = echarts.init(document.getElementById('21948ca9ffe54c889d0ae39d6c9e9aaf'), 'light', {renderer: 'canvas'});
function kline_tooltip_formatter(params) {
var text;
text = ((((((((((((params[0].seriesName + "<br/>") + "- open:") + params[0].data[1]) + "<br/>") + "- close:") + params[0].data[2]) + "<br/>") + "- lowest:") + params[0].data[3]) + "<br/>") + "- highest:") + params[0].data[4]);
return text;
}
var option_21948ca9ffe54c889d0ae39d6c9e9aaf = {
"title": [
{
"text": "\u4e2d\u8fdc\u6d77\u53d1",
"left": "auto",
"top": "auto",
"textStyle": {
"fontSize": 18
},
"subtextStyle": {
"fontSize": 12
}
}
],
"toolbox": {
"show": true,
"orient": "vertical",
"left": "95%",
"top": "center",
"feature": {
"saveAsImage": {
"show": true,
"title": "save as image"
},
"restore": {
"show": true,
"title": "restore"
},
"dataView": {
"show": true,
"title": "data view"
}
}
},
"series_id": 5384594,
"tooltip": {
"trigger": "axis",
"triggerOn": "mousemove|click",
"axisPointer": {
"type": "line"
},
"formatter": kline_tooltip_formatter,
"textStyle": {
"fontSize": 14
},
"backgroundColor": "rgba(50,50,50,0.7)",
"borderColor": "#333",
"borderWidth": 0
},
"series": [
{
"type": "candlestick",
"name": "601866.XSHG",
"data": [
[
4.37,
4.51,
4.37,
4.51
],
[
4.48,
4.55,
4.45,
4.62
],
[
4.54,
4.51,
4.47,
4.55
],
[
4.48,
4.34,
4.34,
4.52
],
[
4.32,
4.12,
4.07,
4.32
],
[
4.12,
4.53,
4.11,
4.53
],
[
4.5,
4.44,
4.36,
4.62
],
[
4.33,
4.3,
4.18,
4.39
],
[
4.26,
4.25,
4.21,
4.37
],
[
4.24,
4.29,
4.19,
4.37
],
[
4.28,
4.22,
4.22,
4.3
],
[
4.18,
4.09,
4.03,
4.19
],
[
4.1,
4.09,
4.07,
4.15
],
[
4.08,
4.15,
4.08,
4.27
],
[
4.17,
4.24,
4.13,
4.35
],
[
4.24,
4.16,
4.13,
4.24
],
[
4.2,
4.15,
4.12,
4.22
],
[
4.12,
4.16,
4.06,
4.17
],
[
4.13,
4.19,
4.12,
4.28
],
[
4.15,
4.18,
4.11,
4.24
],
[
4.18,
4.33,
4.18,
4.4
],
[
4.3,
4.32,
4.29,
4.44
],
[
4.31,
4.33,
4.28,
4.35
],
[
4.33,
4.33,
4.29,
4.38
],
[
4.33,
4.3,
4.28,
4.36
],
[
4.31,
4.26,
4.23,
4.32
],
[
4.25,
4.27,
4.21,
4.39
],
[
4.18,
4.05,
4.04,
4.2
],
[
4.05,
4.07,
4.04,
4.14
],
[
4.02,
4.12,
4.01,
4.15
],
[
4.11,
4.08,
4.07,
4.17
],
[
4.08,
4.09,
4.07,
4.15
],
[
4.08,
4.06,
4.02,
4.11
],
[
4.08,
4.02,
4.0,
4.09
],
[
4.01,
4.03,
3.98,
4.03
],
[
4.01,
3.98,
3.96,
4.02
],
[
3.96,
3.89,
3.8,
3.99
],
[
3.88,
3.94,
3.87,
3.94
],
[
3.91,
3.94,
3.9,
4.01
],
[
3.95,
3.99,
3.94,
4.06
],
[
4.0,
3.96,
3.95,
4.0
],
[
3.98,
3.97,
3.95,
4.01
],
[
3.98,
4.04,
3.95,
4.06
],
[
4.27,
4.17,
4.14,
4.44
],
[
4.09,
4.12,
4.07,
4.14
],
[
4.11,
4.15,
4.08,
4.26
]
],
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 5384594,
"itemStyle": {
"normal": {
"color": "#ef232a",
"color0": "#14b143",
"borderColor": "#ef232a",
"borderColor0": "#14b143"
}
}
},
{
"type": "effectScatter",
"name": "\u9664\u6743\u6807\u8bc6",
"showEffectOn": "render",
"rippleEffect": {
"brushType": "stroke",
"scale": 2.5,
"period": 4
},
"symbol": "circle",
"symbolSize": 10,
"data": [],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"seriesId": 5384594,
"xAxisIndex": 0,
"yAxisIndex": 1
},
{
"type": "effectScatter",
"name": "buy",
"showEffectOn": "render",
"rippleEffect": {
"brushType": "stroke",
"scale": 2.5,
"period": 4
},
"symbol": "triangle",
"symbolSize": 10,
"data": [
[
"2016-06-01",
4.31
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"seriesId": 5384594,
"itemStyle": {
"normal": {
"color": [
"#1d18ad"
]
}
},
"xAxisIndex": 0,
"yAxisIndex": 0
},
{
"type": "effectScatter",
"name": "sell",
"showEffectOn": "render",
"rippleEffect": {
"brushType": "stroke",
"scale": 2.5,
"period": 4
},
"symbol": "diamond",
"symbolSize": 10,
"data": [
[
"2016-06-13",
4.1
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"seriesId": 5384594,
"itemStyle": {
"normal": {
"color": [
"#140012"
]
}
},
"xAxisIndex": 0,
"yAxisIndex": 0
},
{
"type": "bar",
"name": "volume",
"data": [
32408207.0,
37804385.0,
23047567.0,
40750171.0,
36868027.0,
107768856.0,
99150772.0,
55042378.0,
37884805.0,
37597342.0,
29610866.0,
41230495.0,
25972929.0,
32142572.0,
46359104.0,
29588787.0,
18485331.0,
22624161.0,
34976069.0,
25198300.0,
67031730.0,
60090890.0,
34917977.0,
36064594.0,
25174086.0,
29284820.0,
55020370.0,
51900701.0,
31344079.0,
30845285.0,
27094080.0,
38268274.0,
34229155.0,
48409766.0,
42554531.0,
35517074.0,
50138488.0,
26935094.0,
49062865.0,
54301406.0,
27378108.0,
24856434.0,
55790406.0,
126709534.0,
50598213.0,
67992956.0
],
"barCategoryGap": "20%",
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 5384594,
"xAxisIndex": 0,
"yAxisIndex": 2
}
],
"legend": [
{
"data": [
"601866.XSHG",
"\u9664\u6743\u6807\u8bc6",
"buy",
"sell",
"volume"
],
"selectedMode": "multiple",
"show": true,
"left": "center",
"top": "top",
"orient": "horizontal",
"textStyle": {
"fontSize": 12
}
}
],
"animation": true,
"xAxis": [
{
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"type": "category",
"splitLine": {
"show": false
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
},
"data": [
"2016-05-03",
"2016-05-04",
"2016-05-05",
"2016-05-06",
"2016-05-09",
"2016-05-10",
"2016-05-11",
"2016-05-12",
"2016-05-13",
"2016-05-16",
"2016-05-17",
"2016-05-18",
"2016-05-19",
"2016-05-20",
"2016-05-23",
"2016-05-24",
"2016-05-25",
"2016-05-26",
"2016-05-27",
"2016-05-30",
"2016-05-31",
"2016-06-01",
"2016-06-02",
"2016-06-03",
"2016-06-06",
"2016-06-07",
"2016-06-08",
"2016-06-13",
"2016-06-14",
"2016-06-15",
"2016-06-16",
"2016-06-17",
"2016-06-20",
"2016-06-21",
"2016-06-22",
"2016-06-23",
"2016-06-24",
"2016-06-27",
"2016-06-28",
"2016-06-29",
"2016-06-30",
"2016-07-01",
"2016-07-04",
"2016-07-05",
"2016-07-06",
"2016-07-07"
],
"scale": true
}
],
"yAxis": [
{
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"type": "value",
"splitLine": {
"show": true
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"formatter": "{value} ",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
},
"scale": true,
"splitArea": {
"show": true
}
},
{
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"max": NaN,
"type": "value",
"splitLine": {
"show": true
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"formatter": "{value} ",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
}
},
{
"show": false,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"max": 1267095340.0,
"type": "value",
"splitLine": {
"show": true
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"formatter": "{value} ",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
}
}
],
"color": [
"#c23531",
"#2f4554",
"#61a0a8",
"#d48265",
"#749f83",
"#ca8622",
"#bda29a",
"#6e7074",
"#546570",
"#c4ccd3",
"#f05b72",
"#ef5b9c",
"#f47920",
"#905a3d",
"#fab27b",
"#2a5caa",
"#444693",
"#726930",
"#b2d235",
"#6d8346",
"#ac6767",
"#1d953f",
"#6950a1",
"#918597",
"#f6f5ec"
],
"dataZoom": [
{
"show": true,
"type": "slider",
"start": 0,
"end": 92,
"orient": "horizontal"
},
{
"show": true,
"type": "inside",
"start": 0,
"end": 92,
"orient": "horizontal"
}
]
};
myChart_21948ca9ffe54c889d0ae39d6c9e9aaf.setOption(option_21948ca9ffe54c889d0ae39d6c9e9aaf);
});
示例 : K线添加MA线¶
trade_plot.plot_base_bar() 返回一个pyecharts 的 overlap , 大家也可以按照需求增加各种指标或副图上去 ,下边以最简单的ma为例
需要注意 xaxis_index 需要和K线使用的索引数据类型(datetime.date)保持一致,否则无法显示
def plot_ma(data,short,long):
ma_short= price_data.close.rolling(window=short).mean().round(2)
ma_long =price_data.close.rolling(window=long).mean().round(2)
line = Line()
line.add("ma{}".format(short),ma_short.index, ma_short.values)
line.add("ma{}".format(long),ma_long.index, ma_long.values)
return line
trade_plot.set_security('002385.XSHE',forward_day = 30,fq_date=None) #变更标的,检查 fq_date 参数及除权标记是否生效
overlap2 = trade_plot.plot_base_bar()
price_data = trade_plot.price_data
overlap2.add(plot_ma(price_data,5,10)) # 添加MA图
require.config({
paths: {
'echarts': 'https://cdn.bootcss.com/echarts/4.1.0.rc2/echarts.min'
}
});
require(['echarts'], function(echarts) {
var myChart_962c362ca97a4c7680b1149c6dba2350 = echarts.init(document.getElementById('962c362ca97a4c7680b1149c6dba2350'), 'light', {renderer: 'canvas'});
function kline_tooltip_formatter(params) {
var text;
text = ((((((((((((params[0].seriesName + "<br/>") + "- open:") + params[0].data[1]) + "<br/>") + "- close:") + params[0].data[2]) + "<br/>") + "- lowest:") + params[0].data[3]) + "<br/>") + "- highest:") + params[0].data[4]);
return text;
}
var option_962c362ca97a4c7680b1149c6dba2350 = {
"title": [
{
"text": "\u5927\u5317\u519c",
"left": "auto",
"top": "auto",
"textStyle": {
"fontSize": 18
},
"subtextStyle": {
"fontSize": 12
}
}
],
"toolbox": {
"show": true,
"orient": "vertical",
"left": "95%",
"top": "center",
"feature": {
"saveAsImage": {
"show": true,
"title": "save as image"
},
"restore": {
"show": true,
"title": "restore"
},
"dataView": {
"show": true,
"title": "data view"
}
}
},
"series_id": 630566,
"tooltip": {
"trigger": "axis",
"triggerOn": "mousemove|click",
"axisPointer": {
"type": "line"
},
"formatter": kline_tooltip_formatter,
"textStyle": {
"fontSize": 14
},
"backgroundColor": "rgba(50,50,50,0.7)",
"borderColor": "#333",
"borderWidth": 0
},
"series": [
{
"type": "candlestick",
"name": "002385.XSHE",
"data": [
[
11.19,
11.24,
11.01,
11.29
],
[
11.32,
10.8,
10.56,
11.32
],
[
10.78,
10.72,
10.7,
11.01
],
[
10.73,
10.74,
10.65,
10.9
],
[
10.8,
10.96,
10.78,
11.1
],
[
10.97,
11.0,
10.88,
11.06
],
[
11.04,
10.81,
10.8,
11.04
],
[
10.8,
10.53,
10.3,
10.87
],
[
10.42,
10.43,
10.36,
10.58
],
[
10.44,
10.98,
10.4,
11.01
],
[
10.93,
11.19,
10.9,
11.56
],
[
11.22,
11.44,
11.2,
11.48
],
[
11.65,
11.17,
11.13,
11.68
],
[
11.11,
11.35,
10.8,
11.38
],
[
11.25,
11.63,
11.06,
11.68
],
[
7.8,
8.26,
7.77,
8.46
],
[
8.02,
8.32,
7.93,
8.39
],
[
8.22,
8.14,
8.1,
8.45
],
[
8.15,
8.79,
8.15,
8.87
],
[
8.77,
8.67,
8.6,
8.85
],
[
8.62,
8.47,
8.25,
8.64
],
[
8.3,
8.31,
8.28,
8.56
],
[
8.31,
8.38,
8.18,
8.52
],
[
8.39,
8.4,
8.29,
8.45
],
[
8.39,
8.15,
8.08,
8.39
],
[
8.2,
8.13,
8.07,
8.23
],
[
8.11,
8.19,
7.98,
8.2
],
[
8.16,
8.28,
8.05,
8.35
],
[
8.25,
8.09,
8.06,
8.25
],
[
8.12,
8.29,
8.09,
8.33
],
[
8.36,
8.29,
8.25,
8.49
],
[
8.32,
8.27,
8.18,
8.36
],
[
8.28,
8.21,
8.05,
8.29
],
[
8.13,
8.17,
8.05,
8.18
],
[
8.2,
8.08,
8.05,
8.2
],
[
8.07,
8.07,
8.04,
8.16
],
[
8.05,
7.72,
7.72,
8.05
],
[
7.68,
7.73,
7.62,
7.77
],
[
7.62,
8.05,
7.57,
8.1
],
[
8.02,
8.0,
7.94,
8.12
],
[
8.0,
8.14,
7.98,
8.25
],
[
8.15,
8.17,
8.12,
8.25
],
[
8.17,
8.1,
8.07,
8.32
],
[
8.13,
8.13,
8.03,
8.14
],
[
8.1,
7.93,
7.9,
8.1
],
[
7.93,
7.84,
7.65,
8.05
],
[
7.79,
7.91,
7.61,
7.98
],
[
7.84,
7.91,
7.79,
7.96
],
[
7.92,
7.96,
7.91,
8.1
],
[
7.93,
8.06,
7.93,
8.1
],
[
8.11,
8.02,
8.01,
8.14
],
[
7.99,
8.28,
7.97,
8.3
],
[
8.28,
8.2,
8.15,
8.32
],
[
8.2,
8.27,
8.16,
8.32
],
[
8.26,
8.46,
8.21,
8.54
],
[
8.36,
8.27,
8.25,
8.41
],
[
8.27,
8.19,
8.18,
8.36
],
[
8.19,
8.15,
8.1,
8.25
],
[
8.18,
8.23,
8.14,
8.25
],
[
8.39,
8.4,
8.33,
8.53
],
[
8.35,
8.38,
8.3,
8.48
],
[
8.38,
8.44,
8.33,
8.6
],
[
8.45,
8.54,
8.4,
8.64
],
[
8.54,
8.44,
8.41,
8.59
],
[
8.46,
8.38,
8.35,
8.47
],
[
8.35,
8.28,
8.25,
8.4
],
[
8.27,
8.22,
8.16,
8.3
],
[
8.23,
8.27,
8.2,
8.29
],
[
8.25,
7.87,
7.77,
8.29
],
[
7.9,
7.98,
7.85,
8.03
],
[
8.0,
7.91,
7.88,
8.05
],
[
7.91,
7.76,
7.7,
7.95
],
[
7.78,
7.78,
7.76,
7.86
],
[
7.79,
7.9,
7.78,
7.99
],
[
7.96,
7.91,
7.85,
7.97
]
],
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 630566,
"itemStyle": {
"normal": {
"color": "#ef232a",
"color0": "#14b143",
"borderColor": "#ef232a",
"borderColor0": "#14b143"
}
}
},
{
"type": "effectScatter",
"name": "\u9664\u6743\u6807\u8bc6",
"showEffectOn": "render",
"rippleEffect": {
"brushType": "stroke",
"scale": 2.5,
"period": 4
},
"symbol": "circle",
"symbolSize": 10,
"data": [
[
"2016-05-11",
9.43
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"seriesId": 630566,
"xAxisIndex": 0,
"yAxisIndex": 1
},
{
"type": "effectScatter",
"name": "buy",
"showEffectOn": "render",
"rippleEffect": {
"brushType": "stroke",
"scale": 2.5,
"period": 4
},
"symbol": "triangle",
"symbolSize": 10,
"data": [
[
"2016-06-02",
8.33
],
[
"2016-06-06",
8.14
],
[
"2016-06-22",
8.14
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"seriesId": 630566,
"itemStyle": {
"normal": {
"color": [
"#1d18ad"
]
}
},
"xAxisIndex": 0,
"yAxisIndex": 0
},
{
"type": "effectScatter",
"name": "sell",
"showEffectOn": "render",
"rippleEffect": {
"brushType": "stroke",
"scale": 2.5,
"period": 4
},
"symbol": "diamond",
"symbolSize": 10,
"data": [
[
"2016-06-03",
8.19
],
[
"2016-06-08",
8.08
],
[
"2016-06-27",
7.91
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"seriesId": 630566,
"itemStyle": {
"normal": {
"color": [
"#140012"
]
}
},
"xAxisIndex": 0,
"yAxisIndex": 0
},
{
"type": "bar",
"name": "volume",
"data": [
16640528.0,
25292025.0,
13415442.0,
12379285.0,
22996246.0,
16903650.0,
14476970.0,
19046870.0,
12195551.0,
24005945.0,
32674096.0,
29999690.0,
22872906.0,
29032503.0,
37007317.0,
112801256.0,
61870223.0,
41085321.0,
76630059.0,
46212650.0,
30658347.0,
26432412.0,
20836464.0,
20004381.0,
27950880.0,
15071927.0,
17613273.0,
19427854.0,
18475336.0,
34887722.0,
30518367.0,
22165659.0,
32929373.0,
26189911.0,
21463386.0,
21999787.0,
29642894.0,
18072768.0,
33943785.0,
22650514.0,
25283820.0,
16937366.0,
23235583.0,
11686800.0,
16364142.0,
19664781.0,
23801973.0,
14177493.0,
17724379.0,
13212317.0,
9840445.0,
30461989.0,
17871491.0,
21455803.0,
40836794.0,
22464305.0,
21131500.0,
22672688.0,
16673558.0,
38703827.0,
21311542.0,
20572295.0,
28203695.0,
15008198.0,
11945708.0,
12056747.0,
14111716.0,
9720007.0,
26910203.0,
15578101.0,
7641726.0,
13733841.0,
8408027.0,
10880379.0,
5679282.0
],
"barCategoryGap": "20%",
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 630566,
"xAxisIndex": 0,
"yAxisIndex": 2
},
{
"type": "line",
"name": "ma5",
"symbol": "emptyCircle",
"symbolSize": 4,
"smooth": false,
"step": false,
"showSymbol": true,
"data": [
[
"2016-04-19",
NaN
],
[
"2016-04-20",
NaN
],
[
"2016-04-21",
NaN
],
[
"2016-04-22",
NaN
],
[
"2016-04-25",
10.89
],
[
"2016-04-26",
10.84
],
[
"2016-04-27",
10.85
],
[
"2016-04-28",
10.81
],
[
"2016-04-29",
10.75
],
[
"2016-05-03",
10.75
],
[
"2016-05-04",
10.79
],
[
"2016-05-05",
10.91
],
[
"2016-05-06",
11.04
],
[
"2016-05-09",
11.23
],
[
"2016-05-10",
11.36
],
[
"2016-05-11",
10.77
],
[
"2016-05-12",
10.15
],
[
"2016-05-13",
9.54
],
[
"2016-05-16",
9.03
],
[
"2016-05-17",
8.44
],
[
"2016-05-18",
8.48
],
[
"2016-05-19",
8.48
],
[
"2016-05-20",
8.52
],
[
"2016-05-23",
8.45
],
[
"2016-05-24",
8.34
],
[
"2016-05-25",
8.27
],
[
"2016-05-26",
8.25
],
[
"2016-05-27",
8.23
],
[
"2016-05-30",
8.17
],
[
"2016-05-31",
8.2
],
[
"2016-06-01",
8.23
],
[
"2016-06-02",
8.24
],
[
"2016-06-03",
8.23
],
[
"2016-06-06",
8.25
],
[
"2016-06-07",
8.2
],
[
"2016-06-08",
8.16
],
[
"2016-06-13",
8.05
],
[
"2016-06-14",
7.95
],
[
"2016-06-15",
7.93
],
[
"2016-06-16",
7.91
],
[
"2016-06-17",
7.93
],
[
"2016-06-20",
8.02
],
[
"2016-06-21",
8.09
],
[
"2016-06-22",
8.11
],
[
"2016-06-23",
8.09
],
[
"2016-06-24",
8.03
],
[
"2016-06-27",
7.98
],
[
"2016-06-28",
7.94
],
[
"2016-06-29",
7.91
],
[
"2016-06-30",
7.94
],
[
"2016-07-01",
7.97
],
[
"2016-07-04",
8.05
],
[
"2016-07-05",
8.1
],
[
"2016-07-06",
8.17
],
[
"2016-07-07",
8.25
],
[
"2016-07-08",
8.3
],
[
"2016-07-11",
8.28
],
[
"2016-07-12",
8.27
],
[
"2016-07-13",
8.26
],
[
"2016-07-14",
8.25
],
[
"2016-07-15",
8.27
],
[
"2016-07-18",
8.32
],
[
"2016-07-19",
8.4
],
[
"2016-07-20",
8.44
],
[
"2016-07-21",
8.44
],
[
"2016-07-22",
8.42
],
[
"2016-07-25",
8.37
],
[
"2016-07-26",
8.32
],
[
"2016-07-27",
8.2
],
[
"2016-07-28",
8.12
],
[
"2016-07-29",
8.05
],
[
"2016-08-01",
7.96
],
[
"2016-08-02",
7.86
],
[
"2016-08-03",
7.87
],
[
"2016-08-04",
7.85
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"lineStyle": {
"normal": {
"width": 1,
"opacity": 1,
"curveness": 0,
"type": "solid"
}
},
"areaStyle": {
"opacity": 0
},
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 630566,
"xAxisIndex": 0,
"yAxisIndex": 0
},
{
"type": "line",
"name": "ma10",
"symbol": "emptyCircle",
"symbolSize": 4,
"smooth": false,
"step": false,
"showSymbol": true,
"data": [
[
"2016-04-19",
NaN
],
[
"2016-04-20",
NaN
],
[
"2016-04-21",
NaN
],
[
"2016-04-22",
NaN
],
[
"2016-04-25",
NaN
],
[
"2016-04-26",
NaN
],
[
"2016-04-27",
NaN
],
[
"2016-04-28",
NaN
],
[
"2016-04-29",
NaN
],
[
"2016-05-03",
10.82
],
[
"2016-05-04",
10.82
],
[
"2016-05-05",
10.88
],
[
"2016-05-06",
10.93
],
[
"2016-05-09",
10.99
],
[
"2016-05-10",
11.05
],
[
"2016-05-11",
10.78
],
[
"2016-05-12",
10.53
],
[
"2016-05-13",
10.29
],
[
"2016-05-16",
10.13
],
[
"2016-05-17",
9.9
],
[
"2016-05-18",
9.62
],
[
"2016-05-19",
9.31
],
[
"2016-05-20",
9.03
],
[
"2016-05-23",
8.74
],
[
"2016-05-24",
8.39
],
[
"2016-05-25",
8.38
],
[
"2016-05-26",
8.36
],
[
"2016-05-27",
8.38
],
[
"2016-05-30",
8.31
],
[
"2016-05-31",
8.27
],
[
"2016-06-01",
8.25
],
[
"2016-06-02",
8.25
],
[
"2016-06-03",
8.23
],
[
"2016-06-06",
8.21
],
[
"2016-06-07",
8.2
],
[
"2016-06-08",
8.19
],
[
"2016-06-13",
8.15
],
[
"2016-06-14",
8.09
],
[
"2016-06-15",
8.09
],
[
"2016-06-16",
8.06
],
[
"2016-06-17",
8.04
],
[
"2016-06-20",
8.03
],
[
"2016-06-21",
8.02
],
[
"2016-06-22",
8.02
],
[
"2016-06-23",
8.0
],
[
"2016-06-24",
7.98
],
[
"2016-06-27",
8.0
],
[
"2016-06-28",
8.02
],
[
"2016-06-29",
8.01
],
[
"2016-06-30",
8.01
],
[
"2016-07-01",
8.0
],
[
"2016-07-04",
8.01
],
[
"2016-07-05",
8.02
],
[
"2016-07-06",
8.04
],
[
"2016-07-07",
8.09
],
[
"2016-07-08",
8.13
],
[
"2016-07-11",
8.16
],
[
"2016-07-12",
8.19
],
[
"2016-07-13",
8.21
],
[
"2016-07-14",
8.25
],
[
"2016-07-15",
8.28
],
[
"2016-07-18",
8.3
],
[
"2016-07-19",
8.33
],
[
"2016-07-20",
8.35
],
[
"2016-07-21",
8.34
],
[
"2016-07-22",
8.34
],
[
"2016-07-25",
8.35
],
[
"2016-07-26",
8.36
],
[
"2016-07-27",
8.32
],
[
"2016-07-28",
8.28
],
[
"2016-07-29",
8.23
],
[
"2016-08-01",
8.16
],
[
"2016-08-02",
8.09
],
[
"2016-08-03",
8.04
],
[
"2016-08-04",
7.99
]
],
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"fontSize": 12
}
},
"emphasis": {
"show": true,
"textStyle": {
"fontSize": 12
}
}
},
"lineStyle": {
"normal": {
"width": 1,
"opacity": 1,
"curveness": 0,
"type": "solid"
}
},
"areaStyle": {
"opacity": 0
},
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 630566,
"xAxisIndex": 0,
"yAxisIndex": 0
}
],
"legend": [
{
"data": [
"002385.XSHE",
"\u9664\u6743\u6807\u8bc6",
"buy",
"sell",
"volume",
"ma5",
"ma10"
],
"selectedMode": "multiple",
"show": true,
"left": "center",
"top": "top",
"orient": "horizontal",
"textStyle": {
"fontSize": 12
}
}
],
"animation": true,
"xAxis": [
{
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"type": "category",
"splitLine": {
"show": false
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
},
"data": [
"2016-04-19",
"2016-04-20",
"2016-04-21",
"2016-04-22",
"2016-04-25",
"2016-04-26",
"2016-04-27",
"2016-04-28",
"2016-04-29",
"2016-05-03",
"2016-05-04",
"2016-05-05",
"2016-05-06",
"2016-05-09",
"2016-05-10",
"2016-05-11",
"2016-05-12",
"2016-05-13",
"2016-05-16",
"2016-05-17",
"2016-05-18",
"2016-05-19",
"2016-05-20",
"2016-05-23",
"2016-05-24",
"2016-05-25",
"2016-05-26",
"2016-05-27",
"2016-05-30",
"2016-05-31",
"2016-06-01",
"2016-06-02",
"2016-06-03",
"2016-06-06",
"2016-06-07",
"2016-06-08",
"2016-06-13",
"2016-06-14",
"2016-06-15",
"2016-06-16",
"2016-06-17",
"2016-06-20",
"2016-06-21",
"2016-06-22",
"2016-06-23",
"2016-06-24",
"2016-06-27",
"2016-06-28",
"2016-06-29",
"2016-06-30",
"2016-07-01",
"2016-07-04",
"2016-07-05",
"2016-07-06",
"2016-07-07",
"2016-07-08",
"2016-07-11",
"2016-07-12",
"2016-07-13",
"2016-07-14",
"2016-07-15",
"2016-07-18",
"2016-07-19",
"2016-07-20",
"2016-07-21",
"2016-07-22",
"2016-07-25",
"2016-07-26",
"2016-07-27",
"2016-07-28",
"2016-07-29",
"2016-08-01",
"2016-08-02",
"2016-08-03",
"2016-08-04"
],
"scale": true
}
],
"yAxis": [
{
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"type": "value",
"splitLine": {
"show": true
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"formatter": "{value} ",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
},
"scale": true,
"splitArea": {
"show": true
}
},
{
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"max": 94.3,
"type": "value",
"splitLine": {
"show": true
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"formatter": "{value} ",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
}
},
{
"show": false,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"boundaryGap": true,
"max": 1128012560.0,
"type": "value",
"splitLine": {
"show": true
},
"axisLine": {
"lineStyle": {
"width": 1
}
},
"axisLabel": {
"interval": "auto",
"formatter": "{value} ",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12
}
}
}
],
"color": [
"#c23531",
"#2f4554",
"#61a0a8",
"#d48265",
"#749f83",
"#ca8622",
"#bda29a",
"#6e7074",
"#546570",
"#c4ccd3",
"#f05b72",
"#ef5b9c",
"#f47920",
"#905a3d",
"#fab27b",
"#2a5caa",
"#444693",
"#726930",
"#b2d235",
"#6d8346",
"#ac6767",
"#1d953f",
"#6950a1",
"#918597",
"#f6f5ec"
],
"dataZoom": [
{
"show": true,
"type": "slider",
"start": 0,
"end": 150,
"orient": "horizontal"
},
{
"show": true,
"type": "inside",
"start": 0,
"end": 150,
"orient": "horizontal"
}
]
};
myChart_962c362ca97a4c7680b1149c6dba2350.setOption(option_962c362ca97a4c7680b1149c6dba2350);
});