I noticed that the value of SharpeRatio in the Summary table at the end of a backtest and the SharpeRatio obtained by using “Statistics.TotalPerformance.PortfolioStatistics.SharpeRatio” from within “OnEndOfAlgorithm()” is not the same. How does this happen? Shouldn't the summary statistics be all calculated by the time we run “OnEndOfAlgorithm()”?
Mia Alissi
The discrepancy between the Sharpe Ratio in the summary table at the end of a backtest and the one obtained using
Statistics.total_performance.portfolio_statistics.sharpe_ratio
withinOnEndOfAlgorithm()
can be attributed to several factors:Timing of Calculations: The summary statistics might be calculated at a different point in time compared to when you access them in
OnEndOfAlgorithm()
. This timing difference can lead to discrepancies if the data or conditions have changed during the backtest.Data Used for Calculation: The Sharpe Ratio calculation might use different data sets or resolutions in the summary table versus the
OnEndOfAlgorithm()
method. Ensure that both methods use the same data and resolution settings to achieve consistency.Implementation Details: The implementation of the Sharpe Ratio calculation in the QuantConnect platform might have specific nuances or additional parameters that affect the outcome. It's possible that the summary table uses a slightly different method or parameters for calculating the Sharpe Ratio.
Custom Adjustments: If there are any custom calculations or adjustments made to the statistics before they are stored in the summary, this could lead to differences.
To ensure consistency, you may want to verify the data and parameters used for both calculations and consider any potential timing issues that could affect the results.
Sources: Results - QuantConnect.com, Results - QuantConnect.com, Probabilistic Sharpe Ratio, Algorithm Statistics - QuantConnect.com, Statistics Results Algorithm
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.
Louis Szeto
Hi Luis
We have improved the statistics with a more accurate dynamic interest rate. Yet, the PDF report generation has not been updated. Hence, the end-time statistics are more realistic and accurate. Sorry for the inconvenience caused. This issue will be handled later.
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.
Luis Freire
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!