Hi Everybody,
I just published the newest part of my free algorithmic trading course:
In this video, you'll learn all about the algorithm framework including an example algorithm in which I implement an alpha model. You can check out the entire video series here:
Below you can find the backtest of the demonstration algorithm. You can copy the code from the video using the “Clone Algorithm” button.
Let me know if you have any questions or comments.
Cheers,
Louis
.ekz.
Another great video. Thanks Louis.
Question: Will you eventually be adding videos on building strategies w/Machine Learning models?
Louis
Once I finish covering all the general topics of QC and the API, I plan on focusing more on strategy videos where I simply find an interesting strategy, break it down, and implement it in QC. Here I would also want to implement more advanced strategies that use ML among other things.
.ekz.
Great to hear. Looking forward to it. Thanks again.
Calamity Jeff
Hi Louis.
Just to thank you for your tutorial's videos. I will listen to them all soonly.
Please, continue what you've done. Many thanks: i will try to understand all.
See you soon!
Artem Kolmykov
Hi Louis
Thanks for your great work with the tutorial and videos.
Please keep producing them.
I have a question may be it is not quite relevant to the video but still hope you or someone else provide some clue what is going on.
Please see attached backetest #1 from the cloned project
Artem Kolmykov
Here the second backtest produced with the same code.
As one can see statistics is different.
So does it impy we are facing some kind of stochastic (I,e undeterministic) behavior of backtester?
Varad Kabade
Hi Artem Kolmykov,
We tried reproducing the issue, but both backtest gave the exact same metrics. We recommend running both the algorithms again.
Could you please attach the orders of each backtest if the problem persists?
Best,
Varad Kabade
Artem Kolmykov
Hi Varad
Please see csv with orders by the link on google drive(I don't know if it possible to attach these to the post)
https://drive.google.com/drive/folders/1IPE1uHHETYiff8IDLWeePEorMfgnLa3h?usp=sharing
Also, please see the screenshot below. I just cloned Louse's algorithm and started backtests sequentially one by one.
Regards
Varad Kabade
Hi Artem Kolmykov,
After going through the orders file, we can see that the orders are the same, and orders executed simultaneously are present in a different order.
Best,
Varad Kabade
Richard Thomas Harrison
Louis I really appreciate the videos! I have a few questions regarding the algorithmic framework. At the beginning of the video you were describing how the alpha model outputs the insights which can be thought of as "trade recommendations" for the portfolio construction model. What attribute of the insight does the portfolio construction model use to decide whether or not to trade, the weight or the confidence? Does the user have to input some threshold for either the weight or confidence to go through with a trade?
Also say you have multiple insights for one security that gets passed to portfolio construction, what about the insight gets averaged, weight and/or confidence?
My last question is in regards to the details of the duration of an insight, say you have a duration of 1 day for an insight and the insight is created at 9:30 am, does that mean that at exactly 9:30 the next day, the insight will essentially go away and so the portfolio construction should recognize that it holds a security with no insight and so will send to the execution model to close the position? In your algo, what happens if a security makes it in the list to be longed two quarters in a row? Thanks in advance for any help,
Richard
Varad Kabade
Hi Richard Thomas Harrison,
PCM has the sole discretion on how to consume the insights generated by the alpha model. After the insight gets expired the PCM does not necessarily try to make the Holdings of the security zero. It depends on the PCM, the PCMs developed by QuantConnect in Lean assume that expired insights should lead to the closure of the positions.
Best,
Varad Kabade
Log Up
Thanks for the awesome video Louis , I had one question, when will be the trades generated by insights will be sold? Will they be sold at end of each quarter as we passed Expiry.EndOfQuarter while creating Insights? Does Insight expiry apply to the trade also?
Louis Szeto
Hi Log Up
In default settings, positions that opened with an active insight will be closed after the insight expired, although there could be rebalancing if other insights were emitted. Please refer to the docs.
Best
Louis
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.
Mitch Christow
Hi folks,
I was trying to refactor Louis' code into a standalone Universe selection class. Unfortunately the code does not execute any stock selections or purchases. I think the problem lies with the availability of the Time method within the universe selection class, but I am at a loss how to fix this. I was hoping that someone in this group would point me in the right direction on how to fix the code? I really appreciate the help.
Cheers,
Mitch
Louis Szeto
Hi Mitch
We don't have a Python version of FineFundamentalUniverseSelectionModel superclass, instead you should import FundamentalUniverseSelectionModel first and use that as the superclass as it is not imported by AlgorithmImports
It will be more efficient if you set the universe re-balancing time in the selection model by:
And you don't need to cast coarse/fine since the classes have PythonWrapper.
I've also helped you to fix a few minor bugs in the universe selection file, please refer to the attached backtest.
Best
Louis
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.
Ryan
Hi Louis
Thanks for the great videos, I am cloning this tutorial but get the below error on execution, something to do with not able to import the AlphaModel
Any help will be great, thank you.
Anirudh Lohia
Hi Louis,
Thank you for the great video series. Enjoying it and learning well.
I have a couple of questions
Thank you for these great videos.
Regards
Louis
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!