Hey everyone,
So basically I have a day trading strategy which uses the coarse fundamental universe model to add all the stocks within a certain price range. Because the coarse universe is triggered at midnight, I wait until around 7am to then take those coarse symbols and condense them into what I will use for the day (about 40 symbols), filtering based off of intraday characteristics that coarse doesn't provide. This article is kind of the jumping off point -
https://www.quantconnect.com/forum/discussion/8726/volume-of-the-day-for-universe-of-stocks/p1/comment-24454This means that I have second resolution data for around 2500 symbols being pumped into my algo from when data starts being streamed until 7 when I condense. After I condense I am removing the unused symbols from my universe, so after 7 when I start trading it's not a problem, it really just seems unnecessary to put that much stress on my algo when I don't even need the data (or even just in backtesting, it's taking forever).
So my question is this, is there a way to restrict timeslices from even being created within a given time, or can you restrict what data is being sent within a given time so my algo doesn't even see it. I created methods that use string slicing to turn self.Time into hours and minutes:
def Hour(self):
timeString = str(self.Time)
return int(timeString[11:13]
if self.Hour() >= 7 (loop is open after 7am)
So I have the ability to open and close loops when I would like, I just don't know where the process needs to happen. I believe it is in the TimeSlice class but I couldn't figure the C# out so I thought I would ask professionals.
Thank you in advance
Derek Melchin
Hi Hayden,
To unsubscribe a security from the algorithm, we can use the `Remove` method. To remove a security intraday, we need to ensure we reduce the `MinimumTimeInUniverse`.
self.UniverseSettings.MinimumTimeInUniverse = timedelta(hours=1)
As the attached backtest shows, this technique currently works when the securities are added with `AddEquity` but not when selecting the securities with a coarse selection method. We've created a GitHub Issue to have this resolved. Subscribe to our progess here.
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.
Hayden Bonneau
Hey Derek, thanks for answering so quickly
After looking a littler further I realized that your right and I wasn't actually removing securities, I will be following the issue progress closely.
Also for my other question, is there a way to restrict when timeslices are being created or when data is being streamed into the algorithm? I thought it was probably in the timeslice class but I couldn't figure it out.
Thanks,
Hayden
Derek Melchin
Hi Hayden,
After closer inspection, we've closed the GitHub Issue above. The `Remove` method removes securities from a user defined universe (added with `AddEquity`). The only way to unsubscribe from a security that is added through coarse selection is to return a list from the coarse selection method that doesn't include the security.
There is no way to restrict when data slices are streamed to the algorithm. If an algorithm is subscribed to a security, it's data is passed to the OnData/Update methods.
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.
Hayden Bonneau
Hey Derek,
Alright thanks so much for your help, really appreciate it! I will do my best to make it work.
Thanks,
Hayden
Hayden Bonneau
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!