StaleBookGuard
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
Applies to: Per OrderIntent
Why it matters
| If this fails | Consequence |
|---|---|
| Trading on stale prices | An 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 lag | WebSocket latency can spike without disconnecting; a healthy-looking connection can still be delivering 30-second-old data. |
| No central freshness check | Without one canonical staleness rule, every strategy invents its own — some too lenient, some forgotten entirely. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| OrderBookSnapshot.ts_ms per market_id | intel.orderflowanalyzer | required | The single source of truth for book freshness. |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| OrderIntent.market_id | Strategy bot | required | Identifies which book to check. |
| Wall-clock now_ms | Runtime | required | Compute age of the book at decision time. |
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_BOOK_STALE | P1 | Risk Book Stale | See decision output and developer log for context. |
| RISK_BOOK_STALE_WARN | P1 | Risk Book Stale Warn | See decision output and developer log for context. |
Related bots in Risk Guardrail
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.
| Strategy | State | Activity |
|---|---|---|
| NBA props — line-shop | demo-wired | last triggered 41m ago |
| Crypto Q2 — basket rebalance | frozen | last triggered 1m ago |
| US Elect — book-builder | demo-wired | last triggered 8m ago |
Showing 3 of 3 · demo-wired ≠ production-live
⚙ Configuration — risk.stalebookguard
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 →