Sharpe ratio
The Sharpe ratio is the return a strategy earns above cash, divided by how much its returns bounce around. It answers one question: how much reward do you get for each unit of risk you take?
01The formula
- the Sharpe ratio: excess return earned per unit of volatility
- the strategy's expected (average) return per year
- the risk-free rate: what cash in the bank would have earned
- the volatility: standard deviation of the strategy's returns per year
02See it move
03Where it is used
- Portfolio managerCompares funds and strategies with very different risk levels on one scale, and reports it to investors.
- Quant researcherRanks backtests by Sharpe rather than raw return, since a strategy can always be scaled up with leverage.
- Risk managerWatches the rolling Sharpe of each desk to spot a strategy whose edge is fading.
04Why traders use it
Raw returns hide risk. A strategy making 20% with 40% volatility is worse than one making 10% with 10% volatility, because you could lever the second one up to 20% with far less risk. Sharpe puts them on the same footing.
05Worked example
A strategy expected to return 10.0% a year with volatility 15%, when cash pays 3.0%, has a Sharpe ratio of 0.467. Its excess return is 7.0%. To reach a Sharpe of 1 at the same volatility it would need to return 18.0%.
06How it is built
- Subtract the risk-free rate from the return: is what you earned for taking risk at all.
- Measure the risk as the standard deviation of returns, .
- Divide: . Leverage multiplies both top and bottom, so it leaves unchanged.
- To convert from daily to yearly, multiply by : the mean grows with time and volatility with its square root.
07The common mistake
Annualising wrongly. A daily Sharpe must be multiplied by , not by 252. And a Sharpe computed from a short or overfitted backtest has a huge standard error, so a high number alone proves very little.
08In Python and LaTeX
mu, sigma, rf = 0.10, 0.15, 0.03 sharpe = (mu - rf) / sigma print(round(sharpe, 4)) # 0.4667
S = \frac{\mu - r_f}{\sigma}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.