I'm trying to implement my first algorithm, so please bear with me :)
I've been trying to use QCAlgorithmFramework for writing my first algorithm in python. I'd like to be able to re-select the universe periodically, and ScheduledUniverseSelectionModel seems to fit the bill. However, some of the details of the universe selection process don't seem well documented. Specifically, ScheduledUniverseSelectionModel takes a symbol selection function as its third argument. This algorithm takes only two arguments: self and the simulation datetime. You cannot get access to the whole data universe from which to select symbols. Can someone please explain why this design choice has been made?
In the Lean engine, ScheduledUniverseSelectionModel.CreateUniverses creates a ScheduledUniverse with the provided selector. The selector is called here:
https://github.com/QuantConnect/Lean/blob/master/Common/Data/UniverseSelection/ScheduledUniverse.cs#L81This selector is called without the data argument.
Is there an alternate mechanism for accessing the data object in a ScheduledUniverseSelectionModel? How else might one implement the equivalent of this algorithm using QCAlgorithmFramework?
https://www.quantconnect.com/tutorials/strategy-library/fundamental-factor-long-short-strategyThanks,
Sunil
Jack Simonson
Hi Sunil,
Right now, the easiest way to force a Universe refresh at a specific time is to implement datetime checks inside of the Fine/Coarse functions, but you could also create your own Universe Selection model to fine-tune the details of the exact selection criteria you want. We're working on adding functionality to the Scheduled Universe Selection, but for now, I've implemented the Fundamental Factor Long/Short Strategy in the old Framework Algorithm style with some minor changes. I've moved most of the filtering outside of the Universe Selection and instead do it inside the Alpha Model. Have a look at the backtesting code and the comments that I've added, and hopefully, this will help address some of your concerns.
Sunil Mishra
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!