⚠ INTERNAL — Operator UX mock · Design preview of V2 development path · demo-wired ≠ production-live · back to dev guide
Polygon · pUSD 10
📓 Developer Guide 📋 Reason Codes 📈 Shadow Mode
JD John Doe · Admin

RateLimitGovernor

risk.ratelimitgovernor
Risk Guardrail live General live frozen

RateLimitGovernor prevents the system from exceeding Polymarket's CLOB order send-rate limits at both the per-market and per-account levels.

What it does

RateLimitGovernor prevents the system from exceeding Polymarket's CLOB order send-rate limits at both the per-market and per-account levels. It reads live rate-limit headers from CLOB responses (X-RateLimit-Remaining, X-RateLimit-Reset), maintains sliding-window counters, and either delays (reshapes) or rejects OrderIntents when the remaining budget falls below configured thresholds. Cancel and risk-flatten requests always receive priority allocation over new open orders. The bot is fail-closed: if rate-limit state cannot be determined, new order intents are rejected until state is re-established.

Pipeline placement

runs after: Strategy OrderIntent RateLimitGovernor runs before: ExecutionPlan emit

Applies to: Every OrderIntent — checks per-market and per-account order send-rate against Polymarket CLOB limits before allowing exe

Why it matters

If this failsConsequence
Order send-rate exceeds CLOB limitPolymarket's CLOB enforces rate limits via Cloudflare. Exceeding the limit produces HTTP 429 responses, which cause order rejections, increased latency, and potential temporary IP/key bans that block all trading — including urgent risk-flatten operations.
No priority for cancel/risk-flatten requestsIf rate budget is exhausted by new open orders, urgent cancellation or position-flatten requests may be queued or dropped, leaving dangerous open exposure during fast market moves.
Rate budget not read from live CLOB headersHard-coded rate limits may diverge from Polymarket's actual published limits. Reading live headers ensures the system adapts to any policy changes without a code deploy.
Per-market throttle not separated from per-account throttleA high-frequency strategy on one market can exhaust the account's global rate budget, silently starving other markets of order capacity.

Inputs

Polymarket inputs

InputSourceRequiredUse
CLOB rate-limit response headers: X-RateLimit-Remaining, X-RateLimit-Reset, X-RateLimit-Limitclob_authrequiredTrack the live remaining request budget and reset time per sliding window. Update internal counters after every CLOB response.

Internal inputs

InputSourceRequiredUse
Per-market sliding-window order counterinternalrequiredCount the number of order intents sent to each market within the current rate-limit window.
Per-account global order counterinternalrequiredCount total order intents across all markets to enforce the account-level rate cap.
Intent classification: open / cancel / risk-flatteninternalrequiredCancel and risk-flatten intents always receive priority allocation from the reserved cancel budget; they bypass the standard rate check.
KillSwitch active flagKillSwitchrequiredIf KillSwitch is active, reject all new open orders immediately. Cancel/flatten requests still use the priority path.

Authority

What this bot is permitted to do

Reject Reshape

State

Readiness

General live

Status

live

Class

Guardrail

Default mode

general_live

Developer owner

Polytraders core — Risk pod

Capital impact

Direct

Reason codes emitted

CodeSeverityMeaningAction
KILL_SWITCH_ACTIVEHARD_REJECTGlobal kill switch is active; all open-order intents are rejected. Cancel and risk-flatten intents are unaffected.Return HARD_REJECT for OPEN intents; CANCEL and RISK_FLATTEN intents proceed via priority path.
RATE_LIMIT_GOVERNOR_BUDGET_EXHAUSTEDHARD_REJECTAccount-level trading counter has reached the hard limit for the current sliding window.Return HARD_REJECT; log window reset time. Intent may be requeued after window reset.
RATE_LIMIT_GOVERNOR_MARKET_THROTTLEDHARD_REJECTPer-market order counter has reached the per-market sub-limit for the current window.Return HARD_REJECT for this market; intents on other markets are unaffected.
RATE_LIMIT_GOVERNOR_BUDGET_WARNRESHAPETrading counter is in the warning zone (80–100% of limit). Order deferred until window reset.Return RESHAPE_REQUIRED with constraints.defer_ms = ms until window reset.
RATE_LIMIT_GOVERNOR_STATE_UNKNOWNHARD_REJECTInternal rate-limit state is uninitialised or cannot be read; fail-closed to prevent accidental over-sending.Return HARD_REJECT for all non-priority intents until state is re-established from CLOB headers.
RATE_LIMIT_GOVERNOR_PRIORITY_CANCELINFOCancel intent approved from reserved cancel budget, bypassing the standard trading counter.Decrement reserved cancel budget; emit APPROVE.
RATE_LIMIT_GOVERNOR_PRIORITY_FLATTENINFORisk-flatten intent approved unconditionally, bypassing all rate counters.Emit APPROVE without touching any counter.
RATE_LIMIT_GOVERNOR_PASSINFOBoth per-market and per-account counters are within limits. Intent approved.Increment counters; emit APPROVE.

Used by

Reverse index — strategies that currently reference risk.ratelimitgovernor. If you change this bot's authority or reason codes, these strategies must re-pass shadow.

StrategyStateActivity
NBA props — line-shopdemo-wiredlast triggered 21m ago
Crypto Q2 — basket rebalancefrozenlast triggered 28m ago
US Elect — book-builderdemo-wiredlast triggered 35m ago

Showing 3 of 3 · demo-wired ≠ production-live

Why this matters

Risk Guardrail bots does NOT propose intents or sign orders; only permits or blocks. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →
Polytraders Operator UX Mock · INTERNAL · demo-wired ≠ production-live · the plan · reason codes · shadow-mode pipeline
⚙ Page Configuration
Current page settings
Loading configuration…