A historical return measures an asset’s realized percentage change over a completed period. It estimates average returns from past price data and supports portfolio analysis. section 3.1.1
Compute historical returns by following a short data workflow:
- Download adjusted closing prices, which account for dividends and corporate actions such as stock splits. section 3.1.1
- Calculate each period’s percentage change with pandas pct_change(). section 3.1.1
- Remove or account for the initial NaN, then average daily returns and multiply by 252 to annualize the estimate. section 3.1.1
Three-stock estimate
For AAPL, First Energy, and Walmart, average historical returns annualized from daily observations are approximately 30.7%, 10.0%, and 8.1%, respectively. These figures summarize the selected historical sample rather than guaranteeing future performance. section 3.1.1
Listing 3.1 Downloading historical stock prices
import yfinance as yf
df = yf.download('AAPL', start='2000-01-03', end='2023-12-30')
df.tail()
Download a stock’s historical prices with yfinance before selecting adjusted closing prices and calculating returns. section 3.1.1
