Configure Polymarket
Select a contracts family, inspect market state, and configure simulation or live execution.
A Polymarket app follows a contracts family and its active market. Market identity and outcome tokens can change as the family advances to its next market.
For saved configuration, launch choices, and session controls, follow Apps & Running Sessions. Check monitoring after startup and stopping and restarting when changing a running candidate.
1. Choose simulation or live execution
| App type | Behavior |
|---|---|
| Polymarket SSS | Synthetic fills using cached Polymarket market state |
| Polymarket | Broker-backed orders, positions, and account state |
Start with Polymarket SSS to inspect your strategy. Its fills do not reproduce every live liquidity or execution constraint.
2. Select a contracts family
Create or edit an app and select the app type. Choose a value in Select contracts family, such as BTC Up/Down 5m or BTC Up/Down 15m, and select the interval.
Use the family selector instead of hardcoding a token from a market that may expire. A family describes which markets to follow; it is not itself an outcome token to submit in an order.
3. Inspect the active market before adding orders
Paste this observational example into SJS:
export async function app({ context }) {
const root = context.sjsState ??= {};
const state = root.polyTutorial ??= {};
const poly = context.polyState;
const market = poly?.activeMarket;
if (!market) return;
state.snapshot = {
conditionId: market.conditionId,
marketSlug: poly.marketSlug,
yesBid: poly.bookYes?.bestBid,
yesAsk: poly.bookYes?.bestAsk,
noBid: poly.bookNo?.bestBid,
noAsk: poly.bookNo?.bestAsk,
updatedAt: poly.lastUpdateAt,
};
if (state.lastConditionId !== market.conditionId) {
state.lastConditionId = market.conditionId;
console.log("Polymarket active market", state.snapshot);
}
}Save and run the app. Check Logs for the active-market message. The latest snapshot is also stored at context.sjsState.polyTutorial.snapshot.
Missing bids or asks mean that the corresponding book field is unavailable. Do not silently turn missing data into a zero price. Keep positions associated with their market identity; positions from a previous market should not be mistaken for positions in the new one.
4. Configure a broker for live execution
In your workspace's broker configuration, add a Polymarket connection. The current form exposes:
| Field | Meaning |
|---|---|
| Name | A label you can recognize at launch |
| Address | The account's configured funder/proxy address |
| Signature Type | The signing mode that matches that account |
| Key | The signer private key used by the connection |
Store the key in the broker's secret field, not in SJS or PineScript. The runtime derives its normal trading API credentials through the CLOB client; a builder API key is not a replacement for the signer setup.
Use the address and signing mode for your actual wallet/account. A signature type that works for one account is not necessarily correct for another.
5. Select the live app and broker
When you are ready to test broker connectivity, use the Polymarket app type and select the matching broker in Run an app. Confirm the contracts family again. The observational SJS above submits no orders, so you can inspect market state before adding an execution policy.
A live order policy must resolve the current market and outcome token, handle rejected or partial fills, and track positions across market transitions. Do not reuse the generic instrument order example from the Pine tutorial as a complete Polymarket order payload.
Troubleshooting
| Symptom | Check |
|---|---|
| No active market | Contracts family, market availability, and runtime logs |
| Active market but no book | Feed updates and the selected outcome |
| Authentication or signing errors | Signer key, funder/proxy address, and signature type |
| Simulation works but live orders fail | Live broker credentials, current market identity, order sizing, and venue response |
| State belongs to the previous market | Compare condition IDs and reset market-specific strategy state |
See Backtest, inspect, and launch for the broader session workflow.