Skip to content

Commit

Permalink
增加tick模式下,回测撮合时,对于涨跌停的过滤处理
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxy123 committed Apr 8, 2017
1 parent 8576b91 commit d5e5cfc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vn.trader/ctaStrategy/ctaBacktesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,13 @@ def crossLimitOrder(self):
# 遍历限价单字典中的所有限价单
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:
Expand Down

0 comments on commit d5e5cfc

Please sign in to comment.