Another approach is to fetch the backtest results in a notebook then compare inside that notebook.
One can retrieve all the data stored in a backtest, including the daily performance, daily portfolio value, and recorded variables, through attributes of the AlgorithmResult object. This is all done in the notebook environment. The first step is to get a reference to each backtest using the get_backtest method and the backtest ID. The backtest ID can be found by opening a backtest and then copying the last string of digit after the last forward slash. Something like this.
# First get the two backtest results
backtest_id_1 = '5e528e3c9e2bfd435c19cefc'
backtest_1 = get_backtest(backtest_id_1)
backtest_id_2 = '5e528dc21ff9b7434f987de4'
backtest_2 = get_backtest(backtest_id_2)
The returned AlgorithmResult object has a number of attributes which fetch different data about the backtest. There is a complete list of these attributes in the documentation (see https://www.quantopian.com/docs/api-reference/research-api-reference#algorithmresult-attributes). The cumulative_performance.ending_portfolio_value attribute will fetch the daily portfolio values. These could then be used to compare our two backtests.
backtest_1_daily_values = backtest_1.cumulative_performance.ending_portfolio_value
backtest_2_daily_values = backtest_2.cumulative_performance.ending_portfolio_value
To plot these results on the same graph perhaps use the pandas plot method. First get them into a single dataframe, then plot. There are of course a lot of ways to plot but this is convenient.
# First make an empty dataframe
plot_df = pd.DataFrame()
# Next add the daily values as columns
plot_df['backtest_1_value'] = backtest_1_daily_values
plot_df['backtest_2_value'] = backtest_2_daily_values
# Finally, simply plot the dataframe
plot_df.plot();
Attached is a notebook which includes the above code. Make sure to replace the backtest IDs with your own before running. The notebook will NOT run with the current IDs since backtests are private (ie nobody other than the account holder has access).
Hope that helps.
Disclaimer
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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.