liveBook · Manning

Volatility

As explained in Investing for Programmers

Market volatility is the degree and frequency of variation in an asset's price or returns over time.

Volatility measures how much and how often an asset’s price or returns vary over time. Large historical movements signal greater uncertainty and risk, but do not guarantee future behavior. section 3.4.2 section 7.2

A practical workflow loads historical prices, normalizes stocks to a common starting value, calculates simple or logarithmic returns, and summarizes dispersion with standard deviation and variance. section 3.4.2

Use volatility analysis to:

  • Compare assets whose nominal share prices are not directly comparable. section 3.4.2
  • Identify higher-risk assets and consider diversification across stocks with different stability profiles. section 3.4.2 section 7.2

Comparing Coca-Cola, Apple, and NuScale

For 2023, the reported return standard deviations are 0.134959 for Coca-Cola, 0.199222 for Apple, and 0.799615 for NuScale; the corresponding variances are 0.018214, 0.039690, and 0.639385. section 3.4.2

import yfinance as yf
historical_data = yf.Ticker("MSFT").history(start="2024-05-08", 
end="2025-05-08 
historical_data

Load Microsoft’s historical data with yfinance before inspecting price ranges, returns, and variability. section 3.4.2

How Investing for Programmers covers it

How deep it goes
Calculates simple and logarithmic returns, histograms, standard deviations, and variances, while stopping short of forecasting certainty.
Examples
Compares Microsoft data and normalized Coca-Cola, Apple, and NuScale prices using tables, plots, histograms, and return statistics.
What it assumes
Requires historical price data and basic programmer-oriented data handling, while introducing return and variability measures through examples.
What you can do after
Evaluate assets by computing returns and dispersion with Python data, while interpreting volatility as risk rather than a guarantee.
How it connects
Connects technical analysis with risk management, returns, portfolio diversification, and exchange-traded funds.

Also explained in

Compare how 5 books explain volatility →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.