⚠ 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

StaleBookGuard

risk.stale_book_guard
Risk Guardrail planned Spec ready demo-wired

Rejects any OrderIntent priced against an order book older than the configured staleness threshold.

What it does

Rejects any OrderIntent priced against an order book older than the configured staleness threshold. The book may look healthy, but if its last update is too old, prices have almost certainly moved. StaleBookGuard fails closed: if it cannot prove the book is fresh, it rejects.

Pipeline placement

runs after: intel.orderflowanalyzer StaleBookGuard runs before: exec.smart_router

Applies to: Per OrderIntent

Why it matters

If this failsConsequence
Trading on stale pricesAn OrderIntent priced against a 20-second-old book during a fast-moving event is essentially a market order; it will fill at whatever price the new book is.
Worked example
Setup: Market 0x44a has had no order-book update for 7 seconds. The last mid was 0.41. A strategy submits a buy at 0.41 sized for the visible 6,200 pUSD of asks.
Without bot: The book is actually 0.34/0.36 — the WebSocket feed dropped and the strategy is reading a frozen snapshot. The order fills against a fresh 0.36 ask queue at 0.41 and the strategy overpays the spread on every clip.
With bot: StaleBookGuard sees `last_book_update_age > staleness_threshold_s=3` and votes REJECT with reason `STALE_BOOK`. The order is blocked. When the WebSocket reconnects, age drops to 0.4s and the next OrderIntent goes through.
Hidden feed lagWebSocket latency can spike without disconnecting; a healthy-looking connection can still be delivering 30-second-old data.
No central freshness checkWithout one canonical staleness rule, every strategy invents its own — some too lenient, some forgotten entirely.

Inputs

Polymarket inputs

InputSourceRequiredUse
OrderBookSnapshot.ts_ms per market_idintel.orderflowanalyzerrequiredThe single source of truth for book freshness.

Internal inputs

InputSourceRequiredUse
OrderIntent.market_idStrategy botrequiredIdentifies which book to check.
Wall-clock now_msRuntimerequiredCompute age of the book at decision time.

Authority

What this bot is permitted to do

Reject

State

Readiness

Spec ready

Status

planned

Class

Guardrail

Default mode

shadow

Developer owner

Risk pod

Capital impact

Direct

Reason codes emitted

CodeSeverityMeaningAction
RISK_BOOK_STALEP1Risk Book StaleSee decision output and developer log for context.
RISK_BOOK_STALE_WARNP1Risk Book Stale WarnSee decision output and developer log for context.

Used by

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

StrategyStateActivity
NBA props — line-shopdemo-wiredlast triggered 41m ago
Crypto Q2 — basket rebalancefrozenlast triggered 1m ago
US Elect — book-builderdemo-wiredlast triggered 8m ago

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

⚙ Configuration — risk.stalebookguard

15s

Envelopes are hard-rejected if book data is older than this threshold.

ClusterThreshold (s)
AI_FRONTIER
CRYPTO_Q2
Configuration applies on next bot restart

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…