# Precious-Metal Ratios API
> The ratios between gold, silver, platinum and palladium, where they sit in their own multi-year history, and which metal is cheap relative to which — computed live from Yahoo Finance futures, no key, nothing stored. A precious-metal price tells you what an ounce costs; the ratio between two metals tells you which is expensive relative to the other — and these ratios are famously mean-reverting, which is why the gold/silver "mint ratio" is one of the oldest trades there is: when it stretches to an extreme, traders rotate from the dear metal into the cheap one and ride it back. A single current ratio is only half the story; what matters is where that ratio sits in its multi-year range. This API computes the gold/silver, gold/platinum, platinum/palladium, gold/palladium and silver/platinum ratios, and for each returns its current value, its percentile within a multi-year window (the context that turns a number into a signal), the window min/max/average, and a plain-language rotation read — at a high percentile the numerator metal is historically expensive (favour the denominator), at a low percentile the reverse. The ratios endpoint returns the whole complex; the ratio endpoint returns one pair with its component prices; the history endpoint returns the ratio time series. This is the precious-metal-ratio / mean-reversion cut — distinct from the inter-commodity crack/crush spread API (which gives the current gold/silver ratio but no history, percentile or signal), the intermarket-ratio board and the metals spot-price feed. It is the ratio with its history attached.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/preciousratios-api/..."
```

## Pricing
- **Free** (Free) — 705 calls/Mo, 2 req/s
- **Starter** ($11/Mo) — 16,100 calls/Mo, 6 req/s
- **Pro** ($36/Mo) — 86,000 calls/Mo, 16 req/s
- **Mega** ($81/Mo) — 476,000 calls/Mo, 40 req/s

## Endpoints

### Ratios

#### `GET /v1/ratios` — The whole precious-metal ratio complex with percentiles and signals

**Parameters:**
- `window` (query, optional, string) — Lookback in trading days (120-2520) Example: `1260`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/preciousratios-api/v1/ratios?window=1260"
```

**Response:**
```json
{
    "data": {
        "note": "Each precious-metal ratio with its current value and where it sits (percentile) in its 1260-day range. These ratios mean-revert: a high percentile means the first metal is historically expensive versus the second (rotate into the second), a low percentile the reverse. Read fresh per call, lightly cached.",
        "count": 5,
        "ratios": [
            {
                "avg": 81.403,
                "max": 104.819,
                "min": 44.141,
                "name": "Gold / Silver (mint ratio)",
                "pair": "gold_silver",
                "signal": "extreme low — Gold historically cheap vs Silver; the mean-reversion trade rotates into Gold",
                "available": true,
                "percentile": 7.3,
                "window_days": 1260,
                "current_ratio": 63.076
            },
            {
                "avg": 2.227,
                "max": 3.567,
                "min": 1.601,
                "name": "Gold / Platinum",
                "pair": "gold_platinum",
                "signal": "elevated — Gold rich vs Platinum, leaning toward Platinum",
                "available": true,
                "percentile": 72.9,
                "window_days": 1260,
                "current_ratio": 2.456
            },
            {
                "avg": 0.825,
                "max": 1.457,
                "min": 0.37,
                "name": "Platinum / Palladium",
                "pair": "platinum_palladium
…(truncated, see openapi.json for full schema)
```

### Ratio

#### `GET /v1/ratio` — One ratio with component prices, percentile and signal

