Hi Community,
I am wondering if any of you have tried to implement custom evaluation metric such as sortino ratio or adjusted sortino ratio using backtesting data.
My original idea is to calculate the metric either in OnEndOfAlgorithm() method or in a separate research notebook. Nevertheless for either way I would need the daily portfolio return or portfolio return in other datetime resolution. After investigating into Lean API and several community posts, such as
Calculate Running Statistics & Make Accessible In Algorithm · Issue #1105 · QuantConnect/Lean
How to calculate sharpe ratio in python? by Yd124
Sharpe Ratio - QuantConnect.com
Lean: QuantConnect.Algorithm.QCAlgorithm Class Reference
Lean: QuantConnect.Securities.SecurityPortfolioManager Class Reference
I failed to find a proper way/an official API to extract daily performance of the entire portfolio from QC. However I found a hacky way to retrieve such information from QC Backtesting chart, which on the other hand is sometimes not reliable in terms of different backtesting condition. Thus if any QCer had successfully retrieved such information using solid API or had experience with calculating Sortino Ratio in QC, please let me know. Thanks a lot!
Best Regards,
Derek Melchin
Hi Weikang,
We create a GitHub Issue to add Sortino Ratio to the PortfolioStatistics of the Backtest object. Subscribe to the following issue to receive updates on our progress:
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Weikang Wu
Hi Derek,
Thanks for creating a new PR for Sortino ratio. Interestingly, my college discovered that QuantConnect actually already implemented Sortino ratio inside AlphaRuntimeStatistics, you can find the ratio in the screenshot in the link below. I and my college have also verified the existence of the Sortino Ratio inside our research environment. Still we have some uncertainties:
Glad to hear your reply.
Derek Melchin
Hi Weikang,
The difference between AlphaRuntimeStatistics and Statistics is AlphaRuntimeStatistics is tailored to get statistics of algorithms that emit Insights. RuntimeStatistics represents the statistics at the top of the backtest/live results page.
The Sortino ratio is robust. The formula is available here.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Weikang Wu
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!