⚠ 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

LiquidityGuard

risk.liquidityguard
Risk Guardrail live General live frozen reference impl

LiquidityGuard prevents strategies from placing orders that would consume too much of the visible order-book depth on a given market.

What it does

LiquidityGuard prevents strategies from placing orders that would consume too much of the visible order-book depth on a given market. It checks book depth, spread, and top-of-book freshness on every OrderIntent and either approves, downsizes, or rejects the order. It cannot change the market, the direction, or the strategy intent — only the size and the timing of execution.

Pipeline placement

runs after: Strategy OrderIntent LiquidityGuard runs before: ExecutionPlan emit

Applies to: Every OrderIntent before it reaches the execution layer

Why it matters

If this failsConsequence
Thin-book consumptionAn oversized order eats through the visible top-of-book and walks the price several ticks against the user before fully filling, resulting in worse-than-expected execution.
Stale book approvedIf depth data is not refreshed, the system may believe there is enough liquidity when the book has thinned out since the last snapshot, leading to surprise price impact.
Excessive spread ignoredTrading into a wide spread means crossing more slippage than the strategy priced in, which can turn a positive-expected-value order into a losing one.
No size floor on top-of-bookAn order placed on a market with near-zero resting size can move the price dramatically even for small notional amounts.

Inputs

Polymarket inputs

InputSourceRequiredUse
CLOB order book — top 50 levels (bid and ask)CLOBrequiredCompute total visible USD depth and the inside spread; compare against thresholds.
Best-bid / best-ask resting sizeWebSocketrequiredDetermine how large the top-of-book is to enforce min_top_of_book_usd.
30-day median spread for the target marketData APIrequiredCalculate the spread multiple: current spread divided by 30d median, compared to max_spread_multiple.
Top-of-book last-update timestampWebSocketrequiredDetect stale book data; reject if older than stale_top_seconds.

Internal inputs

InputSourceRequiredUse
Strategy budget remaining for this marketPortfolioGuardrequiredCap the reshape size to the budget remaining so downsized orders don't exceed the portfolio limit.
KillSwitch active flagKillSwitchrequiredIf KillSwitch is active, reject all orders immediately without consulting book data.

Authority

What this bot is permitted to do

Reject Reshape

State

Readiness

General live

Status

live

Class

Guardrail

Default mode

general_live

Developer owner

Polytraders core — Risk pod

Capital impact

Direct

Reason codes emitted

CodeSeverityMeaningAction
KILL_SWITCH_ACTIVEHARD_REJECTGlobal kill switch is active; no orders may proceed.Immediately return HARD_REJECT without consulting book data.
STALE_MARKET_DATAHARD_REJECTBook snapshot is older than stale_top_seconds hard limit.Return HARD_REJECT; wait for fresh book before retrying.
INSUFFICIENT_VISIBLE_DEPTHHARD_REJECTOrder size exceeds the hard depth ceiling or top-of-book is below the hard floor.Return HARD_REJECT or RESHAPE_REQUIRED depending on which threshold was breached.
SPREAD_TOO_WIDEHARD_REJECTCurrent spread exceeds max_spread_multiple times the 30-day median.Return HARD_REJECT; log spread_multiple value.
LIQUIDITY_GUARD_RESHAPE_DEPTHRESHAPEOrder size is above the default depth percentage but below the hard ceiling.Return RESHAPE_REQUIRED with constraints.max_size_usd = visibleDepthUsd * default_pct.
LIQUIDITY_GUARD_SPREAD_WARNWARNSpread is between the warning and hard multiple thresholds.Attach warning annotation to APPROVE; do not block.
LIQUIDITY_GUARD_NEGRISK_THIN_BOOKWARNNegRisk market book is thin relative to the requested size, increasing definition-shift exposure.Attach warning annotation; Strategy may reduce size further.
LIQUIDITY_GUARD_TOP_BOOK_RESHAPERESHAPETop-of-book USD is between the warning and hard floor thresholds.Return RESHAPE_REQUIRED with constraints.max_size_usd = topOfBookUsd.

Used by

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

StrategyStateActivity
US Elections — sentiment fadedemo-wiredlast triggered 18m ago

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

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…