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

# Build a prices dashboard

> Load market prices over REST, then keep them live with the trading channel.

Show live Polymarket odds on a board. Load the first snapshot over the [REST API](/api/overview), then stream fills from the [`trading`](/websockets/channels/trading) channel to keep each price fresh.

## What you need

* An API key from [radion.app/dashboard](https://radion.app/dashboard).
* The token ids you want to track (each outcome has one).

## 1. Load the snapshot

Read the markets you care about, then pull a price per outcome token. Use `midpoint` for a fair mid, `price` for the best bid or ask, and `spread` for the gap.

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.radion.app/v1/polymarket/midpoint?token_id=123456789" \
    -H "X-API-Key: YOUR_API_KEY"

  curl "https://api.radion.app/v1/polymarket/spread?token_id=123456789" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```typescript TypeScript theme={null}
  const headers = { "X-API-Key": "YOUR_API_KEY" };
  const base = "https://api.radion.app/v1/polymarket";

  async function snapshot(tokenId: string) {
    const [mid, spread] = await Promise.all([
      fetch(`${base}/midpoint?token_id=${tokenId}`, { headers }).then((r) =>
        r.json()
      ),
      fetch(`${base}/spread?token_id=${tokenId}`, { headers }).then((r) =>
        r.json()
      ),
    ]);
    return { midpoint: mid.midpoint, spread: spread.spread };
  }
  ```

  ```python Python theme={null}
  import httpx

  client = httpx.Client(
      base_url="https://api.radion.app",
      headers={"X-API-Key": "YOUR_API_KEY"},
  )

  def snapshot(token_id: str):
      mid = client.get("/v1/polymarket/midpoint", params={"token_id": token_id}).json()
      spread = client.get("/v1/polymarket/spread", params={"token_id": token_id}).json()
      return {"midpoint": mid["midpoint"], "spread": spread["spread"]}
  ```
</CodeGroup>

Render the board from these values. For the best bid or ask on one side, call `price` with `token_id` and `side`.

## 2. Keep it live

Subscribe to `trading` filtered by your token ids. Update the matching cell on every fill instead of polling.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Radion } from "@radion-app/sdk";

  const radion = new Radion({ apiKey: process.env.RADION_API_KEY });
  const tokenIds = ["123456789", "987654321"];

  radion.realtime.onChannel("trading", (event) => {
    const fill = event.data;
    if (fill.type !== "order_filled_v2") return;
    updateBoard(fill.tokenId, fill); // your render function
  });

  radion.realtime.subscribe({
    id: "board",
    channel: "trading",
    filters: { token_ids: tokenIds },
  });

  await radion.realtime.connect();
  ```

  ```python Python theme={null}
  import asyncio
  from radion import Radion, ChannelFilters, Subscription

  radion = Radion(api_key="YOUR_API_KEY")
  token_ids = ["123456789", "987654321"]

  @radion.realtime.on_channel("trading")
  async def on_fill(event):
      fill = event.data
      if fill["type"] != "order_filled_v2":
          return
      update_board(fill["tokenId"], fill)  # your render function

  async def main():
      await radion.realtime.subscribe(
          Subscription(id="board", channel="trading", filters=ChannelFilters(token_ids=token_ids))
      )
      await radion.realtime.connect()

  asyncio.run(main())
  ```
</CodeGroup>

## Tips

* Refresh the REST snapshot on a slow timer (say every minute) to correct any drift; let the WebSocket handle the fast updates.
* To list many markets at once, page [`/v1/polymarket/markets`](/api/overview) with `limit` and `cursor`.
* Need full depth, not just top of book? Use [`/v1/polymarket/orderbook`](/api/overview).

## Next steps

<Columns cols={2}>
  <Card title="API reference" icon="code" href="/api/overview">
    Endpoints, schemas, and query parameters.
  </Card>

  <Card title="trading channel" icon="radio" href="/websockets/channels/trading">
    Live fill payloads to drive your board.
  </Card>
</Columns>
