增加tick模式下,回测撮合时,对于涨跌停的过滤处理
This commit is contained in:
parent
8576b91c43
commit
d5e5cfc1c9
@ -322,8 +322,13 @@ class BacktestingEngine(object):
|
|||||||
# 遍历限价单字典中的所有限价单
|
# 遍历限价单字典中的所有限价单
|
||||||
for orderID, order in self.workingLimitOrderDict.items():
|
for orderID, order in self.workingLimitOrderDict.items():
|
||||||
# 判断是否会成交
|
# 判断是否会成交
|
||||||
buyCross = order.direction==DIRECTION_LONG and order.price>=buyCrossPrice
|
buyCross = (order.direction==DIRECTION_LONG and
|
||||||
sellCross = order.direction==DIRECTION_SHORT and order.price<=sellCrossPrice
|
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:
|
if buyCross or sellCross:
|
||||||
|
Loading…
Reference in New Issue
Block a user