# Ratio Atlas

Interactive research dashboard for annual oil, gold, and Dow ratios beginning in 1885. Static HTML, CSS, and JavaScript; no build step, external chart library, or live API needed.

The dashboard is available at https://ratio.fyi and can also be run locally.

## Run locally

```sh
python3 -m http.server 8085 --bind 127.0.0.1 --directory dist
```

Open http://localhost:8085. The dashboard loads `dist/data.json`. It includes a selectable date range and base year, logarithmic and linear charts, a year inspector, three pairwise ratios, a three-way relative-strength comparison, and downloadable data.

The default view places Gold / Oil, Dow / Gold, and Dow / Oil side by side. They share a time axis but use independent vertical scales and units. Ranks, lows, and highs refer to the selected window; changing the normalization base does not change these raw ratios. Select an individual ratio for a larger chart, or choose a rebased comparison to access the combined score and base-year control.

Historical context cards calculate their findings from the full snapshot using labeled reference windows. Their buttons open the relevant date ranges and comparison bases. The cards deliberately stay fixed when chart filters change. The SVG download exports all three panels in overview mode, with units, scale, coverage and source notes.

## Data and methodology

The snapshot covers 1885–2025; 2026 is excluded because it is incomplete. Original source data and per-row notes are retained. No missing prices are interpolated.

- Oil: Energy Institute via Our World in Data. Nominal USD per barrel; changing historical benchmarks: US average, Arabian Light, then Brent dated.
- Gold: MeasuringWorth New York annual gold through 1959; World Bank annual averages from 1960. USD per fine troy ounce. Early controlled-market years use official prices as a proxy; this is not a continuous freely traded market series. Historical London standard-ounce tables were excluded to avoid a purity mismatch.
- Dow: MeasuringWorth daily price-index history through 2016 and S&P Dow Jones Indices via FRED from 2017, aggregated to the arithmetic mean of published daily observations. 1885–1895 is the predecessor index; 1896 mixes predecessor and DJIA. Actual-only mode begins with the first full year in this source, 1897. Early levels are retrospectively adjusted by the source. Dividends are excluded. 1885 is partial and 1914 excludes exchange-closure dates. FRED supersedes two discrepant 2019 daily quotes and an extra Good Friday observation in the MeasuringWorth compilation.

Each ratio divides the relevant annual averages; this is not an average of daily ratios. Dow ratios retain index-level scaling and are not literal tradable gold or oil quantities. Gold/oil is barrels per troy ounce.

For three-way strength, first rebase each series: `d = Dow / Dow_base`, `g = Gold / Gold_base`, `o = Oil / Oil_base`. Then:

```text
Dow strength  = 100 × d / sqrt(g × o)
Gold strength = 100 × g / sqrt(d × o)
Oil strength  = 100 × o / sqrt(d × g)
```

All three equal 100 in the base year. A value above 100 means that asset has outperformed the geometric mean of the other two since the base year. The measure depends on the base year; it does not estimate fair value or total investment returns. The product of the three strengths is 1,000,000. Only two pairwise ratios are independent because `Dow/oil = (Dow/gold) × (Gold/oil)`.

Downloads include row-level provenance and proxy flags. The static CSV uses 1885 as its strength base; the dashboard export uses the selected base and range. See `dist/provenance.json` and `data/sources/*_metadata.json` for full definitions and sources.

## Rebuild the snapshot

Python dependencies: pandas, openpyxl, requests (see requirements.txt). The source parsers use retained raw files by default; oil and gold accept `--download`, while Dow accepts `--refresh` for MeasuringWorth. Refresh FRED from its metadata URL separately. This snapshot deliberately ends in 2025; review the parsers' coverage and definitions when updating years.

```sh
python3 scripts/fetch_oil.py
python3 scripts/fetch_gold.py
python3 scripts/fetch_dow.py
python3 scripts/build_dataset.py
```

Source prices are factual observations. Underlying source material retains its providers' terms and attribution; see the linked source pages. MeasuringWorth attribution: Lawrence H. Officer and Samuel H. Williamson, *The Price of Gold, 1257–Present*; Samuel H. Williamson, *Daily Closing Value of the Dow Jones Average, 1885 to Present*. MeasuringWorth permits credited non-profit educational use and requests contact before publishing tables of gold prices longer than five consecutive years. No public-domain license is asserted for the compiled data; the source terms apply to reuse and republication.
