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

# Execution contract

> What the simulator models when it fills an order, how, with which defaults, and what it does not model. Versioned and dated.

# Execution contract

This page states how a simulated order is filled on PolySimulator: which data
it is filled against, when, at which price, with which costs, and what the
simulator does not model. It answers the questions a developer needs settled
before trusting a simulated fill. It is not a performance promise.

PolySimulator never sends your orders to Polymarket. A simulated fill says what
our model decided against our copy of Polymarket's public data at that moment.
It does not say what Polymarket would have done with a real order.

> [!NOTE]
>
> **Version 1.0, dated 2026-11-19.** Checked against the code on our
> pre-release line (`staging` at commit `6c13694345`, 2026-11-19).
> Production runs an older code line until the 2.0 release on
> **24 November 2026**. Where production differs, this page says so.
> Every measured number carries its source, its vantage point and its date.
> Numbers age; the [change log](#change-log) at the bottom records every revision.

**How to read the status labels on this page:**

| Label | Meaning |
| - | - |
| **Live** | Running in production today |
| **In 2.0 (24.11)** | In the code that ships on 24 November 2026; the default state is stated next to it |
| **Planned, from \<date>** | Not available. The date is our current estimate, not a commitment; this page changes when it ships |

***

## The eight questions, answered

| # | Question | Short answer | Section |
| - | - | - | - |
| 1 | What feeds the matcher? | Our copy of Polymarket's order books, built from Polymarket's public WebSocket and checked against its REST books, stored in Redis | [Data path](#1-data-path-and-latency) |
| 2 | When does a book count as stale, and what happens then? | The standard code default is 2,000 ms. In-play-aware paths use 750 ms; synchronous pending-order execution uses the standard threshold for its fill decision. From 2.0, refresh fallbacks are capped at 60 s (10 s on fast markets) and crossed books are refused | [Stale books](#stale-books) |
| 3 | How do marketable orders walk the book? | Best price first, level by level, across the outcome's book and the mirrored levels of its complement, within your limit | [Book walk](#31-book-walk-for-marketable-orders) |
| 4 | How are resting orders matched, and how often? | A background matcher evaluates up to 2,000 resting orders per cycle by default. In production it pauses 0.15 s after each cycle. A resting order can fill when the book crosses its limit. Queue position is not modelled | [Matching](#2-matching) |
| 5 | What is not modelled yet? | Queue position, the venue's taker delay (off by default), cancel latency, maker rebates, permanent price impact, per-account depletion | [Known differences](#5-known-differences-from-polymarket) |
| 6 | How does taken liquidity come back? | For eligible depth walks, depletion is shared. Where applied in production, it clears on a new snapshot. In 2.0 the default is 2,000 ms after the last consumption | [Depletion](#34-depletion-how-taken-liquidity-comes-back) |
| 7 | How does rounding work? | Prices and shares use up to 4 decimals. Live fees are calculated once per fill. From 2.0, book walks round each level's fee to 5 decimals before summing and settling to cents. Cash generally rounds half-up to cents | [Rounding](#36-rounding) |
| 8 | Which stream reports which fills? | Resting and fill-on-placement fills stream live. Immediate IOC/FAK/FOK fills are in the order response and can appear in native reconnect replay. From 2.0, `order.filled` webhooks cover both | [Streams](#37-which-stream-reports-which-fills) |

***

## 1. Data path and latency

### What feeds the matcher

```
Polymarket matching engine
  -> Polymarket public WebSocket, received in London [Polymarket's delivery]
  -> our ingest service (Rust) receives the frame  [socket receipt]
  -> book rebuilt, written to Redis                [our ingest]
  -> fill decision:
       marketable order  -> at placement, reads the book in Redis
       resting order     -> matcher cycle, reads or reuses the book for that cycle
  -> ledger write in Postgres, then the API response, streams and webhooks
```

* **Source.** Market identity and fee metadata come from Polymarket's Gamma
  API. Order books come from Polymarket's CLOB WebSocket. Our ingest checks the
  streamed books against Polymarket's REST books and repairs a book that has
  drifted.
* **Coalescing.** Our ingest writes a changed book to Redis at most once per
  100 ms per book in production (setting since 2026-11-13). On a busy book,
  intermediate states that last less than that are never seen by the matcher.
* **Which book a fill used.** The placement path reads the cached book when
  pricing the order. The matcher can reuse a token's top-of-book prices and
  depth across orders in the same cycle, so a later order can see the book read
  for an earlier order. Fast-market freshness checks and the book-integrity
  gate re-read Redis for the fill decision. Paths that refresh a stale book
  can fetch it from Polymarket's REST API. See [Stale books](#stale-books).

### Measured delays

All numbers are in milliseconds, as p50 / p95 (or p90) / p99. They were
measured **inside our system, before the API and your network**, unless the
row says otherwise. They are not what you will see from your own machine,
which adds your network and our API.

| Stage | Vantage and window | Measured | Source, date |
| - | - | - | - |
| Polymarket event → our socket (Polymarket's delivery, which a direct Polymarket client in London also pays) | Production ingest, London, raw histogram | p50 ≤ 5, p90 ≤ 10–25, p99 ≤ 250, p99.9 ≤ 500 (histogram bucket bounds) | Ingest metrics, 2026-11-09 |
| Our socket → book in Redis | Production, last 6 h | 158 / p95 390 / p99 479 | Ingest histogram, 2026-11-19 \~15:30 UTC |
| Our socket → book in Redis | Pre-release (staging), last 6 h | 53 / p95 134 / p99 147 | Ingest histogram, 2026-11-19 \~15:30 UTC |
| Our socket → book in Redis | Pre-release, with a dedicated market-data Redis and 50 ms writes (one test window) | 42 / p95 73; 99% within 100 | Prometheus, 2026-11-19 |
| For comparison: October, before the Rust ingest (REST polled twice a second) | Production | median \~500 by design; p90 230–1,400; max 2,300–4,300 | Book-lag probe, 2026-10-22 |
| `GET /v1/book`, server time only | Production, 1 h | 22 / p90 89 / p99 228 | API request metrics, 2026-11-13 |
| Web UI stream flush, Python broadcaster | Code default | every 150 ms | `SSE_BROADCAST_INTERVAL_MS` |
| Web UI stream flush, Rust canonical publisher | Code default | every 250 ms | `RUST_SSE_FLUSH_MS` |

Rust can also flush books for actively watched markets on a separate,
configurable interval (`RUST_SSE_WATCH_FLUSH_MS` with API viewer tracking).
That path is off by default. These intervals describe server-side batching.

Book age measures how old the input book was when the simulator used it for
pricing. Order-to-fill latency measures the time from order receipt to fill
and includes order handling, any matcher wait and settlement. To include
notification delivery in your measurement, time from submission to receipt
of the response or fill event on your client.

**What we expect after launch (estimates, not measurements).** These are
projections from the pre-release measurements and a production-scale lab run
on 2026-11-18, not measurements.

| Change | From (estimate) | Socket → book in Redis, production |
| - | - | - |
| 2.0 release (lower Redis load) | 2026-11-24 | \~120–150 / p95 \~300 / p99 \~450 |
| Dedicated market-data Redis, then 50 ms writes | 2026-11-25 to 26 | \~50–70 / p95 \~100–150 / p99 \~150–300 |

Polymarket's own delivery tail (up to \~250 ms at p99 in London) reaches a direct
Polymarket client in the same way it reaches our ingest. It is therefore not
part of the gap between a direct Polymarket client and PolySimulator, but it
sets a floor on how fresh any copy of the book can be.

### Stale books

A book's age is measured from when our system stored it.

| Situation | What happens | Default |
| - | - | - |
| Cached book older than the freshness threshold | On paths that refresh, treated as a miss and fetched from Polymarket's REST API (0.5 s timeout, at most 2 attempts) | See fill-time defaults below |
| Fresh fetch fails | The stale cached book may still be used as a fallback. Production before 24.11 has no maximum age for this fallback; from 2.0 there is one | 2.0: 60 s; 10 s on fast markets |
| From 2.0: fallback book too old, crossed (best bid ≥ best ask), or undatable on a fast market | The book is refused. The order outcome depends on the execution path | — |
| Optional quote-age limit on the account path | Rejected with `STALE_QUOTE` | off (`0`) |

The fill-time thresholds below are code defaults. Deployments can override
them.

| Execution path | Standard threshold | In-play threshold | How it is used |
| - | - | - | - |
| Account and direct-wallet market FOK book resolver | 2,000 ms | 750 ms | Triggers a refresh and sets the default age budget for selecting a price |
| Background matcher | 2,000 ms | 750 ms | Checks the book before deciding a fill |
| GTC/GTD fill on placement | 2,000 ms | 750 ms | Normally uses the cached book. If it is too old, the order rests. An optional fast-market refresh can fetch a fresh book |
| Synchronous pending-order execution (IOC/FAK/FOK) | 2,000 ms | 2,000 ms | The fill decision uses the standard threshold even for in-play markets. A separate placement prewarm can still use the in-play threshold |

The optional fast-market refresh threshold can tighten the default on
eligible Up/Down markets. It is off by default and separate from the
10 s fallback limit.

In 2.0 a synchronous market executor can also return
`VWAP_EXCEEDS_SANITY_BAND` when a walk lands too far from the reference price.
See [Execution Internals](https://docs.polysimulator.com/trading/execution-internals.md#sanity-guards).

An accepted resting order can stay pending when a book is refused. The
matcher's price sanity check can cancel a resting order after 60 consecutive
failures by default, and cancels an immediate order it is evaluating on the
first such failure. In both cases the order has status `CANCELLED` with
`cancelled_reason: stale_or_mismatched_book`. Synchronous IOC/FAK orders that
find no usable price can also return a successful HTTP response with
`CANCELLED` status and a reason for the failed attempt.

### No executable depth

| Execution path | Outcome when a fill needs depth and none can be used |
| - | - |
| Account or direct-wallet market FOK | HTTP 400 `NO_EXECUTABLE_DEPTH` can come from the depth requirement when the resolver found a book but returned a substitute price. A non-Up/Down prop-firm fill requires depth even on a cache miss. With the 2.0 book-integrity gate enabled, proven absence of liquidity on the order's side in both books returns `INSUFFICIENT_LIQUIDITY`, and books that cannot establish usable depth can return `STALE_QUOTE`. A valid walk that cannot fill the required size can also return `INSUFFICIENT_LIQUIDITY` |
| Synchronous pending-order execution (IOC/FAK/FOK) | Successful placement response with status `CANCELLED` when the order cannot fill. Inspect `cancelled_reason`, for example `depth_required`, `book_depleted`, `no_book_price`, or `fok_insufficient_depth` |
| Background matcher | Resting GTC/GTD orders skip the cycle and remain pending when the depth requirement blocks a fill. Immediate IOC/FAK/FOK orders cancel |

With the integrity gate off, the general depth requirement exempts Up/Down
markets. On account and sandbox market-FOK paths, a cache miss can still fall
through to other price sources if their own guards allow it.

***

## 2. Matching

### Marketable orders: decided at placement

**Live.** A market order (FAK/IOC by default, or FOK) is filled in its own
request against the book in Redis. A GTC/GTD limit order that is marketable
when placed is also filled in its request ("fill on placement", switched on in
production since 2026-09-03; the code default is off). If fill on placement
skips an order, for example because less than 2 s of the request deadline is
left, the order rests and the matcher picks it up.

### Resting orders: decided in cycles

**Live.** A background matcher loads pending orders and schedules up to
2,000 resting GTC/GTD orders per cycle by default. It rotates across markets
and continues through each market's backlog on later cycles. Pending
IOC/FAK/FOK orders are evaluated first and are outside the resting-order cap.

A BUY can fill when the best executable ask is at or below its limit. A SELL
can fill when the best executable bid is at or above its limit. A last-trade
print alone does not trigger a fill.

Under Polymarket v2 order semantics, fills classified as maker fills use the
order's own limit. An order that was marketable at placement can reach the
matcher later and still receive taker pricing at the touch or depth-walk VWAP.
When marketability at placement is unknown, the matcher falls back to its
order-age and taker-intent rules.

| Setting | Value | Source |
| - | - | - |
| Resting orders evaluated per cycle | Up to 2,000 by default | `MATCHING_MAX_ORDERS_PER_CYCLE` |
| Pause after each cycle | 0.15 s in production; code default 1.0 s, allowed range 0.1–5.0 s | `MATCH_INTERVAL_SECONDS`; production setting recorded 2026-10-11 |
| Cycle work | p50 98 / p90 219 / p99 248 ms; 3.74 cycles/s | Production matcher metrics, 30 min, 2026-11-13 |
| Cycle work (second measurement) | p50 163 / p99 419 ms; period \~309 ms | Event-driven matching design measurements, production, 2026-11-13 |
| Estimated wait from a book change to a resting order's next evaluation, without a backlog | mean \~134–250 ms; tail \~700 ms | Derived from the two rows above |

### Event-driven matching

**Planned, production from 2026-11-25 (estimate).** The matcher is woken when a
book that has resting orders on it changes, instead of waiting for the next
cycle. Expected effect: a decision within ≤ 50 ms of the book change at the
median; the p99 stays bounded by a cycle already running (\~400 ms). The part
that records which books have resting orders is in the code but switched off
(`MATCHING_RESTING_INDEX_ENABLED=false`); the part that wakes the matcher is
not merged yet.

### The Redis matching engine

**Planned. Shadow mode from 2026-11-25; live for Up/Down markets first, from
early December 2026 (estimate).** A new engine decides each fill inside Redis,
in one atomic step that claims the order and records the depth it used, and
writes the result to Postgres right after. Measured on a design spike
(2026-11-19): the decision step takes \~2–7 ms at p50, against \~200–250 ms for
today's cycle. Rollout runs in shadow first: the engine decides alongside
today's matcher and its decisions are compared before it decides any real
fill. The planned queue model, refill curve and private depletion use this engine.

***

## 3. Fills

### 3.1 Book walk for marketable orders

**Live.** A BUY consumes asks from the lowest price upward; a SELL consumes
bids from the highest price downward. The walk stops at your limit price, or
at the worst price you allow on a market order, and never fills a level past
it. FOK fills the full size or nothing. FAK/IOC fills what is available and
cancels the rest. The average price of the walk is your fill price.

**Mirrored levels.** In a binary market, a bid for one outcome at price `p` is
also an offer of the other outcome at `1 − p`. The walk therefore merges the
outcome's own book with the mirrored levels of its complement. Where both
books show the same effective price, the larger of the two sizes is used, not
the sum, because they are usually the same resting orders seen from two sides.

See [Execution Internals](https://docs.polysimulator.com/trading/execution-internals.md) for the fallback
price sources and the sanity checks on the walk.

### 3.2 Fees

**Live** (formula and maker/taker split); **in 2.0 (24.11)** (per-market
rates). Takers pay a fee and makers pay none:

```
fee = shares × feeRate × [price × (1 − price)]^exponent
```

* **From 2.0 (24.11):** `feeRate` and `exponent` come from each market's Gamma
  `feeSchedule` (`feesEnabled: false` means no fee). Our copy of the schedules
  refreshes about every 30 s for Up/Down markets and about every 30–40 minutes
  for the rest of the catalogue, so a venue change can take up to about 70
  minutes to reach every market. A category table is used only when a market
  has no fee metadata. See [Trading Fees](https://docs.polysimulator.com/trading/fees.md).
* **Production before 24.11:** rates come from a fixed table by market
  category (crypto 7%, sports 3%, finance / politics / mentions / tech 4%,
  economics / culture / weather / other 5%, geopolitics 0%), not from each
  market's schedule.
* Polymarket changes its fee rates on **2026-11-20 at 23:59 UTC**. From then
  until the 2.0 release, production charges the old category rates, which
  differ from Polymarket's new ones on most categories. From 2.0 the new
  per-market rates arrive through Gamma; the fallback category table can still
  lag until it is updated.
* A GTC/GTD order that was marketable when placed pays the taker fee, including
  on later fills of its remainder.
* From 2.0, placing an order with a signed fee quote (the web trade panel)
  can return `409 FEE_CHANGED` if the fee at placement would exceed the quote.
  An accepted resting order stores a fee ceiling. If the fee later rises
  above that ceiling, the matcher caps the fee on each fill.
* Maker rebates and liquidity rewards are **not** credited. `/v1/fee-rate`
  reports the market's `rebate_rate` for reference only.

### 3.3 Taker delay

**In 2.0 (24.11), off by default.** Polymarket holds taker orders on some
markets (flagged `itode`, mainly fast crypto markets) before matching them.
The simulator can apply the same kind of hold:

| Setting | Default | Notes |
| - | - | - |
| `SIM_TAKER_DELAY_ENABLED` | off | Deployment switch, not per account |
| `SIM_TAKER_DELAY_MS` | 150 ms (range 0–2,000) | Polymarket exposes only the `itode` flag, not the duration. Its documentation has given 250 ms, then 50 ms (17.08.2026), then 150 ms (04.09.2026) for crypto markets |
| Which markets | Polymarket's `itode` flag per market (cached 1 h); if the lookup fails, 5- and 15-minute crypto Up/Down markets | |

The hold applies to marketable orders, before pricing. Orders that genuinely
rest are not deliberately delayed. If the request has too little time left for
the hold, the order is refused with `503 SERVER_BUSY` and `Retry-After: 1` instead of shortening the
hold. With the switch off, which is the state on launch day, **marketable orders
are not held**. On flagged markets that makes them faster than the same order
on Polymarket.

### 3.4 Depletion: how taken liquidity comes back

**Live** (per-snapshot); **in 2.0 (24.11)** (2 s window). Polymarket never
sees a simulated fill, so its book does not shrink when you trade. The
simulator keeps its own record of what simulated fills took:

* **Production before 24.11:** the matcher and synchronous pending-order
  executors that use its depth walk with Polymarket v2 order semantics share
  a per-snapshot depletion record. A new snapshot for that outcome restores
  the full displayed size. The separate account and direct-wallet market FOK
  executors use a book walk without this per-snapshot depletion.
* **From 2.0 (24.11):** the default depletion window is **2,000 ms** after the
  last consumption at the level (`BOOK_DEPLETION_HOLD_MS`), including on the
  separate market FOK paths when Polymarket v2 order semantics are enabled.
  Each new recorded consumption restarts the window. Book updates leave
  the window intact. Setting the hold to zero selects per-snapshot depletion
  on the matcher depth-walk path and disables it on the separate market FOK
  paths.
* The record is **shared by all accounts** on one deployment: what one user
  took is unavailable to the next user while it is withheld.
* The record is kept **per outcome token**. See the known double-fill below.

**Known issue: the mirror double-fill (live today).** Consuming the Up ask at
`p` records the consumption on the Up book only. The same liquidity, shown as
the Down bid at `1 − p`, is not marked as taken, so the next walk can offer it
again at the same effective price. Displayed liquidity on a binary market can
therefore be filled up to twice while it is withheld. The Redis matching engine
fixes this with one liquidity record shared by both views of a level, as its
default when it goes live (early December 2026, estimate). The current matcher
will not be patched.

**Planned, from early December 2026 (estimate), with the Redis engine:**

* **Private depletion by default.** What you take reduces only the book that
  you see. Your fills then do not depend on other users' activity. Shared
  depletion will be available only inside a named session, such as a
  tournament.
* **A refill curve instead of the fixed window.** Liquidity comes back
  gradually, along a curve measured on Polymarket's books. Live book updates
  do not cancel the deficit you caused.

Calibrated refill defaults (research measurement on BTC Up/Down books,
14–18 October 2026, curves fitted 2026-11-19):

| Market family | Share of the taken size still missing after 0.25 / 0.5 / 1 / 2 / 5 / 10 / 30 s |
| - | - |
| BTC 5-minute (default curve) | 0.60 / 0.46 / 0.37 / 0.28 / 0.15 / 0.08 / 0.05 |
| BTC 5-minute, optimistic bound | 0.49 / 0.45 / 0.38 / 0.28 / 0.15 / 0.11 / 0.08 |
| BTC 15-minute (tentative, 2 data points) | 0.81 / 0.69 / 0.54 / 0.41 / 0.24 / 0.13 / 0.06 |
| All other families | not measured; the BTC 15-minute curve is used and the fill is labelled `refill_curve=fallback` |

The curves were measured only on best levels that a real taker emptied. They
have not been measured for partial consumption, deeper levels or other market
families, and the tail beyond 30 s is an assumption (60 s decay). For
comparison, the fixed 2 s window in 2.0 withholds all of the taken size for 2 s,
while about half of real emptied BTC 5-minute levels are back within 0.4 s and
about 28% are still not fully back after 2 s.

### 3.5 Queue position

**Not modelled today (live behaviour is "cross only").** A resting order fills
as soon as the book crosses its limit, regardless of how much size was ahead
of it at that price. In fast markets this tends to fill makers too late. At
the touch in slow markets it tends to fill them too early and too often.

**Planned, from early December 2026 (estimate), with the Redis engine.**
We plan to estimate the size ahead of resting orders from Polymarket's public
book updates and trade prints. Polymarket's public book shows aggregate size
at each price, so queue position can only be estimated.

### 3.6 Rounding

Price, share and cash rounding are **live**. Per-level fee rounding for
book-walk fills is **in 2.0 (24.11)**.

| Quantity | Precision | Rule |
| - | - | - |
| Price | 4 decimals; tick sizes 0.1 / 0.01 / 0.001 / 0.0001 per market | Off-grid limits are rejected (`INVALID_ORDER_MIN_TICK_SIZE`) |
| Shares | 4 decimals | Matcher fills round half-up; a USD `amount` converts to shares rounded down; available depth rounds down |
| Fee (**live before 24.11**) | 5 decimals per fill, then cents | Compute one fee from the total fill quantity and average fill price. Round half-up to 5 decimals and then to cents |
| Fee (**in 2.0 (24.11)**) | 5 decimals per level, then cents per fill | For fills with a breakdown by book level, compute and round each level's fee half-up to 5 decimals, sum the rounded fees, then round the total half-up to cents. For example, two raw fees of 0.002496 USD each round to 0.00250 USD, then their 0.00500 USD total settles as 0.01 USD. Fills without a breakdown still compute one fee from the total quantity and fill price |
| Cash (notional) | cents | Half-up by default. When a fill touches a position lot created or increased by splitting collateral into outcome shares, BUY notional rounds up and SELL notional rounds down. Mirrored book levels follow the same rounding rule as primary levels |

Prices, sizes and balances are sent as JSON strings; see
[String Numerics](https://docs.polysimulator.com/concepts/string-numerics.md).

### 3.7 Which stream reports which fills

**Live.**

| Fill type | `POST /v1/orders` response | Native `/v1/ws/executions` | PM-compatible `/v1/ws/user` | `order.filled` webhook (from 2.0, Plus) |
| - | - | - | - | - |
| IOC / FAK / FOK filled immediately | yes | eligible for reconnect replay, live push off by default | live push off by default | yes |
| GTC / GTD filled on placement | yes | live and eligible for replay | live on subscribed markets | yes |
| Resting order filled by the matcher | returned as resting | live and eligible for replay | live on subscribed markets | yes |

The native feed offers at-least-once delivery and replays up to 50 fills
newer than the reconnect watermark, including persisted immediate fills.
The PM-compatible feed sends live `trade` frames on subscribed markets and
has no reconnect replay. Deployments can enable live delivery on both feeds
for synchronous fills through the pending-order executor. Both live feeds
omit the fee. Read it from
`GET /v1/orders` or account history. See [Execution Feed](https://docs.polysimulator.com/websockets/execution-feed.md),
[PM-Compatible WebSocket](https://docs.polysimulator.com/websockets/pm-compat-market.md), and [Webhooks](https://docs.polysimulator.com/webhooks.md).

***

## 4. Fill-quality fields

### Today (live)

Returned on a FILLED order in the `POST /v1/orders` response (`OrderResponse`).
The quality fields are filled when the fill came from a book walk. They can be
empty otherwise.

| Field | Meaning | Stored with the fill? |
| - | - | - |
| `price_source` | Which source priced the fill (`book_walk`, `best_ask`, `best_bid`, ...; see [Execution Internals](https://docs.polysimulator.com/trading/execution-internals.md#price-source-tracking)) | yes; matcher fills are stored as `matching_engine` |
| `quote_age_ms` | Reported book or quote age in ms. See the source-specific rules below | Response-only for market IOC/FAK book walks. Market FOK executors store it as `price_age_ms` when available. Matcher fills leave `price_age_ms` empty |
| `spread_bps` | (ask − bid) / mid × 10,000 on the merged book | no |
| `impact_bps` | How much worse the fill was than the touch | no |
| `book_walk_levels` | Number of price levels the walk consumed | no |
| `slippage_bps` | Limit orders use their limit. Market IOC/FAK and API-wallet market FOK use the displayed outcome price. Direct-wallet market FOK (SANDBOX or PROP\_FIRM) uses the absolute distance from the submitted worst-price limit (`price`), so price improvement can produce a positive value | No |
| `fill_source` | Which path filled the order | no |
| `fee` | Fee charged, settled to the cent | yes |

For market IOC/FAK book walks, `quote_age_ms` measures elapsed time since
the stalest consumed book was cached. It is empty when the age of a
consumed book is unknown. On market FOK, read it alongside `price_source`:

* An on-demand REST refresh or live midpoint can report `0` by convention.
* A source tagged `:ws_live_unchanged` can report `0` when the resolver
  accepts an older quote as unchanged on a quiet market with the CLOB
  WebSocket connected. The original cache timestamp can be older.
* On the legacy direct-wallet cached-price path, used when book walking is
  disabled and fallback pricing is allowed, the field measures Redis
  fetch duration.

`GET /v1/account/history` returns `fee`, `price_source` and any stored
`price_age_ms`. For IOC/FAK quote age, retain the original placement
response. Maker/taker liquidity is not reported per fill today.

### Planned, from early December 2026 (estimate)

A stored **fill receipt** for every fill, on every tier, with:

* order received time, decision time and fill time (UTC, ms);
* the book used: source (stream / REST-verified / upstream), the Polymarket
  timestamp of its last update, its age at decision, and a hash of its top
  levels;
* the levels consumed (price, size), the average price, the fee and the fee
  rule applied;
* liquidity already taken at those levels by earlier simulated fills;
* for resting orders: the size ahead when the order joined, and the queue wait;
* maker or taker;
* markouts at 1, 10 and 60 s, and shortfall against the mid on arrival.

With a receipt, anyone who records Polymarket's public feed can check a single
fill against their own recording.

***

## 5. Known differences from Polymarket

* PolySimulator does not send orders to Polymarket. Nobody trades against you,
  and Polymarket's book never reacts to your orders.
* Queue position is not modelled. Resting orders fill when the book crosses
  them (section 3.5).
* Resting orders are decided in cycles, not on every book change (section 2).
* Our copy of the book is behind Polymarket's by the delays in section 1, and
  short-lived book states can be skipped on busy books.
* The venue's taker delay is off by default, so marketable orders on flagged
  markets are not held (section 3.3).
* No cancel latency: a cancel takes effect when we process it.
* On paths that apply depletion, withheld liquidity comes back all at once.
  Per-snapshot depletion clears on the next book update. The default 2.0
  window clears after 2 s without further consumption (section 3.4).
* Depletion is shared between all users on a deployment, so your fills can
  depend on other users' activity.
* The same displayed liquidity on a binary market can be filled twice through
  its mirrored level (section 3.4).
* No permanent price impact from your own trades.
* Maker rebates and liquidity rewards are not credited.
* Until the 2.0 release on 24.11, production charges fixed category fee rates,
  which differ from Polymarket's per-market rates (and from its new rates after
  2026-11-20 23:59 UTC). From 2.0, fallback category rates can still differ
  when a market has no fee metadata.
* When a fresh book cannot be fetched, an older cached book can still price a
  fill: with no age limit in production before 24.11, and up to 60 s old (10 s
  on fast markets) from 2.0 (section 1, Stale books).
* No gas, no blockchain settlement and no on-chain finality.
* Some markets or intervals listed on Polymarket are not available here.

***

## 6. Versioning

Each revision of this page has a version number and a date. The page's
version is separate from PolySimulator release numbers. A **minor** version
(1.0 → 1.1) adds measurements or corrects wording. A **major** version
(1.x → 2.0 of this page) changes how fills are decided: a new default, a new model, or a
feature moving from planned to live. Behaviour changes are also listed in the
API [Changelog](https://docs.polysimulator.com/changelog.md).

### Change log

| Version | Date | Change |
| - | - | - |
| 1.0 | 2026-11-19 | First version. Checked against the pre-release code at commit `6c13694345` and against production measurements from 2026-11-09 to 2026-11-19. |


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