**Parameters:**
- `pair` (query, required, string) — gold_silver, gold_platinum, platinum_palladium, gold_palladium or silver_platinum Example: `gold_silver`
- `window` (query, optional, string) — Lookback in trading days (120-2520) Example: `1260`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/preciousratios-api/v1/ratio?pair=gold_silver&window=1260"
```

**Response:**
```json
{
    "data": {
        "avg": 81.403,
        "max": 104.819,
        "min": 44.141,
        "name": "Gold / Silver (mint ratio)",
        "note": "current_ratio = gold price / silver price. percentile is where it sits in its 1260-day range; precious-metal ratios mean-revert, so extremes flag rotation trades. Read fresh per call, lightly cached.",
        "pair": "gold_silver",
        "signal": "extreme low — Gold historically cheap vs Silver; the mean-reversion trade rotates into Gold",
        "source": "Yahoo Finance (GC=F / SI=F)",
        "numerator": "gold",
        "percentile": 7.3,
        "denominator": "silver",
        "window_days": 1260,
        "current_ratio": 63.076,
        "numerator_price": 4234.6,
        "denominator_price": 67.14
    },
    "meta": {
        "timestamp": "2026-06-12T10:34:33.231Z",
        "request_id": "9568f080-860d-409c-b6c3-efda76156021"
    },
    "status": "ok",
    "message": "Ratio retrieved successfully",
    "success": true
}
```

### History

#### `GET /v1/history` — Daily time series of one ratio

**Parameters:**
- `pair` (query, required, string) — Ratio pair Example: `gold_silver`
- `window` (query, optional, string) — Lookback in trading days (120-2520) Example: `1260`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/preciousratios-api/v1/history?pair=gold_silver&window=1260"
```

**Response:**
```json
{
    "data": {
        "days": 1260,
        "name": "Gold / Silver (mint ratio)",
        "note": "Daily Gold / Silver (mint ratio) ratio time series over the window. Read fresh per call, lightly cached.",
        "pair": "gold_silver",
        "source": "Yahoo Finance",
        "history": [
            {
                "date": "2021-06-10",
                "ratio": 67.614
            },
            {
                "date": "2021-06-11",
                "ratio": 66.738
            },
            {
                "date": "2021-06-14",
                "ratio": 66.514
            },
            {
                "date": "2021-06-15",
                "ratio": 67
            },
            {
                "date": "2021-06-16",
                "ratio": 66.888
            },
            {
                "date": "2021-06-17",
                "ratio": 68.635
            },
            {
                "date": "2021-06-18",
                "ratio": 68.106
            },
            {
                "date": "2021-06-21",
                "ratio": 68.491
            },
            {
                "date": "2021-06-22",
                "ratio": 68.721
            },
            {
                "date": "2021-06-23",
                "ratio": 68.266
            },
            {
                "date": "2021-06-24",
                "ratio": 68.169
            },
            {
                "date": "2021-06-25",
                "ratio": 68.116
            },
            {
       
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Service metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/preciousratios-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "ratios and meta take no parameters. ratio and history take pair (gold_silver, gold_platinum, platinum_palladium, gold_palladium, silver_platinum) and window (120-2520 trading days, default 1260 ~5 years). The percentile is the mean-reversion context: extremes flag the rotation trade. A 30-minute protective cache fronts the shared Yahoo upstream.",
        "pairs": [
            "gold_silver",
            "gold_platinum",
            "platinum_palladium",
            "gold_palladium",
            "silver_platinum"
        ],
        "source": "Yahoo Finance precious-metal futures (GC=F, SI=F, PL=F, PA=F), live",
        "service": "preciousratios-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/ratio": "One ratio with component prices, percentile and signal (pair=gold_silver, window=1260).",
            "GET /v1/ratios": "The whole precious-metal ratio complex with percentiles and rotation signals (window=1260).",
            "GET /v1/history": "Daily time series of one ratio (pair=gold_silver, window=1260)."
        },
        "description": "Precious-metal ratios & mean-reversion signal — the ratios between gold, silver, platinum and palladium, where they sit in their own multi-year history, and which metal is cheap relative to which, live from Yahoo Finance futures (no key, nothing stored). ratios returns the whole complex (gold/silver, gold/platinum, platinum/palladium, gold/palladium, silver
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/preciousratios-api
OpenAPI spec: https://www.oanor.com/api/preciousratios-api/openapi.json
