Can anyone share a notebook with a correlation matrix of daily returns across multiple projects.
With output like this.
Project 1 Project 2 Project 3
Project 1 1
Project 2 0.815956893 1
Project 3 0.643165634 0.744233372 1
I had a lot of them in Quantopian, but I haven't gotten there in QuantConnect yet.
BTW how to import to “QC notebook cloud” existing ipynb file from my computer?
Louis Szeto
Hi Vladimir
We can retrieve the equity curve via project and backtest ID by using API in a research notebook. Please check on this thread. This can produce a pandas Series of equity curve based on data points charted on "strategy equity" for any backtest in any project. You can combine multiple series as dataframe and use .corr() / .cov() to obtain their correlation and covariance matrix.
If the number of data points is too large, this method might drain up your notebook's memory. There is also an indirect method of doing so: you can log the end-of-day TotalPortfolioValue as a panda Series and save it to ObjectStore. Repeat for other backtests, but need to be done in the same project. Then retrieve it in a notebook in the same project for comparison. The attached backtest is an example of this method.
We suggest using LEAN CLI. You may place your own research notebook in the path of your project in the LEAN CLI directory. Then uses lean cloud push --project "My Project" command to push the local project to cloud and continue working on web IDE.
Best,
Louis Szeto
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.
Vladimir
Louis Szeto,
Thanks for your efforts to help me.
I tried the second option you suggested to me and it works with your sample.
When tried it with real backtests (5 years long), my daily allowance to log was eaten in first backtest (no log line).
Will try tomorrow on shorter period.
Is there a way to get .csv file of dally equity curve of a project backtest?
Regarding my second question.
Maybe I didn't make myself clear.
I have a folder on my computer with .ipynb files that were downloaded from Quantopian.
Each project in the QC IDE has a research notebook.
How do I import any .ipynb file from my computer to research notebook in any QC IDE project?
Louis Szeto
Hi Vladimir
The self.Log is not necessary, I just include it for visualizing how is the JSON string looks like. You may still achieve the task without that line or even your daily log limit has been reached. So you don't actually need to shrink the resolution.
For your second question, the solution we've provided in the previous reply is valid. If you have your LEAN CLI properly installed and logged in, you may use
in system terminal/powershell to pull all your project from the cloud to the folder that has LEAN CLI installed, or use
to pull the one you need. Then put the .ipynb in the project's directory and use
to push the updated project back to the cloud. You should be able to use your newly added notebook in web IDE.
Best
Louis Szeto
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.
Vladimir
Louis Szeto,
Today I managed to make a correlation matrix for four projects with good results.
Thanks a lot.
Vladimir
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!