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 COMMUNITY
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()
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.
Felipe Palhares Hampshire
This will be very helpful.
+ 1
Alexandre Catarino
Hi Lexx7Â ,
We have created a GitHub issue to implement this feature:
[Research] QuantBook Retrieves Backtest Results For Analysis #4580
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
Laurent Crouzet
Bruce Vanstone A lot was added to analyse backtests. See:
https://github.com/QuantConnect/Lean/pull/4898Â
I still need to do additionnal research to check that every data is available from this method...
Shile Wen
Hi Bruce,
This was answered in this thread.
Best,
Shile Wen
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Â
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,
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
Lexx7
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!