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

# Fills (Trades)

> The fills dataset shape, coverage, and venue-specific trade normalization rules

## Shape

A fill is one normalized trade execution. It links to a market and one of that market's outcomes.

| Field                 | Type              | Values and meaning                                                                                                                           |
| --------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                  | `UUID`            | Stable Probalytics fill ID. Generated deterministically from the venue trade or chain event.                                                 |
| `market_id`           | `UUID`            | Probalytics market ID. Join this to `markets.id`.                                                                                            |
| `market_platform_id`  | `string`          | Venue-native market identifier copied from the linked market.                                                                                |
| `platform`            | `enum`            | `POLYMARKET` or `KALSHI`.                                                                                                                    |
| `platform_id`         | `string`          | Venue-native trade, order, or execution ID. The exact source differs by product.                                                             |
| `outcome`             | `Outcome`         | Traded outcome containing `id` (UUID), `platform_id` (string), `name` (string), and zero-based `index` (integer).                            |
| `size`                | `decimal`         | Executed quantity. Prediction markets use contracts/shares; perpetual and margin products use venue instrument units.                        |
| `price`               | `decimal`         | Execution price for the stored `outcome`. Prediction-market prices are normally between `0` and `1`; perpetual prices are instrument prices. |
| `normalized_price`    | `decimal`         | Prediction markets: execution price expressed as the price of outcome index `0`. Perpetual and margin products: same value as `price`.       |
| `taker_side`          | `enum`            | `BUY` or `SELL`. The exact mapping is product-specific and documented below.                                                                 |
| `taker_cash_flow`     | `decimal`         | Positive gross/notional value assigned to the taker. It is not signed by trade direction.                                                    |
| `maker_cash_flow`     | `decimal`         | Positive gross/notional value assigned to the maker. It is not signed by trade direction.                                                    |
| `taker_id`            | `string \| null`  | Taker wallet or participant ID when exposed by the source. Currently populated for Polymarket prediction-market fills.                       |
| `maker_id`            | `string \| null`  | Maker wallet or participant ID when exposed by the source. Currently populated for Polymarket prediction-market fills.                       |
| `fee`                 | `decimal`         | Source fee amount when available. `0` is also used when the source does not expose fees.                                                     |
| `source_block_number` | `integer \| null` | Chain block containing the execution. Present for Polymarket prediction-market fills.                                                        |
| `source_tx_hash`      | `string \| null`  | Chain transaction hash when available.                                                                                                       |
| `source_log_index`    | `integer \| null` | Event position within the chain transaction.                                                                                                 |
| `timestamp`           | `datetime`        | Source execution time in UTC.                                                                                                                |
| `indexed_at`          | `datetime`        | Time Probalytics wrote the fill.                                                                                                             |
| `metadata`            | `object`          | Product-specific annotations. Values are strings, numbers, or booleans. Usually empty for prediction-market fills.                           |

## Coverage by venue and product

| Venue      | Product                  |         Fills | Coverage starts |
| ---------- | ------------------------ | ------------: | --------------- |
| Polymarket | Prediction-market trades | 1,171,916,395 | 2022-11-21      |
| Polymarket | Perpetual trades         |     9,580,526 | 2026-05-06      |
| Kalshi     | Prediction-market trades | 1,360,159,691 | 2022-01-01      |
| Kalshi     | Margin trades            |    25,225,233 | 2026-06-03      |

<sub>Counts as of 2026-08-24 17:59 UTC. Coverage starts use the earliest source `timestamp`. Prediction and perpetual/margin rows are separated using the linked market's `market_type`.</sub>

Fills are indexed continuously, so these counts change throughout the day. Query the data warehouse for current values:

```sql theme={null}
WITH market_id IN (
    SELECT id
    FROM markets FINAL
    WHERE market_type = 'PERPETUAL'
) AS is_perpetual
SELECT
    platform,
    if(is_perpetual, 'PERPETUAL', 'PREDICTION') AS product,
    count() AS fills,
    min(timestamp) AS earliest_fill
FROM fills
GROUP BY platform, product
ORDER BY platform, product;
```

## Polymarket prediction-market trades

### Source

These fills come from `OrderFilled` events emitted on Polygon by the supported CTF Exchange and Neg Risk Exchange contracts, including their V2 versions.

Legacy executions can emit two related `OrderFilled` logs. Probalytics retains the maker-focused representation instead of publishing both as separate trades.

### Field mapping

