Skip to content

Commit

Permalink
feat: write comment why we use includeInternalConfigs in true
Browse files Browse the repository at this point in the history
remove: extra log in PY version of algo
  • Loading branch information
Romazes committed Jan 11, 2024
1 parent 7ffe331 commit 10789c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override void OnOrderEvent(OrderEvent orderEvent)

if (!time.IsOpen(orderEvent.UtcTime, _SP500EMini.IsExtendedMarketHours))
{
throw new Exception($"The Exchange hours was closed, checko 'extendedMarketHours' flag in {nameof(Initialize)} when added new security(ies).");
throw new Exception($"The Exchange hours was closed, verify 'extendedMarketHours' flag in {nameof(Initialize)} when added new security(ies).");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def OnData(self, slice):
self.stopPrice = self.stopMarketTicket.Get(OrderField.StopPrice)
self.bar = self.Securities[self.stopMarketTicket.Symbol].Cache.GetData()

if self.stopPrice > self.bar.Low:
self.Log(f"{self.stopPrice} -> {self.bar.Low}")

# An order fill update the resulting information is passed to this method.
def OnOrderEvent(self, orderEvent):
if orderEvent is None:
Expand All @@ -64,7 +61,7 @@ def OnOrderEvent(self, orderEvent):

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

def OnEndOfAlgorithm(self):
self.stopMarketOrders = self.Transactions.GetOrders(lambda o: o.Type is OrderType.StopMarket)
Expand Down
2 changes: 2 additions & 0 deletions Common/Orders/Fills/FutureFillModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public override OrderEvent StopMarketFill(Security asset, StopMarketOrder order)
if (order.Status == OrderStatus.Canceled) return fill;

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

0 comments on commit 10789c2

Please sign in to comment.