Hi,
Is there a way to get backtest results into the research environment?
This is what I was using on Quantopian to run pyfolio from the research environment:
import pyfolio
bt = get_backtest('59ba65befb066a54cb82b031')
bt.create_full_tear_sheet()
Don't have an account? Join QuantConnect Today
QuantConnect Community Discussions
QUANTCONNECT COMMUNITY
LEAN is the open-source algorithmic trading engine powering QuantConnect. Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
The Open-Quant League is a quarterly competition between universities and investment clubs for the best-performing strategy. The previous quarter's code is open-sourced, and competitors must adapt to survive.
Asking how to import backtest results into QuantConnect's research environment.
Continue ReadingRefer to our Research Guidelines for high quality research posts.
Create an account on QuantConnect for the latest community delivered to your inbox.
Sign Up Today
|
|
|||||||
|
|
||||||||
|
How to get backtest results into Research?
Lexx7 | October 2017
Hi,
Is there a way to get backtest results into the research environment?
This is what I was using on Quantopian to run pyfolio from the research environment:
import pyfolio
bt = get_backtest('59ba65befb066a54cb82b031')
bt.create_full_tear_sheet()
QuantConnectâ„¢ 2025. All Rights Reserved
Felipe Palhares Hampshire
This will be very helpful.
+ 1
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.
Alexandre Catarino
Hi Lexx7 ,
We have created a GitHub issue to implement this feature:
[Research] QuantBook Retrieves Backtest Results For Analysis #4580
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.
Bruce Vanstone
Hi,
any update on this feature, or an example of how to access the backtest results for an algorithm for further analysis?
Cheers,
Bruce
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.
Laurent Crouzet
Bruce Vanstone A lot was added to analyse backtests. See:
https://github.com/QuantConnect/Lean/pull/4898I still need to do additionnal research to check that every data is available from this method...
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.
Shile Wen
Hi Bruce,
This was answered in this thread.
Best,
Shile Wen
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.
Shile Wen
Hi Bruce,
Under the Console, you should see "Backtesting Project ID: ..." and "Algorithm Id: ..." for the Project and Backtest IDs respectively.
Best,
Shile Wen
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.
Tarquinius Superbus
Hi QC team,
I am fairly new to the platform and has a question on accessing backtest result from research notebook. I was able to import the backtest object by using the command mentioned above. However I am not sure how to access the contents/values in the backtest object. Specifically, I want to see daily return/daily portfolio position from the backtest.
I tried to go over detailed documentation here:
https://www.quantconnect.com/lean/docsHowever this doc seems outdated and incomplete. I'd really appreciate any help/pointer on this.
Best,
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.
Derek Melchin
Hi Tarquinius Superbus,
To get the backtest results into the Research environment, we can use
api.ReadBacktest(projectID, backtestID)
See the attached notebook for reference.
A list of all the backtest attributes that are returned from this call are available here. Note daily return and daily portfolio positions are not included. A workaround is to save them in the ObjectStore while backtesting, then load them into the Research environment.
Best,
Derek Melchin
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.
Tarquinius Superbus
Hi Derek,
Thanks for the explanation.
For anyone who wonders into this thread in the future, note that you can extract portfolio NAV with this code snippet. It extracts NAV value from the strategy equity chart.
# To extract portfolio NAV from backtest results backtest = api.ReadBacktest(projectID, backtestID) chartpoint_ls = backtest.Charts["Strategy Equity"].Series["Equity"].Values nav = [x.y for x in chartpoint_ls] date = [datetime.fromtimestamp(x.x) for x in chartpoint_ls] nav = pd.Series(nav,index=date)
Best,
Tarquinius Superbus
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!