Hey Guys,
I'm new to QC and also coding in general. Right now I'm trying to create a dynamic universe that selects stocks based on pre market gaps (i.e. >10% gap). After this I want to daytrade these stocks based on amount of gap. I'm struggling with creating a dyn. Universe that select stocks based on pre market data. Also I'm struggling with daytrading all stocks if they fullfill the requirements in the OpeningBar function. In my backtests even with the for loops my algo just trades the last ticker in the self.ticker list.
I would appreciate someone that could help me with my issues a lot! I also read other entries here on QC but I was not able to figure it out. Often I see that the Dynamic Universe just selects stocks based on for example PE-Ratio and rebalances the collection after a given period. But I need a collection and then every stock in the collection is checked if they fulfill the if statements in the OpeningBar function.
Thank you very much in advance! Btw. I code in Python
Varad Kabade
Hi Maximilian Mühlenberg,
We cannot perform dynamic universe selection based on gap data because coarse-fine universe selection is performed at midnight(Before the gap can be calculated). However, the current feature is in the pipeline. Subscribe to the following issue to receive updates regarding the progress. A possible workaround is provided in the attached backtest. Here we perform dynamic universe selection but select the asset to trade on the Schedule events function to filter assets according to the gap(+1,-1%). The important thing to note here is that we are still subscribed to the securities selected during the universe selection. We have also made the following changes to the logic
to
Best,
Varad Kabade
Maximilian Mühlenberg
Hey Varad,
thank you so much for your help! I understood it way better. I just have a question about the addEquities function. I see that on every scheduled event you call it for “SPY”. So you take the SPY as a placeholder to initiate the schedue function right? This was one problem that I had because I thought I always have to insert the actual ticker in these function right from the start : )
Maximilian Mühlenberg
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!