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

# MarketTrade mapping

> How each upstream exchange schema maps to OpenPX MarketTrade.

*A public trade off the market tape.*

Every field is one of three entry types — **direct** (taken from upstream), **synthetic** (computed by OpenPX), or **omitted** (not exposed upstream).

## Coverage

| Exchange   | Direct | Synthetic | Omitted |
| ---------- | ------ | --------- | ------- |
| kalshi     | 7      | 2         | 1       |
| polymarket | 6      | 4         | 0       |

## Field crosswalk

| Unified field    | Type               | kalshi source                                                | polymarket source       | Notes                                                                                                                                                                                                  |
| ---------------- | ------------------ | ------------------------------------------------------------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`             | string             | `Trade.trade_id`                                             | `Trade.transactionHash` | **kalshi:** Kalshi-issued unique trade id; rows missing this are dropped at parse time. **polymarket:** Polygon transaction hash; doubles as trade id since one trade lands per tx.                    |
| `price`          | number (double)    | `Trade.yes_price_dollars`, fallback `Trade.no_price_dollars` | `Trade.price`           | **kalshi:** Yes-anchored: parsed from `yes_price_dollars` and normalized to a probability in \[0, 1]. **polymarket:** Decimal probability for the row's outcome token in \[0, 1].                      |
| `size`           | number (double)    | `Trade.count_fp`                                             | `Trade.size`            | **kalshi:** FixedPointCount string parsed to f64. **polymarket:** Non-negative size in contracts.                                                                                                      |
| `aggressor_side` | string?            | `Trade.taker_side`                                           | *synthetic*             | **kalshi:** Yes-anchored: `taker_side=yes` → buy, `taker_side=no` → sell. **polymarket:** Yes-anchored from \{Trade.side, Trade.outcome} — BUY of Yes or SELL of No → buy.                             |
| `outcome`        | string?            | *synthetic*                                                  | `Trade.outcome`         | **kalshi:** Title-cased from `taker_side` (the upstream Trade has no top-level `outcome`). **polymarket:** Outcome label as published by Polymarket.                                                   |
| `yes_price`      | number? (double)   | `Trade.yes_price_dollars`                                    | *synthetic*             | **kalshi:** Direct Yes-side reference; equal to canonical `price`. **polymarket:** Set to `Trade.price` when the row's outcome is `Yes`; null otherwise.                                               |
| `no_price`       | number? (double)   | `Trade.no_price_dollars`                                     | *synthetic*             | **kalshi:** Direct No-side reference; do not derive as `1 - yes_price` (mirror identity does not hold per trade). **polymarket:** Set to `Trade.price` when the row's outcome is `No`; null otherwise. |
| `taker_address`  | string?            | *omitted*                                                    | `Trade.proxyWallet`     | **kalshi:** Kalshi public tape exposes no wallet identifiers. **polymarket:** On-chain proxy wallet of the taker (`takerOnly=true` is hardcoded on the underlying call).                               |
| `exchange_ts`    | string (date-time) | `Trade.created_time`                                         | `Trade.timestamp`       | **kalshi:** RFC3339 string parsed to UTC. **polymarket:** Unix seconds (not milliseconds) parsed to UTC.                                                                                               |
| `openpx_ts`      | string (date-time) | *synthetic*                                                  | *synthetic*             | **kalshi:** Wall-clock UTC stamped once per page at response serialization. **polymarket:** Wall-clock UTC stamped once per page at response serialization.                                            |

## Source specs

* **kalshi** · [`schema/upstream/kalshi.openapi.yaml`](https://github.com/openpx-trade/openpx/blob/main/schema/upstream/kalshi.openapi.yaml)
* **polymarket** · [`schema/upstream/polymarket-data.openapi.yaml`](https://github.com/openpx-trade/openpx/blob/main/schema/upstream/polymarket-data.openapi.yaml)

> Tables are auto-generated from `schema/mappings/`. CI fails if any `direct` ref no longer resolves in the cached upstream spec; the daily upstream-refresh PR surfaces drift here.
