修复TargetPosTemplate的bug

This commit is contained in:
chenxy123 2017-03-07 22:34:21 +08:00
parent 70151b0f16
commit defec19912

View File

@ -219,7 +219,8 @@ class TargetPosTemplate(CtaTemplate):
"""收到行情推送"""
self.lastTick = tick
# 实盘模式下需要根据tick的实时推送执行自动开平仓操作
# 实盘模式下启动交易后需要根据tick的实时推送执行自动开平仓操作
if self.trading:
self.trade()
#----------------------------------------------------------------------
@ -246,6 +247,7 @@ class TargetPosTemplate(CtaTemplate):
# 先撤销之前的委托
for vtOrderID in self.orderList:
self.cancelOrder(vtOrderID)
self.orderList = []
# 如果目标仓位和实际仓位一致,则不进行任何操作
posChange = self.targetPos - self.pos