Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Does backtester Sharpe Ratio calculation include days when Algo has no positions?

Hi @Dan

I'm assuming this is the case.

When I replicate the Algos returns in an excel sheet and create the Sharpe Ratio of actual daily returns, i get a Sharpe of 2.60.

In my excel sheet version, when I use zeros for the returns on all the days that there are no positions then the Sharpe ratio falls to 0.66.

This is the same figure that the Quantopian backtest shows for my Algo.

This is mainly because the average return is dragged down (while also a small reduction in standard deviation of returns which has the opposite effect on the Sharpe Ratio).

I'd argue that including zeros in the returns calculations for days when there are no positions is making the Sharpe Ratio of little value.

Could be I have wrong end of stick!
:-) Tks

2 responses

Hi Ben,

Yes, the Sharpe ratio is computed using annualized returns, which doesn't distinguish between days with positions/no positions. At the end of the day, the Sharpe ratio on the backtest result is meant to give you a sense of the returns relative to the risk of the strategy. It sounds like what you're trying to do is determine the effectiveness of the bets that your strategy makes, which is slightly different.

Out of curiosity, are the days with no positions cropping up because your strategy is built on an event-driven signal? My suggestion would be to try to combine what you have with other signals to have something that you can trade on more regularly, especially if you're looking to enter the contest.

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.

Tks Jamie - Yes that is good to know. (Sharpe Ratio method of calculation). At the moment the Algo is just trading SPY. I'm in the process of adapting it to be able to trade a wider universe in order to meet the requirements of the contest - this should make more frequent.