OrderFlowAnalyzer
OrderFlowAnalyzer subscribes to ws_market for real-time trade prints and clob_public for order-book snapshots, then classifies each flow event as toxi
What it does
OrderFlowAnalyzer subscribes to ws_market for real-time trade prints and clob_public for order-book snapshots, then classifies each flow event as toxic (informed, likely to precede adverse price movement), benign (noise/retail), or informed (structural, correlated with neg-risk rebalancing). It emits an ObservationReport for every toxic flip and samples 1/10 routine ticks. Output feeds liquidity-aware strategies and the LiquidityGuard risk bot. OrderFlowAnalyzer is strictly read-only — it never submits or signs orders.
Pipeline placement
Applies to: All markets with active ws_market subscriptions
Why it matters
| If this fails | Consequence |
|---|---|
| Toxic flow not detected before entry | Strategy enters a market being targeted by informed traders; adverse selection erodes edge within seconds of fill. |
| Order-book imbalance not propagated to LiquidityGuard | LiquidityGuard uses stale depth figures; permits entry at sizes that would incur >2× expected slippage. |
| Informed neg-risk flow misclassified as benign | Neg-risk rebalancing activity (bulk outcome swaps) treated as noise; strategy takes wrong side of a structural price shift. |
| Microstructure features computed from stale snapshot | Stale imbalance and micro-volatility signals produce incorrect flow classification, causing either over-trading or missed entries. |
Inputs
Polymarket inputs
| Input | Source | Required | Use |
|---|---|---|---|
| Real-time trade prints (taker side, size, price, timestamp_ms) | ws_market | required | Classify each fill as toxic / benign / informed based on size, speed, and direction patterns. |
| Order-book snapshots (top-50 bid/ask levels, sizes in pUSD) | clob_public | required | Compute bid-ask imbalance, visible depth, and queue-position features for flow classification. |
| Market neg-risk flag | Gamma API (via internal cache) | optional | Amplify informed-flow scoring for neg-risk markets where bulk outcome swaps are common. |
Internal inputs
| Input | Source | Required | Use |
|---|---|---|---|
| KillSwitch active flag | KillSwitch | required | Continue computing microstructure features but suppress ObservationReport emissions when KillSwitch is active. |
| LiquidityGuard depth thresholds | LiquidityGuard config | optional | Calibrate minimum imbalance threshold against current depth guard parameters. |
Authority
What this bot is permitted to do
State
Readiness
General live
Status
live
Class
Signal Service
Default mode
general_live
Developer owner
Polytraders core — Intelligence pod
Capital impact
Indirect
Reason codes emitted
| Code | Severity | Meaning | Action |
|---|---|---|---|
| ORDERFLOW_TOXIC_FLIP | WARN | Flow classified as TOXIC: large print or directional imbalance signals informed order flow. | Emit ObservationReport with flow_class=TOXIC emit-every; downstream strategies apply adverse-selection guard. |
| ORDERFLOW_INFORMED | WARN | Neg-risk market shows structural bulk-rebalancing flow classified as INFORMED. | Emit ObservationReport with flow_class=INFORMED; strategies treat as structural directional signal. |
| ORDERFLOW_THIN_BOOK | WARN | Visible book depth below 2× LiquidityGuard minimum during flow classification. | Include in warnings on ObservationReport; LiquidityGuard applies tighter size restrictions. |
| STALE_DATA | WARN | ws_market disconnected or book snapshot stale for > 2× imbalance_window_s. | Set flow_class=UNKNOWN for affected markets; halt emissions; downstream strategies do not enter. |
| KILL_SWITCH_ACTIVE | HARD_REJECT | KillSwitch active; ObservationReport emissions suppressed. | Continue computing features but suppress all emissions. |
| MARKET_CLOSED | EXPLAIN | Trade print received for a market that is closed or resolved. | Ignore print; unsubscribe from ws_market for this condition_id. |
| ORDERFLOW_RATE_CAPPED | INFO | ObservationReport emission rate-capped at publish_rate_hz for a benign market. | Subsequent prints sampled; next scheduled emit will carry accumulated imbalance. |
| PARAMETER_CHANGE_REQUIRES_APPROVAL | HARD_REJECT | A parameter change violates a locked bound (e.g. imbalance_window_s < 5). | Reject config change; do not apply. |
Related bots in Intelligence
Used by
Reverse index — strategies that currently reference intel.orderflowanalyzer. If you change this bot's authority or reason codes, these strategies must re-pass shadow.
| Strategy | State | Activity |
|---|---|---|
| BTC weekly — close-aware quotes | demo-wired | last triggered 18m ago |
| Fed Rates — surprise drift | frozen | last triggered 25m ago |
| AI Frontier — release-day taker | frozen | last triggered 32m ago |
Showing 3 of 3 · 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 →