AnomalyDetector
intel.anomalydetector
Intelligence
planned
Spec started
frozen
Flag statistical anomalies in book, trades, or feed data for human review.
What it does
Flag statistical anomalies in book, trades, or feed data for human review.
Pipeline placement
runs after: —
→
AnomalyDetector
→
runs before: —
Applies to: —
Why it matters
| If this fails | Consequence |
|---|---|
| Book or trade anomaly goes unnoticed | Without a statistical watchdog, sudden mid-price jumps, volume spikes, or microstructure changes that signal a feed glitch, market manipulation, or upstream halt are detected only when a strategy bot already trades on the bad data. By then unintended fills have already occurred. Worked example Setup: Market 0xab12 (NFL game in progress). Mid-price has sat at 0.62 ± 0.01 for 40 minutes. The CLOB V2 feed delivers a single tick at 0.91 followed by silence for 6 seconds, then resumes at 0.62. Without bot: A maker strategy reads 0.91 as the new mid, re-quotes its ladder around 0.91, and gets crossed by the next 0.62 print — leaving open inventory it never intended to take. With bot: AnomalyDetector emits a z-score=8.4 signal on that tick. Risk widens its staleness window for the market, smartrouter blocks new entries for 10s, and the maker bot keeps its prior ladder. |
| No baseline for human review | Operators reviewing a market in incident mode have no reference for what 'normal' looked like for that market in the prior hour. Anomaly emissions provide the timestamped baseline that every post-incident review needs. |
| Z-score signal duplicated across strategies | If anomaly detection lives inside individual strategy bots, every team reinvents it inconsistently. A single shared service emits one canonical anomaly stream that all consumers — Risk, Strategy, Governance — read from. |
| Strategy bots blind to feed degradation | A z-score spike often precedes a stale-book event by seconds. Without an explicit anomaly signal, downstream Risk bots have no early warning to widen their staleness windows or pause new entries. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| CLOB V2 order book mid-price per condition_id | clob_public | required | Compute price z-score vs rolling baseline. |
| Recent trade volume per condition_id | data | required | Compute volume z-score vs rolling baseline. |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| KillSwitch active flag | KillSwitch | required | Suppress all anomaly emissions when KillSwitch is active. |
Authority
What this bot is permitted to do
Read-only
State
Readiness
Spec started
Status
planned
Class
Signal Service
Default mode
shadow_only
Developer owner
Polytraders core
Capital impact
Indirect
Reason codes emitted
| Code | Severity | Meaning | Action |
|---|---|---|---|
| ANOMALYDETECTOR_PRICE_SPIKE | WARN | Price z-score exceeds z_score_threshold relative to rolling baseline. | Emit ObservationReport with anomaly_detected=true; strategies may reduce size or pause. |
| ANOMALYDETECTOR_VOLUME_SPIKE | WARN | Volume z-score exceeds z_score_threshold relative to rolling baseline. | Emit ObservationReport with anomaly_detected=true; strategies monitor for continuation. |
| STALE_DATA | WARN | CLOB API or Data API is unavailable; anomaly detection paused. | Skip detection cycle; retry on next poll. |
| KILL_SWITCH_ACTIVE | HARD_REJECT | KillSwitch active; all AnomalyDetector emissions suppressed. | Continue anomaly detection internally; suppress all ObservationReport emissions. |
| ANOMALYDETECTOR_INSUFFICIENT_BASELINE | INFO | Rolling baseline has insufficient data points to compute reliable z-scores. | Skip anomaly check for this market until baseline window is populated. |
Related bots in Intelligence
Used by
Reverse index — strategies that currently reference intel.anomalydetector. If you change this bot's authority or reason codes, these strategies must re-pass shadow.
| Strategy | State | Activity |
|---|---|---|
| Fed Rates — surprise drift | frozen | last triggered 14m ago |
Showing 1 of 1 · demo-wired ≠ production-live
Why this matters
Intelligence bots does NOT propose, veto, sign, or execute any trade. Understanding the authority boundary prevents misuse and makes promotion-gate reviews faster and more reliable. View raw spec JSON →