You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewRegressionTestException($"Order {_stopOrderTicket.OrderId} with symbol {_stopOrderTicket.Symbol} should have been invalid due to insufficient margin after the update, but its current status is {_stopOrderTicket.Status}.");
90
-
}
90
+
// All updates have been enqueued and should be rejected one by one
91
+
if(orderEvent.OrderId==_stopOrderTicket.OrderId&&!orderEvent.Message.Contains("Brokerage failed to update order"))
92
+
{
93
+
thrownewRegressionTestException($"The stop order update should have been rejected due to insufficient margin");
94
+
}
91
95
92
-
// Check if limit order is invalid due to insufficient margin after update
93
-
if(_limitOrderTicket!=null&&orderEvent.Id==_limitOrderTicket.OrderId&&!orderEvent.Message.Contains("Brokerage failed to update order"))
94
-
{
95
-
thrownewRegressionTestException($"Order {_limitOrderTicket.OrderId} with symbol {_limitOrderTicket.Symbol} should have been invalid due to insufficient margin after the update, but its current status is {_limitOrderTicket.Status}.");
96
-
}
96
+
if(orderEvent.Id==_limitOrderTicket.OrderId&&!orderEvent.Message.Contains("Brokerage failed to update order"))
97
+
{
98
+
thrownewRegressionTestException($"The limit order update should have been rejected due to insufficient margin");
99
+
}
97
100
98
-
// Check if trailing stop order is invalid due to insufficient margin after update
99
-
if(_trailingStopOrderTicket!=null&&orderEvent.Id==_trailingStopOrderTicket.OrderId&&!orderEvent.Message.Contains("Brokerage failed to update order"))
100
-
{
101
-
thrownewRegressionTestException($"Order {_trailingStopOrderTicket.OrderId} with symbol {_trailingStopOrderTicket.Symbol} should have been invalid due to insufficient margin after the update, but its current status is {_trailingStopOrderTicket.Status}.");
101
+
if(orderEvent.Id==_trailingStopOrderTicket.OrderId&&!orderEvent.Message.Contains("Brokerage failed to update order"))
102
+
{
103
+
thrownewRegressionTestException($"The trailing stop order update should have been rejected due to insufficient margin");
104
+
}
102
105
}
103
106
}
104
107
105
108
publicoverridevoidOnEndOfAlgorithm()
106
109
{
110
+
// Updates were rejected, so all orders should be in Filled status
107
111
varorders=Transactions.GetOrders().ToList();
112
+
foreach(varorderinorders)
113
+
{
114
+
if(order.Status!=OrderStatus.Filled)
115
+
{
116
+
thrownewRegressionTestException($"Order {order.Id} with symbol {order.Symbol} should have been filled, but its current status is {order.Status}.");
117
+
}
118
+
}
108
119
}
109
120
110
121
/// <summary>
@@ -137,14 +148,14 @@ public override void OnEndOfAlgorithm()
0 commit comments