Back

Pre Market Scanning

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!

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.


Hi Ben; sorry what do you mean by this?

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.


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. 

https://www.quantconnect.com/forum/discussion/1031/algorithm-for-scanning-premarket-stocks-unusual-volume-and-volatility
0

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.

1

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.


Thank you, much appreciated.

0

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.

0

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

1

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.


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-19943

 

0

Hi Tegster,

Could you attach a backtest or the code you have so far?

Best,
Shile Wen

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.


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)
0

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

1

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.


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