MarketHaltDetector
Watches for market-level halt conditions across Polymarket — wide-spread blowouts, missing best bid/ask, locked or crossed books, and sudden order-rat
What it does
Watches for market-level halt conditions across Polymarket — wide-spread blowouts, missing best bid/ask, locked or crossed books, and sudden order-rate collapse. When any halt condition fires, MarketHaltDetector quarantines the affected market_id so no new OrderIntent for that market can pass the Risk pipeline. It does not pause the whole system — only the affected market. Cleared automatically once conditions normalise for a configurable cool-off window, or manually via the Admin UI.
Pipeline placement
Applies to: Continuous
Why it matters
| If this fails | Consequence |
|---|---|
| Submitting orders into a halted book | Orders sent into a market with no two-sided liquidity end up either rejected by the CLOB or filled at runaway prices once the book reopens. Worked example Setup: Polymarket's status page reports `markets.matching` as degraded at 21:18 UTC. CLOB V2 stops accepting new orders but the data feed still streams stale book snapshots for 90 seconds. Without bot: Strategies read the stale snapshots as live state and post OrderIntents. Every order is rejected with platform errors. By the time the team correlates the failures, the strategies have already sent 240 rejected requests, breaching the per-minute submission budget and triggering a separate rate-limit halt. With bot: MarketHaltDetector reads the status page + recent reject patterns, declares `markets.matching=halted` at 21:18:14, and votes REJECT on every new OrderIntent until both the status page and the next 30s of submissions confirm a recovered state. |
| Treating wide-spread events as normal | A market with a 30%+ inside spread is structurally untradeable; trading it anyway invites massive slippage and unfair fills. |
| Manual halt management | Without automated detection, ops staff must monitor every market by hand — which does not scale past a handful of markets. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Best bid/ask per market_id | WebSocket | required | Detect missing or one-sided book; compute live spread. |
| Last-trade timestamp per market_id | CLOB | required | Detect sudden trade-rate collapse (no trades for trades_silent_ms with non-empty book). |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Recent OrderBookSnapshot history | intel.orderflowanalyzer | required | Smoothed spread and depth context for halt-vs-noise classification. |
| Active strategy → market_id map | OrderLifecycleManager | optional | Decide which strategies to notify when a halt fires. |
Authority
What this bot is permitted to do
State
Readiness
Spec ready
Status
planned
Class
Guardrail
Default mode
shadow
Developer owner
Risk pod
Capital impact
Direct
Reason codes emitted
| Code | Severity | Meaning | Action |
|---|---|---|---|
| RISK_MARKET_HALT | P1 | Risk Market Halt | See decision output and developer log for context. |
| RISK_MARKET_HALT_WARN | P1 | Risk Market Halt Warn | See decision output and developer log for context. |
| RISK_MARKET_HALT_CLEARED | P1 | Risk Market Halt Cleared | See decision output and developer log for context. |
Related bots in Risk Guardrail
Used by
Reverse index — strategies that currently reference risk.market_halt_detector. If you change this bot's authority or reason codes, these strategies must re-pass shadow.
| Strategy | State | Activity |
|---|---|---|
| NBA props — line-shop | demo-wired | last triggered 3m ago |
| Crypto Q2 — basket rebalance | frozen | last triggered 10m ago |
| US Elect — book-builder | demo-wired | last triggered 17m ago |
Showing 3 of 3 · demo-wired ≠ production-live
⚙ Configuration — risk.markethaltguard
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 →