Lesson 2 · 18 min
Market data fundamentals
Prices, bars, adjusted data, and the panels your strategies consume every day.
OHLCVAdjusted closePanels
Every strategy starts with market data — a time series of prices. Quant Buffet's lab uses daily adjusted close for liquid ETFs, loaded through load_daily_prices() and cached on disk.
| Layer | What you get | In Quant Buffet |
|---|---|---|
| Exchange / vendor | Tick-by-tick trades, quotes | Not used in lab |
| Yahoo Finance (yfinance) | Daily OHLCV | Downloaded via load_daily_prices |
| Quant Buffet cache | CSV per symbol + date range | backtest/data_cache/*.csv |
| Your strategy | pd.DataFrame panel | Columns = ASSETS, index = dates |
| Indicators | Rolling SMA, returns, z-scores | Computed inside make_on_day |
Core vocabulary
| Term | Meaning | Example in lab |
|---|---|---|
| Ticker / symbol | Instrument code | SPY, TLT, BTC-USD |
| OHLCV bar | Open, High, Low, Close, Volume for one period | One row per trading day |
| Adjusted close | Close corrected for splits & dividends | Default in load_daily_prices |
| Panel | Table: dates × symbols | prices DataFrame in make_on_day |
| Lookback | History window for an indicator | 200-day SMA needs 200 rows |
Reading a price panel
# Inside make_on_day — prices is already loaded for your ASSETS
cols = [c for c in ASSETS if c in prices.columns]
close = prices[cols]
daily_return = close.pct_change()
sma_200 = close.rolling(200, min_periods=200).mean()Common data pitfalls
- Survivorship bias — testing only assets that exist today ignores delisted names.
- Look-ahead bias — using future data in today's signal (e.g. full-sample mean).
- Corporate actions — always prefer adjusted prices for long backtests.
- Missing IPO history — forward-fill does not invent pre-IPO prices;
readymust start after data exists.