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

# polymarket_polygon.open_interest_hourly

> Polymarket hourly open interest and traded volume per market, from the first mint to resolution.

export const TableSample = ({tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

The `polymarket_polygon.open_interest_hourly` table provides hourly open interest and traded volume per Polymarket market. Grain: one row per `(hour, market_id)`, with a row for every hour from the hour the market's outcome tokens were first minted to the hour it resolves. Open interest is a level at the end of the hour; volume is the flow within it.

Open interest is the outcome token supply, rebuilt from the CTF ERC-1155 mint and burn ledger on Polygon. History starts in April 2021. It is counted **per side**. On a standalone market the Yes and No sides are equal. On a member of a mutually exclusive (neg-risk) event, they diverge once No tokens are converted: converting No tokens of one outcome mints Yes tokens of every sibling outcome without adding collateral, so the No side drops and the siblings' Yes sides grow. `event_oi_contracts` gives the collateral locked behind the whole event.

Every row is the state at the end of its hour. A decided market has no open interest, so the resolution hour reads zero and the series stops there, even though tokens are still held: losing tokens are never redeemed, and winners redeem over weeks. Redemptions are in [`polymarket_polygon.market_actions`](/data-catalog/curated/prediction-markets/polymarket/market_actions). A market that opens and resolves within one hour shows volume but no open interest.

<Note>
  Combos are not included. A combo's collateral hangs on its legs, so it doesn't add to single-market open interest.
</Note>

<Warning>
  Don't sum `market_oi_yes_contracts` across the members of an event. Because conversions mint sibling Yes tokens without collateral, the sum can overstate the money at stake several times over. Don't sum `event_oi_contracts` across members either, because it is repeated on every member row. For total open interest, take `event_oi_contracts` once per event and hour, grouping by `COALESCE(event_id, market_id)` so that each standalone market counts as its own event. The example below does this.
</Warning>

Volume is kept here rather than on the candles because summing the Yes and No candles double-counts every Yes-versus-No match. Per-token prices are in [`polymarket_polygon.ohlcv_hourly`](/data-catalog/curated/prediction-markets/polymarket/ohlcv_hourly).

## Table Schema

| Column | Type | Description |
| - | - | - |
| `block_month` | `DATE` | First day of the UTC month of `hour`. Partition key |
| `hour` | `TIMESTAMP` | UTC hour the figures describe. Open interest is the level at the end of it, volume the flow within it |
| `market_id` | `VARCHAR` | Market condition ID. Joins `polymarket_polygon.market_details` on `condition_id` and `polymarket_polygon.ohlcv_hourly` on `market_id` |
| `event_id` | `VARCHAR` | Event this market is one outcome of, when the venue groups markets into a mutually exclusive set. NULL for a standalone market |
| `market_oi_yes_contracts` | `DOUBLE` | Yes tokens outstanding at the end of the hour. Zero in the hour the market resolves |
| `market_oi_no_contracts` | `DOUBLE` | No tokens outstanding at the end of the hour. Equal to the Yes side on a standalone market. Lower on an event member whose No tokens have been converted into Yes tokens of sibling outcomes. Zero in the hour the market resolves |
| `event_oi_contracts` | `DOUBLE` | Open contracts across the undecided members of the market's event at the end of the hour: the Yes tokens of one member plus the No tokens of every other member, which is the payout whichever outcome wins. A member that resolves early drops out of the sum from its resolution hour. Equal to the Yes side on a standalone market. One contract pays 1 unit of the quote stablecoin |
| `volume_contracts` | `DOUBLE` | Outcome tokens traded in the hour, both sides together, each match counted once |
| `volume_usd` | `DOUBLE` | Cash traded in the hour in the quote stablecoin, each match counted once from the aggressor's side |
| `trade_count` | `BIGINT` | Matches in the hour, both sides together |
| `_updated_at` | `TIMESTAMP` | When this row was last written by the pipeline |

## Table sample

<TableSample tableSchema="polymarket_polygon" tableName="open_interest_hourly" />

## Query performance

`block_month` is the partition key. Always include a `block_month` or `hour` filter.

## Example query

```sql theme={null}
-- Total open interest at the end of each UTC day, last 30 days.
-- event_oi_contracts repeats on every market of an event, so take it once per event.
-- A market without an event_id is its own event.
WITH per_event AS (
  SELECT
    CAST(hour AS DATE) AS day,
    COALESCE(event_id, market_id) AS event_key,
    MAX(event_oi_contracts) AS open_interest_contracts
  FROM polymarket_polygon.open_interest_hourly
  WHERE block_month >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '30' DAY)
    AND hour >= CURRENT_DATE - INTERVAL '30' DAY
    AND HOUR(hour) = 23 -- the 23:00 row is the level at the end of the day
  GROUP BY 1, 2
)
SELECT
  day,
  SUM(open_interest_contracts) AS open_interest_contracts
FROM per_event
GROUP BY 1
ORDER BY 1
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.