POST /v1/orders/preview takes the exact body of POST /v1/orders and answers what that request
would do. It reserves and places nothing, so a read key can call it.
When the trading account can’t trade on any venue that lists the market, for example because that venue is not available in your region, the preview answers with the same
403 error that POST /v1/orders and the quote return. When a venue has stopped trading the market, the preview answers 409 CONFLICT with details.reason: "MARKET_NOT_TRADABLE", and when a venue can’t be read, 503 UPSTREAM_ERROR, as the quote does. A Polymarket US market whose book Lean has not loaded yet also answers 503 UPSTREAM_ERROR with Retry-After; send the same preview again after that time.
Warnings
Liquidity rewards
Polymarket, Kalshi and Polymarket US pay makers whose orders rest near the top of a rewarded market’s book.GET /v1/rewards/programs lists the
markets that pay and their rules. For a leg on one of them, reward says whether the part a gtc
or gtd order would rest would score, judged against the book as just read with that part added.
The book moves, so an order that scores when placed can stop scoring, and the venue decides what it
pays. Earnings show in GET /v1/rewards/earnings.
Polymarket also requires orders on both sides of a market whose midpoint is below 10¢; the preview
does not check your other orders.
Preview several orders
POST /v1/orders/preview-batch takes up to 25 bodies of POST /v1/orders in orders and
previews them all at once, so the call takes about as long as the slowest preview. Like the single
preview it places nothing, needs only a read key, and counts once against the key’s rate limit.
results has one entry per body, in the order you sent them. preview is what
POST /v1/orders/preview answers for that body, shortened here; it has every field described
above. When the single preview would answer with an
error, preview is null and status and error carry that error’s HTTP status, code,
message and details, so one body that can’t be previewed does not fail the others. A body that
fails validation, or more than 25 bodies, refuses the whole call with 400.
Each body is previewed on its own. The limits and holdings checks of one body do not count the
others, so a set of orders that each pass can still go past a limit together.
A preview is a snapshot. Prices and balances can change before you place the order. The daily
limit is read but not held, so an order placed in between can still take the room a preview saw.
How fresh a preview is
To answer fast, a preview, a preview batch and a quote price on books Lean already holds, at most about 2 seconds old, and read the account’s funds and sellable shares from a recent read, at most 30 seconds old. An order you place or cancel through Lean clears that read for its venue account at once, but a change made elsewhere, such as an order placed in the venue’s own app, can take up to 30 seconds to show. If Kalshi throttles the balance read, a preview answers from the last balance Lean read.POST /v1/orders reads every book, balance and holding fresh before it places the order, so it
can still refuse an order its preview accepted.