AfterMarketOpen scheduled events for futures seems to use stocks regular trading hours as reference. The scheduled event in the example below triggers at 09:20, instead of the expected 17:50. Why is that and any way to come around it without scheduling an event for 17:50 ?

  1. # Add futures
  2. tickers = [
  3. Futures.Indices.SP500EMini
  4. ]
  5. self.selected_symbols = []
  6. for ticker in tickers:
  7. future = self.AddFuture(
  8. ticker=ticker,
  9. resolution=self.resolution,
  10. dataMappingMode=DataMappingMode.OpenInterestAnnual, # Changes when any contracts of next year have a higher volume than the current
  11. dataNormalizationMode=DataNormalizationMode.BackwardsPanamaCanal, # New contract has true price
  12. contractDepthOffset=0, # Choose the front month
  13. )
  14. self.selected_symbols.append(future.Symbol)
  15. # Scheduled event to allow trades when market re-opens
  16. self.Schedule.On(
  17. self.DateRules.EveryDay(self.selected_symbols[0]),
  18. self.TimeRules.AfterMarketOpen(self.selected_symbols[0], -10),
  19. self.StartOfSession
  20. )
  21. '''
  22. Start of session scheduled event
  23. '''
  24. def StartOfSession(self):
  25. self.end_of_session = False
+ Expand

 

Author

Haakon

May 2023