Back

How to setup ScheduledUniverseSelectionModel to be called at exact time?

Hi there,

I am using ScheduledUniverseSelectionModel - and trying to call it just before market open at 9:31 AM EST on weekdays. 

However, when I log self.Time from the callback method, it always shows 19:31:00+00:00 (which is 7:31 PM). 

Also, this universe gets populated for the previous day (not on the trading day).

This is how my initialization looks liks

self.SetUniverseSelection(ScheduledUniverseSelectionModel(
self.DateRules.Every([DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday]),
#self.TimeRules.AfterMarketOpen("SPY", 1),
self.TimeRules.At(9, 31),
self.GetSymbolsFromChartMill
))

self.Schedule.On(
self.DateRules.EveryDay("SPY"),
self.TimeRules.AfterMarketOpen("SPY", 5),
Action(self.LongShortStrategy)
)

And here are relevant logs to showcase the problem

  • Fetching data from ChartMill : 2017-01-03 19:31:00+00:00
  • Executing LongShortStrategy : 2017-01-04 09:35:00

(notice the 19:31 and difference in dates)

 

What am I doing wrong?

 

Thanks!

 

Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


All I am trying to do is get some symbols from ChartMill (a stock scanner service) just after the market opens & then trade them.

 

0

Mayank Jain have you set the correct timezone in algorithm?

self.SetTimeZone("Europe/London")
0

Thanks Meghdoot, will check and confirm.

Cheers!

0

Hi Mayank Jain 

We created a GitHub issue to address the issue since this is not the expected behavior.
When we set up the ScheduleUniverseSelection for 9:31 using the TimeRules.At, the universe selector method should be triggered at 14:31 UTC, not 19:31 UTC.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks Alexandre Catarino - looking forward to the fix.

Cheers!

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed