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

# Position Metrics

> Stream OHLC, volume, and probability metrics for individual outcome positions.

<Note>
  **Room ID:** `polymarket_position_metrics` \
  **Endpoint:** `wss://api.struct.to/ws` \
  **Rate:** 0.025 credits per message
</Note>

Stream OHLC, volume, and probability metrics for individual outcome positions. Updates are pushed whenever position-level metrics change within the tracked timeframe windows.

<Tip>
  **Related guide:** [TradingView charts for Polymarket](/guides/tradingview-charts) uses this room for server-aggregated OHLC and probability bars.
</Tip>

## Subscribe

The `position_ids` filter is required. You may optionally specify `timeframes` to limit which windows you receive. A maximum of 100 filters is allowed per client.

### Filters

| Filter          | Type       | Required | Description                                                                                                              |
| --------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
| `position_ids`  | `string[]` | Yes      | Outcome token IDs to track                                                                                               |
| `timeframes`    | `string[]` | No       | Timeframe windows to receive updates for                                                                                 |
| `subscribe_all` | `boolean`  | No       | Firehose: receive metrics for every position. `position_ids` are ignored when set; the `timeframes` filter still applies |

### Example

```json theme={null}
{
  "type": "join_room",
  "payload": {
    "room_id": "polymarket_position_metrics"
  }
}
```

```json theme={null}
{
  "type": "room_message",
  "payload": {
    "room_id": "polymarket_position_metrics",
    "message": {
      "action": "subscribe",
      "position_ids": ["12345"]
    }
  }
}
```

### Response

```json theme={null}
{
  "type": "position_metrics_stream_subscribe_response",
  "room_id": "polymarket_position_metrics",
  "data": {
    "position_ids": ["12345"],
    "timeframes": [],
    "rejected": []
  }
}
```

## Events

### `position_metrics_update`

<Info>
  **Volume on Polymarket vs. Struct.** Polymarket's UI reports "volume" as notional (the count of shares or contracts traded), which corresponds to `shares_volume` in Struct payloads. `usd_volume` is the dollar value of those trades. Use `shares_volume` to match figures shown on Polymarket and `usd_volume` for true USD throughput.
</Info>

USD and shares volumes are decimal strings to preserve precision. Builder-attributed fields cover the subset of activity routed through builder-signed orders, with separate buy and sell breakdowns.

```json theme={null}
{
  "type": "position_metrics_update",
  "room_id": "polymarket_position_metrics",
  "data": {
    "condition_id": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "position_id": "12345678901234567",
    "outcome": "Yes",
    "outcome_index": 0,
    "timeframe": "1h",
    "timestamp": 1743500000,
    "usd_volume": "45000.00",
    "usd_buy_volume": "28000.00",
    "usd_sell_volume": "17000.00",
    "shares_volume": "69200.00",
    "shares_buy_volume": "43000.00",
    "shares_sell_volume": "26200.00",
    "builder_usd_volume": "11000.00",
    "builder_usd_buy_volume": "7000.00",
    "builder_usd_sell_volume": "4000.00",
    "builder_shares_volume": "16900.00",
    "builder_shares_buy_volume": "10700.00",
    "builder_shares_sell_volume": "6200.00",
    "fees": 90.0,
    "builder_fees": 22.0,
    "txns": 120,
    "buys": 80,
    "sells": 40,
    "builder_txns": 30,
    "builder_buys": 20,
    "builder_sells": 10,
    "unique_traders": 35,
    "unique_builder_traders": 9,
    "price_open": 0.62,
    "price_close": 0.65,
    "price_high": 0.67,
    "price_low": 0.60,
    "probability_open": 0.62,
    "probability_close": 0.65,
    "probability_high": 0.67,
    "probability_low": 0.60,
    "avg_trade_shares": 576.67,
    "avg_buy_shares": 537.5,
    "avg_sell_shares": 655.0
  }
}
```

<Note>
  **`price_*` and `probability_*` are different series.** `price_*` tracks the outcome token you're looking at (filter: `min_price_change_pct`); `probability_*` always tracks the Yes/Up token, index `0` (filter: `min_probability_change_pct`). They agree on the Yes side; on the No side they are complements (a `price` of `0.40` is a `probability` of `0.60`).
</Note>
