The Claude Quant PlaybookDownload ebookDownload ebook

Capital asset pricing model (CAPM)

intermediateRisk and portfolio7 of 13

CAPM says an asset's expected return is the risk-free rate plus its beta times the market's extra return. Only market risk is paid for; risk you could diversify away earns nothing.

Build a trading system with Claude.Download ebook

01The formula

the expected return of asset i
the risk-free rate
the asset's beta against the market
the market risk premium: the extra return the whole market pays over cash

02See it move

03Where it is used

04Why traders use it

It gives every asset a required return based on one number, beta. That lets you ask whether a stock is worth owning: if your forecast is below the line, the market pays you more for the same risk elsewhere.

05Worked example

With cash at 3.0% and the market expected to return 8.0%, a stock with beta 1.20 should earn 9.00%. The market risk premium is 5.0%. If you forecast 11.0%, your alpha is 2.00%.

06How it is built

  1. Hold the market portfolio plus cash; every efficient portfolio lies on the line from cash through the market.
  2. Adding a small amount of asset changes the portfolio's risk in proportion to its beta, not its own volatility.
  3. In equilibrium each asset's extra return must match the extra risk it adds, so .
  4. Plotted against beta this is a straight line, the security market line, through and .

07The common mistake

Using it as a forecast. CAPM is a model of what returns should be in equilibrium, and in real data the line is flatter than it predicts: low-beta stocks have tended to do better than CAPM says.

08In Python and LaTeX

rf, rm, beta, forecast = 0.03, 0.08, 1.2, 0.11
required = rf + beta * (rm - rf)
print(round(required, 4), 'alpha', round(forecast - required, 4))  # 0.09 alpha 0.02
E[R_i] = r_f + \beta_i\,\big(E[R_m] - r_f\big)

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.