Hi,
I am getting started here on QC and have a general question regarding algorithm design pattern. So far, I try to write every one of my algo using the algorithm framework. Is it always a good idea to write a strategy in algo framework? I might be wrong but it seems like a algo-framework strategy has more overhead than a classic algorithm. What's the pros/cons between the two? I wanted to follow best practice whenever I can from the start so it would be great to hear some advice/suggestions from the community.
Thank you
Alexandre Catarino
Hi fishstoryyy ,
Thank you for your question.
We advise Alpha Authors to use the design they feel more comfortable with.
The main idea behind the Algorithm Framework is modularity that should lead to writing less code. Modularity brings a huge advantage: plug-and-play. We can test different modules (PCM, Risk, and Execution) for the given Universe+Alpha, and see which combination works best for our goals.
On the other hand, if we need to (re)write all modules (PCM, Risk, Execution) to serve a particular Alpha Model, resulting in more code than using the Classic design, it's a sign that we should probably not use the Framework. Or if we need to “hack” the Framework by passing additional information between modules, violating the separation of concerns principle, it's a sign that we should choose Classic instead.
Let me point out that, in some cases, we can leverage our Classic algorithm with Framework modules. For example, we can simply include these statements
to add a 10% trailing stop executed with a VWAP execution model.
Fishstoryyy
Thank you Alex! That's super helpful.
Vladimir
Thanks, Alex!
Tried it, very promising, but can't figure out how to apply this to
a portfolio of multiple instruments in the same simple way.
Can you help?
Vladimir
Hi Alex, don't worry, I've fixed it.
Thank you for your help.
Fishstoryyy
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!