Introduction to Quant Finance · Lesson 8
Volatility
How wide is luck? One number for how far returns typically land from their average, how to work it out by hand, and how to turn a daily figure into a yearly one.
Know the basics? Read the lesson notesSame average, different ride
A daily return is how much a price moved from one day's close to the next, in percent (lesson A7). Here are two simulated assets, A and B, over the same 20 days. Play the days.
Two assets, 20 days (simulated)
Each bar is one day's return: up for a gain, down for a loss. Dashed: each asset's average day so far.
Both average +0.10% a day (they were made that way). Yet A never moved more than 0.92% in a day, while B moved as much as 4.11%. The average can't tell them apart. You need a second number: how far the days typically land from their average.
Distances cancel out
Take five made-up days: +2%, −2%, +4%, 0% and +1%. Their average is (2 − 2 + 4 + 0 + 1) ÷ 5 = 5 ÷ 5 = +1%.
Each day's distance from the average is that day minus 1%: +1, −3, +3, −1 and 0. A first idea for the typical distance is to average those five. What do you get?
Square, average, square root
Square each distance, then average the squares. That average is called the variance. Its unit is "percent squared", which nobody can picture, so take its square root to get back to percent. The result is the standard deviation: the typical distance from the average, as in the last lesson.
For the five days: the squares are 1, 9, 9, 1 and 0. They add up to 20, so the variance is 20 ÷ 5 = 4, and the standard deviation is √4 = 2%. Dropping the signs instead and averaging would give 8 ÷ 5 = 1.6%. The standard deviation, the root of the average square, is never smaller than that plain average distance, and usually a little bigger, because the squares weigh the far days more.
Now drag the days left and right, and watch the numbers follow. Get the standard deviation below 1%, then above 3%.
Five days you can move (made-up)
Each row is one day. The line from the dashed average to the dot is that day's distance. On the right, a square with that distance as its side: its area is the distance squared. Orange bar: the average ± one standard deviation.
Pulling the days in toward the average shrinks it. One day far out raises it fast, because its distance is squared: one day 4% from the average adds 16 to the sum of squares, while four days 1% away add only 4 between them.
Match the volatility
In trading, the standard deviation of an asset's returns has its own name: volatility. Daily volatility is the standard deviation of its daily returns.
Here are three simulated assets over one year: 252 trading days, about as many days as markets open in a year. Their daily volatilities are 0.53%, 0.93% and 1.91%. Pick one for each asset, then check.
Three assets, one year each (simulated)
Each line is a price starting at 100. After you check, each day's return appears underneath as a thin bar.
Asset X
Asset Y
Asset Z
Z rose from 100 to 133.29 with the smallest daily moves, 0.53%. X fell to 70.75 with the biggest, 1.91%. Volatility measures how big the moves are, not which way they go. It is built from squared distances, so up days and down days count the same.
68 in 100 within how far?
The last lesson's 68–95–99.7 rule: on a bell curve, about 68 results in 100 land within one standard deviation of the average, and about 95 within two.
Take asset Y. Its daily volatility is 0.93%, and its average day was almost exactly 0%. About 68 of every 100 of its days should land within how far of that average?
Count Y's days
Here are all 252 of Y's daily returns, sorted by size into bars. Switch between one and two standard deviations and count the days inside.
Asset Y: 252 daily returns (simulated)
Each bar counts the days whose return fell in one 0.25%-wide slice. Orange: the days inside the band around the average. A bar cut by a band edge is split: its orange part is the days inside.
Within ±0.93%: 168 of 252 days (66.7%). Within ±1.86%: 241 (95.6%), which leaves 11 days beyond. Close to 68 and 95 in 100.
So daily volatility tells you how wide an ordinary day is. On about two days in three, Y moved less than 0.93% from its average.
Variance and standard deviation
The variance is the average squared distance from the mean, which is the textbook word for the average. The standard deviation is its square root. In formulas, σ is read "sigma" and μ "mu".
- x1 … xn
- the numbers, for example daily returns; n is how many there are
- μ
- "mu", their mean (average): add them up, divide by n
- σ²
- the variance, in squared units
- σ
- "sigma", the standard deviation, in the numbers' own unit
- s
- the sample standard deviation (below)
When the numbers are a sample, a few days standing in for many more, they sit a little closer to their own average than to the true one, so the squares come out slightly small. Dividing by n − 1 instead of n makes up for it. That gives s, the sample standard deviation. Use ÷n when you have every case there is; use ÷(n − 1) when a handful stands in for more, as in most backtests. Y's 0.93% earlier was an s, dividing by 251; with 252 days, the two barely differ.
μ = (2 − 2 + 4 + 0 + 1) ÷ 5 = 1. Distances: +1, −3, +3, −1, 0. Squares: 1, 9, 9, 1, 0, which add up to 20. Variance: σ² = 20 ÷ 5 = 4, so σ = √4 = 2%. As a sample: 20 ÷ 4 = 5, so s = √5 ≈ 2.24%.
- you want the typical size of a distance, in the numbers' own unit;
- reading it with the 68–95–99.7 rule: the numbers spread out roughly like a bell.
One extreme day moves it a lot, because its distance is squared, and real returns have more extreme days than a bell (lesson A6, Fat tails).
For the precise: why square, not just drop the signs?
Dropping the signs and averaging gives the mean absolute deviation: 8 ÷ 5 = 1.6 for the five days. It is a fine measure too. Squares are the standard because variances of independent days add up, which is where the √n rule of the last lesson comes from.Try it on new numbers. Three days: 0%, +3% and +6%. Treat them as a sample. What is s, in percent?
From daily to yearly volatility
Volatility is usually quoted per year: the annualised volatility. Log returns, the unit from lesson A7 that adds up over time, make a year's return the total of its 252 daily ones. The last lesson showed how the spread of a total grows: with the square root of how many are added up, because up days and down days partly cancel. This is the square-root-of-time rule:
- σday
- the daily volatility
- 252
- trading days in a year, the count most people agree to use; √252 ≈ 15.87
- σyear
- the yearly (annualised) volatility
For daily moves of a percent or two, percent and log returns are nearly equal (lesson A7), so the rule is used with either.
σday = 0.93%, so σyear = 0.93% × 15.87 = 14.76%, ≈ 15% a year. A year like Y's would land within about 15% of its average about two years in three.
- each day's move doesn't change the next one's (the days are independent);
- the volatility stays the same all year.
Calm and wild stretches come in runs (lesson C2, Volatility clustering), and prices that keep trending or snapping back from day to day spread differently (lesson C1, Time series basics).
For the precise: the rule checked by simulation
The script simulated 2,000 more years of 252 independent days, each with a daily volatility of 1%. The standard deviation of the 2,000 yearly totals was 15.77%, against 1% × √252 = 15.87%.An asset's daily volatility is 1.5%. About what is its yearly volatility?
What this means for your backtest
A backtest runs a trading rule over past prices to see what it would have made. Its daily results have a volatility too. Turn over three points, one at a time.
- Volatility is the size of the moves, not their direction.
A rising account line can be calm or wild, like Z and X. Check its volatility, not just where it ends.
- Compare in the same units: daily with daily, yearly with yearly.
A daily 1% and a yearly 15.87% describe the same swings (1 × √252). Turn daily into yearly with × √252, never × 252.
- Volatility sets how wide luck is.
With no edge (no advantage, so nothing made on average), a year's result lands within one yearly volatility of 0 about two years in three. A +8% year is everyday luck at a yearly volatility of 32% (8 ÷ 32 = 0.25 standard deviations), but two standard deviations out at 4% (8 ÷ 4 = 2).
Four days, by hand
What is s, in percent? The last step is a square root: any phone calculator has a √ key.
Hint: the average first, (2 − 1 + 4 − 1) ÷ 4. Then each day's distance from it, the squares, their sum ÷ (4 − 1), and the square root.
A daily figure on a factsheet
What is 0.8% a day as a yearly volatility, in percent?
Hint: multiply the daily volatility by √252 ≈ 15.87.
Two rules, the same +10%
Which +10% would be harder for luck alone to produce?
Lesson done
Volatility is the standard deviation of returns: square each return's distance from the average, average the squares (the variance), then take the square root. It measures how big the moves are, not which way they go. A year adds up 252 days, so yearly volatility is daily volatility × √252, and it tells you how wide luck is.
Key ideas
- Variance (σ²)
- the average squared distance from the mean
- Standard deviation (σ)
- the square root of the variance: the typical distance from the mean
- Sample standard deviation (s)
- the same, dividing by n − 1, for a few numbers standing in for many
- Volatility
- the standard deviation of returns; daily volatility uses daily returns
- Annualised volatility
- volatility per year: daily volatility × √252
Formulas
σ² = sum of (x − μ)² ÷ n · σ = √σ² · s = √(sum of (x − μ)² ÷ (n − 1))
σyear = σday × √252 (√252 ≈ 15.87)