The Claude Quant PlaybookDownload ebookDownload ebook

Beta

intermediateRisk and portfolio6 of 13

Beta is the slope of a stock's returns against the market's returns. A beta of 1.5 means the stock tends to move 1.5% for every 1% the market moves.

Build a trading system with Claude.Download ebook

01The formula

how much the stock moves, on average, for each 1% move in the market
the stock's return
the market's return
the intercept: the stock's return on a day the market is flat
the stock's own noise, unrelated to the market

02See it move

03Where it is used

04Why traders use it

Most of a stock's daily move is the market moving. Beta tells you how much of your risk is just market risk, which you can hedge cheaply, and how much is specific to the stock.

05Worked example

With a true beta of 1.20 and 120 days of data, the fitted line in this sample has slope 1.396. The stock's correlation with the market is 0.697, so the market explains 48.5% of its variance.

06How it is built

  1. Collect daily returns of the stock and the market over the same days.
  2. Fit the straight line by least squares.
  3. The least-squares slope is .
  4. Equivalently : correlation times the ratio of volatilities.

07The common mistake

Treating beta as fixed. It is an estimate with error, and it changes over time and between calm and stressed markets. A beta from six months of daily data can easily be off by a few tenths.

08In Python and LaTeX

import numpy as np
rng = np.random.default_rng(7)
beta, idio, n = 1.2, 0.015, 120
m = 0.01 * rng.standard_normal(n)
s = beta * m + idio * rng.standard_normal(n)
b_hat = np.cov(m, s)[0, 1] / np.var(m, ddof=1)
print(round(b_hat, 3))  # a different sample from the page's
\beta = \frac{\operatorname{Cov}(R_s, R_m)}{\operatorname{Var}(R_m)}, \qquad R_s = \alpha + \beta R_m + \varepsilon

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.