Hi QC Community
Sharpe Ratio is one of the golden standard benchmarks to track an asset/a portfolio's risk-adjusted return. In this post, we're showing an example of how to add this measure into your algorithm.
- Create a SharpeRatio indicator
- Create a RollingWindow to store the SR indicator values.
- Call .Updated to set up an indicator update handler to update the RollingWindow when an indicator data point is received.
- Create a scheduled event every day to update the indicator with time and the end-of-day portfolio value/assets' price. This new data point update will elicit the update handler to run.
Best
Louis
.ekz.
Great stuff Louis Szeto. Â Thanks for this.
While on the topic of additional performance metrics/indicators: if you ever have the time, do you think you could tackle a chart that shows log returns? Â
Charting log returns next to the equity curve would be very valuable, especially when dealing with parabolic price action like crypto. Â I may take this on some day, i just don't have the time! Â Â
Varad Kabade
Hi .ekz!
We do have a Log Return indicator. Simply replace the Sharpe Ratio indicator with the Log Return one shall do the trick!
https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/indicator-reference/log-return
Best,
Varad Kabade
.ekz.
Brilliant. Thanks Varad Kabade !
Louis Szeto
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!