# HIP-4 Analytics API Reference

**Tier:** Dev

`GET /hip4-analytics/dashboard`

Combined HIP-4 prediction market dashboard payload — nested summary metrics, per-outcome and per-coin breakdowns, trading and settlement timeseries, and stacked chart data for the requested range. Responses use cached analytics snapshots.

---

## Authentication

Requires Dev tier or higher. Free tier does not have access (returns 403).

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `range` | string | No | `4h`, `1d`, `7d`, `30d`, or `all`. Defaults to `1d`. Legacy `period` remains supported as a compatibility alias. |
| `venue` | string | No | Restrict every metric and breakdown to one stored HIP-4 venue: `out` for Outcome.xyz or `skew` for Skew Markets. Omit it for totals across all deployers. |
| `view` | string | No | `full` (default, unchanged response), `charts` (summary and all chart series), `summary` (summary and aggregate trading/settlement series), or `markets` (selected market statistics). Small views return only the requested sections. |
| `outcome_ids` | string | No | For `view=markets`, comma-separated nonnegative outcome IDs, maximum 200. Omit to page through the market index. |
| `offset` | integer | No | For indexed `view=markets` requests, the zero-based starting offset. Defaults to `0`. |
| `limit` | integer | No | Indexed market page size, from `1` to `200`. Defaults to `100`. |

### Small responses

Use `view=summary` for venue comparison charts and `view=charts` for the main analytics charts. Both return empty market table arrays rather than the full archive. Metric totals and series retain their full requested-range meaning.

Use `view=markets&outcome_ids=42,43` for individual cards. This returns `by_outcome`, `by_coin`, and `settlement_by_outcome` for those IDs, excluding the nested per-row `trade_mechanics` and `lifecycle_mechanics`. The default full response continues to include those details.

Without `outcome_ids`, market responses include `total_markets` and `next_offset`; `next_offset` is `null` after the last page. Market pages are ordered by outcome ID. Small views return `503` when no warmed snapshot is available and never start an on-demand historical computation.

## Example request

```bash
curl -H "X-Api-Key: lk_live_your_key_here" \
  "https://api.loris.tools/hip4-analytics/dashboard?range=1d&venue=skew"
```

## Count semantics

Trading objects under `summary`, `by_outcome`, `by_coin`, and `timeseries` use the same count definitions:

| Field | Meaning |
|------|---------|
| `trade_count` | Atomic matched executions. One crossed Buy/Sell participant identifies one match, including when one match produces multiple outcome-leg records. |
| `protocol_trade_count` | Distinct outcome-leg records, deduplicated by `(block_number, coin, tid)`. |
| `orderbook_fill_count` | Raw Buy/Sell rows. |
| `fill_count` | All raw non-settlement rows, including Buy/Sell rows and manual Split/Merge lifecycle rows. |

`trade_mechanics` breaks order-book activity into `standard`, `split`, `merge`, and `other`. Each entry contains `trade_count`, `protocol_trade_count`, `fill_count`, `volume`, and `total_fees`. These labels classify observed execution shapes: Buy+Sell, Buy-only, Sell-only, or another shape. They do not assert an officially documented matching implementation.

`lifecycle_mechanics` is separate from order-book matching. Its `split` and `merge` entries count explicit manual lifecycle operations and their raw fill rows; `other_fill_count` covers remaining non-settlement lifecycle rows.

## Example response

```json
{
  "success": true,
  "range": "1d",
  "period": "1d",
  "venue": "skew",
  "computed_through_ms": 1788221100000,
  "summary": {
    "volume": 82000000,
    "fill_count": 50200,
    "orderbook_fill_count": 49600,
    "trade_count": 24800,
    "protocol_trade_count": 36200,
    "unique_traders": 2840,
    "total_fees": 41000,
    "liquidation_count": 0,
    "total_priority_gas": 0,
    "priority_gas_usdc": 0,
    "priority_gas_usdh": 0,
    "trade_mechanics": {
      "standard": { "trade_count": 13400, "protocol_trade_count": 13400, "fill_count": 26800, "volume": 44000000, "total_fees": 22000 },
      "split": { "trade_count": 6200, "protocol_trade_count": 12400, "fill_count": 12400, "volume": 21000000, "total_fees": 10500 },
      "merge": { "trade_count": 5200, "protocol_trade_count": 10400, "fill_count": 10400, "volume": 17000000, "total_fees": 8500 },
      "other": { "trade_count": 0, "protocol_trade_count": 0, "fill_count": 0, "volume": 0, "total_fees": 0 }
    },
    "lifecycle_mechanics": {
      "split": { "operation_count": 180, "fill_count": 360 },
      "merge": { "operation_count": 120, "fill_count": 240 },
      "other_fill_count": 0
    }
  },
  "by_outcome": [
    { "outcome_id": 42, "volume": 12000000, "trade_count": 3800, "protocol_trade_count": 5400, "orderbook_fill_count": 7600, "fill_count": 7680 }
  ],
  "by_coin": [
    { "coin": "#420", "encoding": 420, "outcome_id": 42, "outcome_side": 0, "volume": 6600000, "trade_count": 2100, "protocol_trade_count": 2900, "orderbook_fill_count": 4200, "fill_count": 4240 }
  ],
  "timeseries": [
    { "date": "2026-06-08T00:00:00", "volume": 82000000, "trade_count": 24800, "protocol_trade_count": 36200, "orderbook_fill_count": 49600, "fill_count": 50200 }
  ],
  "settlement_total": { "volume": 1800000, "fill_count": 920, "trade_count": 0, "unique_traders": 710, "total_fees": 0 },
  "settlement_by_outcome": [],
  "settlement_timeseries": []
}
```

Entries in `by_outcome`, `by_coin`, and trading `timeseries` also include the full `trade_mechanics` and `lifecycle_mechanics` objects. In `by_coin`, a manual lifecycle operation is counted for every outcome leg it touches, so `lifecycle_mechanics.*.operation_count` is not additive across coins. The payload additionally returns `timeseries_stacked*` and `settlement_timeseries_stacked*` fields for chart rendering; `timeseries_stacked_by_metric.protocol_trade_count` contains the outcome-side trade series.

## Errors

- `400` — Invalid venue, view, market IDs, offset, or limit.
- `503` — A small view has no warmed snapshot available yet. Retry shortly.

## Related

- [Live HIP-4 Dashboard](/hip4)
- [Trader Leaderboard](/docs/api/hip4-analytics/leaderboard)
- [Outcome Detail](/docs/api/hip4-analytics/outcome-detail)
- [Outcome Metadata](/docs/api/hip4-analytics/outcome-meta)
- [EOD OI](/docs/api/hip4-analytics/oi-eod)
