diff --git a/vnpy/trader/app/spreadTrading/stAlgo.py b/vnpy/trader/app/spreadTrading/stAlgo.py index aa9b4184..2a5444d3 100644 --- a/vnpy/trader/app/spreadTrading/stAlgo.py +++ b/vnpy/trader/app/spreadTrading/stAlgo.py @@ -259,9 +259,9 @@ class SniperAlgo(StAlgoTemplate): vtSymbol = order.vtSymbol # 从委托列表中移除该委托 - orderList = self.legOrderDict[vtSymbol] + orderList = self.legOrderDict.get(vtSymbol, None) - if vtOrderID in orderList: + if orderList and vtOrderID in orderList: orderList.remove(vtOrderID) # 检查若是被动腿,且已经没有未完成委托,则执行对冲