> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compute-desk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Full Example

> Complete script: read the current index, pull full history, and overlay it on the long-run informational baseline

A self-contained script that reads the latest blended Transaction Index, pulls its
full history, and overlays it on the longer-history Informational Index — the
standard pattern for charting a high-signal series against a clean long-run
baseline.

<CodeGroup>
  ```python Python theme={null}
  #!/usr/bin/env python3
  """Read the current GPU price index, pull history, and overlay it on the
  long-run informational baseline."""

  import os
  import requests
  import pandas as pd

  BASE = "https://data-api.compute-index.com/v1"
  TOKEN = os.environ["TOKEN"]
  headers = {"Authorization": f"Bearer {TOKEN}"}

  GPU_FAMILY = "hopper"   # or "blackwell"
  REGION = "US"

  # Step 1: Latest blended transaction index (the settlement-benchmark series)
  resp = requests.get(
      f"{BASE}/txn-index/current",
      headers=headers,
      params={
          "gpu_family": GPU_FAMILY,
          "region_group": REGION,
          "contract_type": "combined",
          "index_type": "blended_sigmoid",
      },
      timeout=30,
  )
  resp.raise_for_status()
  latest = resp.json()["data"][0]
  print(f"{GPU_FAMILY}-{REGION}: ${latest['index_value']:.4f}/GPU-hr on {latest['date']}")

  # Step 2: Full transaction history (up to the 730-day window)
  resp = requests.get(
      f"{BASE}/txn-index/history",
      headers=headers,
      params={
          "gpu_family": GPU_FAMILY,
          "region_group": REGION,
          "contract_type": "combined",
          "index_type": "blended_sigmoid",
          "days_back": 730,
      },
      timeout=30,
  )
  resp.raise_for_status()
  txn = pd.DataFrame(resp.json()["data"])
  txn["date"] = pd.to_datetime(txn["date"])

  # Step 3: Extend history with the informational baseline (no days_back cap,
  # real data back to early 2024)
  resp = requests.get(
      f"{BASE}/info-index/history",
      headers=headers,
      params={"index_name": GPU_FAMILY, "region_group": REGION},
      timeout=30,
  )
  resp.raise_for_status()
  info = pd.DataFrame(resp.json()["data"])
  info["date"] = pd.to_datetime(info["date"])

  # Step 4: Merge into one frame — informational baseline + transaction overlay
  merged = (
      info[["date", "index_value"]]
      .rename(columns={"index_value": "informational"})
      .merge(
          txn[["date", "index_value"]].rename(columns={"index_value": "transaction"}),
          on="date",
          how="left",
      )
      .sort_values("date")
  )

  print(f"\nInformational baseline: {len(info)} days "
        f"({info['date'].min().date()} → {info['date'].max().date()})")
  print(f"Transaction overlay:    {len(txn)} days "
        f"({txn['date'].min().date()} → {txn['date'].max().date()})")
  print(merged.tail())

  # merged.plot(x="date", y=["informational", "transaction"])  # with matplotlib
  ```

  ```typescript TypeScript theme={null}
  const BASE = "https://data-api.compute-index.com/v1";
  const headers = { Authorization: `Bearer ${process.env.TOKEN}` };

  const GPU_FAMILY = "hopper"; // or "blackwell"
  const REGION = "US";

  async function get(path: string, params: Record<string, string>) {
    const qs = new URLSearchParams(params).toString();
    const resp = await fetch(`${BASE}${path}?${qs}`, { headers });
    if (!resp.ok) throw new Error(`HTTP ${resp.status} on ${path}`);
    return resp.json();
  }

  // Step 1: Latest blended transaction index (the settlement-benchmark series)
  const current = await get("/txn-index/current", {
    gpu_family: GPU_FAMILY,
    region_group: REGION,
    contract_type: "combined",
    index_type: "blended_sigmoid",
  });
  const latest = current.data[0];
  console.log(`${GPU_FAMILY}-${REGION}: $${latest.index_value.toFixed(4)}/GPU-hr on ${latest.date}`);

  // Step 2: Full transaction history (up to the 730-day window)
  const txn = await get("/txn-index/history", {
    gpu_family: GPU_FAMILY,
    region_group: REGION,
    contract_type: "combined",
    index_type: "blended_sigmoid",
    days_back: "730",
  });

  // Step 3: Extend history with the informational baseline (no days_back cap,
  // real data back to early 2024)
  const info = await get("/info-index/history", {
    index_name: GPU_FAMILY,
    region_group: REGION,
  });

  // Step 4: Merge into one series — informational baseline + transaction overlay
  const txnByDate = new Map(txn.data.map((d: any) => [d.date, d.index_value]));
  const merged = info.data.map((d: any) => ({
    date: d.date,
    informational: d.index_value,
    transaction: txnByDate.get(d.date) ?? null,
  }));

  console.log(`Informational baseline: ${info.data.length} days`);
  console.log(`Transaction overlay:    ${txn.data.length} days`);
  console.table(merged.slice(-5));
  ```

  ```bash cURL theme={null}
  # Step 1: latest blended transaction index (Hopper-US, combined)
  curl -H "Authorization: Bearer $TOKEN" \
    "https://data-api.compute-index.com/v1/txn-index/current?gpu_family=hopper&region_group=US&contract_type=combined&index_type=blended_sigmoid"

  # Step 2: full transaction history (up to 730 days)
  curl -H "Authorization: Bearer $TOKEN" \
    "https://data-api.compute-index.com/v1/txn-index/history?gpu_family=hopper&region_group=US&contract_type=combined&index_type=blended_sigmoid&days_back=730"

  # Step 3: long-run informational baseline (no days_back cap)
  curl -H "Authorization: Bearer $TOKEN" \
    "https://data-api.compute-index.com/v1/info-index/history?index_name=hopper&region_group=US"
  ```
</CodeGroup>

## What this does

1. **Current index** — reads the latest blended Transaction Index value for the Hopper family (US, combined)
2. **Transaction history** — pulls the full smoothed series within the 730-day window
3. **Informational baseline** — pulls the Informational Index, which has no `days_back` cap and real data back to early 2024
4. **Overlay** — merges the two on `date`, giving a long baseline with the high-signal transaction series layered on top

<Info>
  All index values are **EWMA-smoothed** and denominated in **\$/GPU-hr**.
  Each data point carries a `p5`/`p95` envelope (`p5 ≤ index_value ≤ p95`) you can
  plot as a confidence band — but avoid depending on `p5`/`p95` (or `txn_count`)
  for the **Transaction Index**: that series is moving to the officially
  administered GX feed, which does not publish them, and they will return `null`
  after the swap.
</Info>

## Customizing

* **Switch GPU family** — set `GPU_FAMILY = "blackwell"` for the Blackwell series.
* **Per-GPU daily series** — swap `gpu_family` for `gpu_group` (`h100`, `h200`, `a100`, `b200`, `b300`) on the txn-index calls. The two parameters are mutually exclusive — sending both returns `400`.
* **Index vs. leg** — `index_type=blended_sigmoid` (default) is the transaction index: a sigmoid-weighted blend of the settled-trade leg and a posted-price leg. `index_type=raw` returns the transaction leg alone (noisier; despite the name it is still EWMA-smoothed — no unsmoothed series is served).
* **Intraday** — for 30-minute per-GPU-model indices, use the [Intraday Index](/pricing/endpoint/custom-index-current) endpoints (requires the `custom-index` scope).
