⚠ 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

InventoryUnwinder

risk.inventoryunwinder
Risk Guardrail live General live frozen

InventoryUnwinder detects when a position has breached its concentration or capital limit — either because an OrderIntent would push it over, or becau

What it does

InventoryUnwinder detects when a position has breached its concentration or capital limit — either because an OrderIntent would push it over, or because an existing position is already over the limit (e.g. after a parameter change or strategy crash). When a breach is detected it generates unwind OrderIntents targeting the source bot, using the NegRiskAdapter on Polygon for negRisk markets, and routes them back into the execution pipeline. It can also hard-reject incoming intents that would worsen an already-breached position. Builder codes from the original strategy are preserved on unwind intents for attribution. Fail-closed: if position data is unavailable, all new intents for the affected market are rejected.

Pipeline placement

runs after: Strategy OrderIntent — triggered on concentration or capital breach InventoryUnwinder runs before: ExecutionPlan emit

Applies to: Any OrderIntent that would push a position beyond concentration or capital limits; also fires on position-scan cycle to

Why it matters

If this failsConsequence
Concentration limit breach not unwoundA position that exceeds the declared inventory band creates directional exposure larger than the strategy risk envelope can justify, leading to losses that compound if the market moves against the position.
Capital limit not enforced on position growthWithout an active unwind, capital can become trapped in a single position, reducing the portfolio's ability to respond to other opportunities or drawdowns.
NegRisk market unwind without NegRiskAdapterFor multi-outcome negRisk markets, naively selling YES tokens may not fully close the position or may leave residual NO exposure. The NegRiskAdapter burn-and-redeem path must be used to correctly exit.
Strategy crash leaves open inventoryIf a strategy halts mid-session with open inventory, the position will remain on the book indefinitely unless InventoryUnwinder detects and liquidates it.

Inputs

Polymarket inputs

InputSourceRequiredUse
Current open positions per market — size, side, cost basisclob_authrequiredDetect whether a position is within its inventory band or has breached concentration limits requiring unwind.
Order book top-of-book (bid/ask) for target marketclob_publicrequiredDetermine unwind execution price and whether passive unwind is feasible at the current top-of-book.
Market metadata — negRisk flag, enableNegRisk, condition IDgammarequiredIdentify whether the market uses the NegRiskAdapter for unwind (negRisk markets must burn NO → pUSD via NegRiskAdapter).
On-chain position balance for NegRisk marketsonchainoptionalVerify the on-chain token balance before constructing NegRiskAdapter unwind transactions for negRisk multi-outcome markets.

Internal inputs

InputSourceRequiredUse
Per-strategy inventory band configurationinternalrequiredMax allowed net position size per market per strategy. Unwind is triggered when position exceeds max_inventory_band.
Source bot builder code (bytes32) for the breached positioninternalrequiredCarry original strategy builder code on unwind OrderIntents so attribution flows back to the position's source bot.
KillSwitch active flagKillSwitchrequiredIf KillSwitch is active, block all new intents and begin emergency unwind of all open inventory.
PortfolioGuard per-market budget remainingPortfolioGuardrequiredConfirm the unwind size does not itself breach portfolio limits (unwinds always reduce exposure, so they typically pass).

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; all incoming intents are rejected and emergency unwind of all open inventory begins.Immediately return HARD_REJECT and trigger startEmergencyUnwindAll().
STALE_MARKET_DATAHARD_REJECTPosition data from clob_auth or market metadata from Gamma is unavailable or stale.Return HARD_REJECT; retry on next fresh fetch.
INVENTORY_UNWINDER_BAND_BREACHHARD_REJECTPosition is at or above max_inventory_band and the incoming intent would increase it further.Return HARD_REJECT; emit unwind OrderIntents to reduce position back to handback threshold.
INVENTORY_UNWINDER_RESHAPERESHAPEIncoming intent would push the position above max_inventory_band but the position is currently below the hard ceiling.Return RESHAPE_REQUIRED with constraints.max_size_usd = max_inventory_band - current_position.
INVENTORY_UNWINDER_BAND_WARNWARNPosition (after this intent) would be between the warning and hard thresholds.Attach annotation to APPROVE; do not block. Log for monitoring.
INVENTORY_UNWINDER_NEGRISK_UNWINDINFOUnwind is proceeding via the NegRiskAdapter path (burn NO tokens → pUSD).Log the on-chain burn transaction reference and pUSD recovered.
INVENTORY_UNWINDER_UNWIND_COMPLETEINFOPosition has been reduced to or below the handback threshold; control returned to the originating strategy.Emit DecisionReport(UNWIND_COMPLETE) and resume accepting new intents from the source bot.

Used by

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

StrategyStateActivity
BTC weekly — close-aware quotesdemo-wiredlast triggered 3m ago
Fed Rates — surprise driftfrozenlast triggered 10m ago

Showing 2 of 2 · 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…