Hi,
Thanks for helping me!
I am reading
and try to write annualized sharpe ratio in python.
1. calculate daily performance
2. calculate annual performance rate and standard deviation
3. get one year US treasury yield curve rate
But the sharpe ratio I get in (Log) is 1/2 of the one in Overview (12 months). Can someone help me to improve my sharpe ratio calculation? Thank you so much!
Conor Flynn
Hi Yd124,
Although not specifically listed in the current API, there is a SharpeRatio indicator which you can utilize to calculate the sharpe ratio. Take a look at the github link here. Hopefully that is what you are looking for!
-Conor
Yd124
Hi Conor, really thanks for your reply!!!! But I am a novice in python and learn a basic in c++ this semester. I know nothing about c#. It might be a stupid question, but would you like to tell me how to apply it in python?
Shile Wen
Hi Yd124,
The Sharpe Ratio is already computed for you, and it can be found in the Overall Statistics section/tab of the backtest.Furthermore, we also have a Rolling Sharpe indicator, which we demonstrate in the attached backtest (we use a 10 period indicator).
Best,
Shile Wen
Yd124
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!