我想引用图里的最高价2125,最低价2102,怎样才能实现?在Python语言里![图片]
(https://quant.pobo.net.cn/fsimg//1571979748080)
可以参考
https://github.com/qmhedging/poboquant/blob/master/problems/%E6%B3%A2%E6%AE%B5%E9%AB%98%E4%BD%8E%E7%82%B9RangeHighandLow
或者看附带的策略
参考 取K线数据 https://quant.pobo.net.cn/doc?name=api#%E8%8E%B7%E5%8F%96%E5%8E%86%E5%8F%B2%E8%A1%8C%E6%83%85%E6%95%B0%E6%8D%AE%E2%80%94gethisdata
K线数据的字段 https://quant.pobo.net.cn/doc?name=api#k%E7%BA%BF%E2%80%94kline
存到数组里,然后取列表的最高值和最低值即可。
https://github.com/qmhedging/poboquant/blob/master/problems/%E6%B3%A2%E6%AE%B5%E9%AB%98%E4%BD%8E%E7%82%B9RangeHighandLow
或者看附带的策略
参考 取K线数据 https://quant.pobo.net.cn/doc?name=api#%E8%8E%B7%E5%8F%96%E5%8E%86%E5%8F%B2%E8%A1%8C%E6%83%85%E6%95%B0%E6%8D%AE%E2%80%94gethisdata
K线数据的字段 https://quant.pobo.net.cn/doc?name=api#k%E7%BA%BF%E2%80%94kline
存到数组里,然后取列表的最高值和最低值即可。
if exchange != 'SHSE':
return
#获取主力合约
#g.code = GetMainContract('SHSE', 'rb',20)
g.code="510050.SHSE"
#订阅K线数据,用于驱动OnBar事件
SubscribeBar(g.code, BarType.Day)
klinedate = GetHisDataByField2(g.code,[ "high", "low"], bar_type=BarType.Day,count = 50)
#擦最近50根K线
rangehigh=max(klinedate[0])#取区间高点
rangelow=min(klinedate[1])#取区间低点
print("区间高点 "+str(rangehigh)+" 区间低点 "+str(rangelow))