增加tick模式下,回测撮合时,对于涨跌停的过滤处理

This commit is contained in:
chenxy123 2017-04-08 10:42:41 +08:00
parent 8576b91c43
commit d5e5cfc1c9

View File

@ -322,8 +322,13 @@ class BacktestingEngine(object):
# 遍历限价单字典中的所有限价单
for orderID, order in self.workingLimitOrderDict.items():
# 判断是否会成交
buyCross = order.direction==DIRECTION_LONG and order.price>=buyCrossPrice
sellCross = order.direction==DIRECTION_SHORT and order.price<=sellCrossPrice
buyCross = (order.direction==DIRECTION_LONG and
order.price>=buyCrossPrice and
buyCrossPrice > 0) # 国内的tick行情在涨停时askPrice1为0此时买无法成交
sellCross = (order.direction==DIRECTION_SHORT and
order.price<=sellCrossPrice and
sellCrossPrice > 0) # 国内的tick行情在跌停时bidPrice1为0此时卖无法成交
# 如果发生了成交
if buyCross or sellCross: