VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 43
声望: 1

有几个不太理解的地方
第一个是
elif ((self.bar.datetime.minute != tick.datetime.minute) or (self.bar.datetime.hour != tick.datetime.hour)): #???
self.bar.datetime = self.bar.datetime.replace(second=0, microsecond=0)
self.on_bar(self.bar) #推送处理合成好的K线
new_minute = True
这里既然比较了分钟,为什么还要比较小时呢?这样做的意义在哪?

第二个问题是
self.bar.high_price = max(self.bar.high_price, tick.last_price)#???
if tick.high_price > self.last_tick.high_price:
self.bar.high_price = max(self.bar.high_price, tick.high_price)

self.bar.low_price = min(self.bar.low_price, tick.last_price)
if tick.low_price < self.last_tick.low_price:
self.bar.low_price = min(self.bar.low_price, tick.low_price)
为什么不直接max(self.bar.high_price, tick.high_price)呢

Member
avatar
加入于:
帖子: 1486
声望: 106
  1. 商品中午,从11:30跳到1:30

  2. 一个是直接取全天最高价,为当前K线最高价(肯定不对)。另一个是如果在当根K线内,全天最高价发生变化,则说明在两个tick的最新成交价变化之间,还出现了一个成交更高的价格(需要更新K线最高价)

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】