| Polymarket source                                    | Probalytics field                    |
| ---------------------------------------------------- | ------------------------------------ |
| Transaction hash + log index + taker address         | `id`                                 |
| Outcome token's linked market                        | `market_id`, `market_platform_id`    |
| Order hash                                           | `platform_id`                        |
| Outcome token ID                                     | `outcome`                            |
| Outcome-token amount ÷ `1,000,000`                   | `size`                               |
| USDC amount ÷ outcome-token amount                   | `price`                              |
| `price` for outcome index `0`; otherwise `1 - price` | `normalized_price`                   |
| Taker pays USDC                                      | `taker_side = 'BUY'`                 |
| Taker supplies outcome tokens                        | `taker_side = 'SELL'`                |
| USDC amount ÷ `1,000,000`                            | `taker_cash_flow`, `maker_cash_flow` |
| Taker and maker wallet addresses                     | `taker_id`, `maker_id`               |
| Event fee ÷ `1,000,000`                              | `fee`                                |
| Block number, transaction hash, log index            | Source provenance fields             |
| Block timestamp                                      | `timestamp`                          |

Outcome index `0` is the reverse-alphabetically first normalized market outcome. For a typical Yes/No market, Yes is index `0` and No is index `1`.

## Polymarket perpetual trades

Polymarket perpetual trades come from the perpetual product feed and link to markets with `market_type = 'PERPETUAL'`.

| Polymarket perpetual source           | Probalytics field                                           |
| ------------------------------------- | ----------------------------------------------------------- |
| Instrument ID                         | `market_id`, `market_platform_id` through the linked market |
| Trade ID                              | `id`, `platform_id`                                         |
| Synthetic Long outcome                | `outcome`                                                   |
| Quantity                              | `size`                                                      |
| Instrument price                      | `price`, `normalized_price`                                 |
| `long`                                | `taker_side = 'BUY'`                                        |
| `short`                               | `taker_side = 'SELL'`                                       |
| `size × price`                        | `taker_cash_flow`, `maker_cash_flow`                        |
| Source timestamp in milliseconds      | `timestamp`                                                 |
| Source transaction hash, when present | `metadata.tx_hash`                                          |

Participant IDs are `null`, and `fee` is `0` because the current source does not expose those values.

## Kalshi prediction-market trades

### Source

These fills come from Kalshi trade records. Each record contains the market ticker, Yes and No prices, traded count, taker side, trade ID, and execution time.

### Field mapping

| Kalshi source                        | Probalytics field                                           |
| ------------------------------------ | ----------------------------------------------------------- |
| Market ticker                        | `market_id`, `market_platform_id` through the linked market |
| Trade ID                             | `id`, `platform_id`                                         |
| `taker_side = 'yes'`                 | Yes `outcome`; `price = yes_price_dollars`                  |
| `taker_side = 'no'`                  | No `outcome`; `price = no_price_dollars`                    |
| `count_fp`                           | `size`                                                      |
| `yes_price_dollars`                  | `normalized_price`                                          |
| Every current Kalshi prediction fill | `taker_side = 'BUY'`                                        |
| `size × price`                       | `taker_cash_flow`, `maker_cash_flow`                        |
| `created_time`                       | `timestamp`                                                 |

The source's Yes/No taker side selects which outcome was bought. It does not map to the stored BUY/SELL enum, so all current Kalshi prediction fills are stored as `BUY`.

Participant IDs are `null`, and `fee` is `0` because the current trade source does not expose those values.

Kalshi `KXMVE` trades are not included in `fills` because their markets are not available to this normalization path.

## Kalshi margin trades

Kalshi margin trades come from the margin product feed and link to markets with `market_type = 'PERPETUAL'`.

| Kalshi margin source   | Probalytics field                                           |
| ---------------------- | ----------------------------------------------------------- |
| Margin ticker          | `market_id`, `market_platform_id` through the linked market |
| Trade ID               | `id`, `platform_id`                                         |
| Synthetic Long outcome | `outcome`                                                   |
| Count                  | `size`                                                      |
| Instrument price       | `price`, `normalized_price`                                 |
| `taker_side = 'bid'`   | `taker_side = 'BUY'`                                        |
| `taker_side = 'ask'`   | `taker_side = 'SELL'`                                       |
| `size × price`         | `taker_cash_flow`, `maker_cash_flow`                        |
| `created_time`         | `timestamp`                                                 |
| Product marker         | `metadata.instrument_type = 'perpetual_future'`             |

Participant IDs are `null`, and `fee` is `0` because the current source does not expose those values.

## Reading fills across products

* Join `market_id` to `markets.id` before interpreting price or size units.
* Use `price` for the stored outcome's execution price.
* Use `normalized_price` to create one outcome-0 price series for prediction markets.
* Do not treat perpetual `normalized_price` as a probability.
* Do not sum the cash-flow fields as signed P\&L; both currently store positive gross/notional values.

See [Tables & Schemas](/docs/sql-guide/tables#fills) for access-specific database types and query behavior.
