Skip to content

Commit 10789c2

Browse files
committed
feat: write comment why we use includeInternalConfigs in true
remove: extra log in PY version of algo
1 parent 7ffe331 commit 10789c2

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

Algorithm.CSharp/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public override void OnOrderEvent(OrderEvent orderEvent)
8585

8686
if (!time.IsOpen(orderEvent.UtcTime, _SP500EMini.IsExtendedMarketHours))
8787
{
88-
throw new Exception($"The Exchange hours was closed, checko 'extendedMarketHours' flag in {nameof(Initialize)} when added new security(ies).");
88+
throw new Exception($"The Exchange hours was closed, verify 'extendedMarketHours' flag in {nameof(Initialize)} when added new security(ies).");
8989
}
9090
}
9191
}

Algorithm.Python/FutureStopMarketOrderOnExtendedHoursRegressionAlgorithm.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ def OnData(self, slice):
4747
self.stopPrice = self.stopMarketTicket.Get(OrderField.StopPrice)
4848
self.bar = self.Securities[self.stopMarketTicket.Symbol].Cache.GetData()
4949

50-
if self.stopPrice > self.bar.Low:
51-
self.Log(f"{self.stopPrice} -> {self.bar.Low}")
52-
5350
# An order fill update the resulting information is passed to this method.
5451
def OnOrderEvent(self, orderEvent):
5552
if orderEvent is None:
@@ -64,7 +61,7 @@ def OnOrderEvent(self, orderEvent):
6461

6562
# Validate, Exchange is opened explicitly
6663
if (not exchangeHours.IsOpen(orderEvent.UtcTime, self.SP500EMini.IsExtendedMarketHours)):
67-
raise Exception("The Exchange hours was closed, checko 'extendedMarketHours' flag in Initialize() when added new security(ies)")
64+
raise Exception("The Exchange hours was closed, verify 'extendedMarketHours' flag in Initialize() when added new security(ies)")
6865

6966
def OnEndOfAlgorithm(self):
7067
self.stopMarketOrders = self.Transactions.GetOrders(lambda o: o.Type is OrderType.StopMarket)

Common/Orders/Fills/FutureFillModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public override OrderEvent StopMarketFill(Security asset, StopMarketOrder order)
107107
if (order.Status == OrderStatus.Canceled) return fill;
108108

109109
// Fill only if open or extended
110+
// even though data from internal configurations are not sent to the algorithm.OnData they still drive security cache and data
111+
// this is specially relevant for the continuous contract underlying mapped contracts which are internal configurations
110112
if (!IsExchangeOpen(asset, Parameters.ConfigProvider.GetSubscriptionDataConfigs(asset.Symbol, includeInternalConfigs: true).IsExtendedMarketHours()))
111113
{
112114
return fill;

0 commit comments

Comments
 (0)