Replay Strategy
Polymarket
Replay Strategy
Replay an entry/exit strategy against one resolved market
POST
Replay Strategy
Replay Strategy
Runs a strategy against one resolved historical market, tick by tick. The replay engine evaluates your entry and exit rules against each snapshot, walks the historical order book for fills, and returns trades, PnL, drawdown, slippage, and an equity curve.Strategy Replay requires a Pro, Pro Trial, or Enterprise subscription.
Request
Headers
Your API key. See Authentication.
Must be
application/json.Body parameters
Slug of a resolved market to replay, e.g.
btc-updown-5m-1774975800.Outcome token to trade. Allowed values:
UP, DOWN.Conditions that must all be true to enter a position. Each condition contains
field, operator, and value.Conditions where any true condition exits the position. Max-loss and market-end exits can also close the position.
Number of shares to simulate per trade. Must be between
1 and 10000.Forced-exit drawdown threshold, from
1 to 100 percent. Defaults to 50 when omitted.Order type for the replay. Allowed values:
MARKET, LIMIT. Defaults to MARKET when omitted.Condition fields
| Field | Description |
|---|---|
price_up | UP outcome price at the snapshot |
price_down | DOWN outcome price at the snapshot |
coin_price | Reference BTC, ETH, or SOL price at the snapshot |
spread | Absolute difference between UP and DOWN prices |
time_remaining_pct | Percent of the market lifespan remaining |
Condition operators
| Operator | Description |
|---|---|
< | Field is less than value |
> | Field is greater than value |
<= | Field is less than or equal to value |
>= | Field is greater than or equal to value |
== | Field equals value |
crosses_above | Previous tick was at or below value, current tick is above value |
crosses_below | Previous tick was at or above value, current tick is below value |
Response
Replay responses use the standard API wrapper.true when the replay completed successfully.Replay result payload.
Market metadata for the replayed market.
Strategy summary including
side, positionSize, orderType, entryConditionCount, and exitConditionCount.Performance metrics including
total_pnl, total_pnl_percent, max_drawdown, max_drawdown_percent, total_trades, winning_trades, losing_trades, win_rate, avg_trade_pnl, best_trade, worst_trade, time_in_position_pct, and final_market_outcome.Entry and exit events. Each event includes
type, reason, time, price, fill_price, shares, slippage, position_pnl, cumulative_pnl, and coin_price.Sampled equity curve points containing
time, pnl, unrealized_pnl, price, coin_price, and in_position.Number of historical snapshots evaluated by the replay engine.
Response timestamp.
Example
Response
Errors
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Missing or invalid API key |
TIER_REQUIRED | 403 | Strategy Replay requires Pro, Pro Trial, or Enterprise |
MARKET_NOT_FOUND | 404 | The market slug does not exist |
MARKET_NOT_RESOLVED | 400 | The market exists but is not resolved yet |
NO_DATA | 404 | The market is resolved but has no snapshot data available |
INVALID_SIDE | 400 | side must be UP or DOWN |
INVALID_FIELD | 400 | A condition uses an unsupported field |
INVALID_OPERATOR | 400 | A condition uses an unsupported operator |
INVALID_ORDER_TYPE | 400 | orderType must be MARKET or LIMIT |