I know its been discussed in previous years but has there been an update to allow a universe to scan in pre market? Any updated info on this would be great!
QUANTCONNECT COMMUNITY
I know its been discussed in previous years but has there been an update to allow a universe to scan in pre market? Any updated info on this would be great!
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.
Jared Broad
Hi Ben; sorry what do you mean by this?
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.
Ben Newsom
Thank you Jared,
I have been trying to find a universe that will allow me to scan the market for high volume and gap ups in pre-market, after some struggling I found this forum which suggested that there was no solution as of then, I was wondering if there was a universe that I could use now that would work.
Jared Broad
You can now. It's not easy though.
You would use normal coarse universe selection, combined with the Security Initializer to make all universe additions pass through pre-market data. You wouldn't be interested in any of the market-hours information but the universe selection is performed around 6 am so its in-time most day for your premarket scans.
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.
Ted Murphy
Thank you, much appreciated.
Brian We
Jared, has anything been updated on this? I am looking to create a universe of stocks gapping up. Would need to do a check sometime before market open, no more than an hour before open should be fine. Right now my Universe has around 3500 equities and with minutely premarket data that seems to be too much for the backtester to handle. So the idea would be to cut down the universe itself by running through premarket data to find the gaps.
Can you elaborate how passing through the Security Initializer could help? This might be exactly what I need. Thanks.
Derek Melchin
Hi Brian,
The security initializer is no longer responsible for subscribing to extended market hours. Instead, we do so with the UniverseSettings.
# in Initialize self.UniverseSettings.ExtendedMarketHours = True
See the attached backtest for reference.
To clarify, coarse universe selection is performed at 6-7AM only when live trading. To calculate the gap up, we first get the current pre-market price by using the Price property of the CoarseFundamental object passed to the universe selection function. For the price of yesterday's close, we would need to perform a History request.
During backtesting, coarse universe selection is performed at midnight. If an algorithm is using this model already, we can not chain universe selection models to reduce the universe size. See this related thread for more information.
Best,
Derek Melchin
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.
Tegster
I found another answer posted for AddEquity() method to get pre and aftermarket hours data by Rahul Chowdhury. I tried using the self.UniverseSettings.ExtendedMarketHours = True, hoping it will apply to manually added securities through AddEquity() or the whole universe of securities defined but that didn't work. As noted by Rahul named parameters are not supported and make sure to write the whole thing out. I've linked Rahul's comment below
https://www.quantconnect.com/forum/discussion/7043/accessing-pre-market-data/p1/comment-19943Shile Wen
Hi Tegster,
Could you attach a backtest or the code you have so far?
Best,
Shile Wen
Tegster
Hi Shile,
if your adding assets through the Universe Coarse, Fine filters, the below should give you the extended market data
self.SetStartDate(2020,7,13) #Set Start Date self.SetEndDate(2020,7,13) #Set End Date self.UniverseSettings.Resolution = Resolution.Minute self.UniverseSettings.ExtendedMarketHours = True # coarse and fine selection self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)
and if your adding assets using the AddEquity() method, , the below should give you the extended market data
self.SetStartDate(2020,7,13) #Set Start Date self.SetEndDate(2020,7,13) #Set End Date self.SetCash(100000) #Set Strategy Cash # AddEquity(ticker, resolution = Resolution.Minute, market = Market.USA, fillDataForward = true, leverage = 0m, extendedMarketHours = True) self.AddEquity("IBM", Resolution.Minute, Market.USA, True, 1, True)
Shile Wen
Hi Tegster,
Settings applied to the Universe doesn’t affect equities added through self.AddEquity because internally, the securities added through self.AddEquity are part of the “user defined Universe”, and is handled differently. Please see this thread for more information.
Best,
Shile Wen
Shner
Isnt there a way to run the universe just before Market open (ideally 2-10 mins b4) ?
so i can get a list of all the stocks that have has the biggest Pre Market Change (by %).
cause i need to compare yesterdays Closing price (16:00) to ideally Market Open (9:30), but even a few mins before is fine.
Cheers.
Varad Kabade
Hi Shner,
We can use the ScheduledUniverseSelection method just before the Market opens or any other custom time. But the selector method in the above method receives a DateTime object, not a coarse list, so we cannot iterate through all the securities as we do in the coarse filter; thus, we cannot use the ScheduledUniverseSelection method for the above task. Refer to the following doc for more information.
Best,
Varad Kabade
Ben Newsom
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!