Polytraders Dev Guide
internal
v3 spine Phase 1 · Shared contracts 9 demo-wired · 0 shadow-ready · 0 production-live · 100 pending · 109 total 15/33 infra tasks the plan status board

Reason-code registry

Every reason code that a bot may emit. New codes go through review — free-text reasons are not allowed in production.

Rules

Risk family RISK_*

CodeMeaning
RISK_KILL_SWITCH_ACTIVEKill switch is active; no orders may be submitted.
RISK_DRAWDOWN_BREACHIntraday or weekly drawdown threshold exceeded.
RISK_PORTFOLIO_LIMITPortfolio exposure cap would be breached.
RISK_MARKET_LIMITPer-market exposure cap would be breached.
RISK_LIQUIDITY_INSUFFICIENTOrder book lacks the liquidity to absorb this size.
RISK_STALE_BOOKOrder book snapshot is older than max_orderbook_age_ms.
RISK_MARKET_HALTEDMarket is paused, resolving, resolved, or invalid.
RISK_SELF_TRADEOrder would self-cross another bot's resting order.
RISK_FEE_GAS_HEADROOMEstimated fees + gas exceed the configured headroom.
RISK_CORRELATION_SHOCKCorrelated portfolio shock detected; trading paused.
RISK_MODEL_DRIFTStrategy's model has drifted past the warning band.
RISK_TAIL_LOSS_BREACHTail-loss simulator says this trade exceeds the worst-case envelope.
RISK_FLATTENRisk has demanded the position be flattened immediately.

Execution family EXEC_*

CodeMeaning
EXEC_LATENCY_BUDGET_EXCEEDEDExecution path exceeded its latency budget.
EXEC_PARTIAL_FILL_HANDLEDPartial fill processed; remaining size resubmitted or cancelled.
EXEC_AMEND_REJECTEDOrder amend rejected by the exchange.
EXEC_CANCEL_TIMEOUTCancel request timed out; assume order is still resting.
EXEC_SLIPPAGE_BREACHRealised slippage exceeded the configured cap.
EXEC_FEE_OVERRUNRealised fees exceeded the estimate by more than the configured tolerance.
EXEC_FILLOrder filled by the exchange.
EXEC_RESTINGOrder is resting on the book.
EXEC_CANCELLEDOrder cancelled by the exchange.
EXEC_REJECTEDOrder rejected by the exchange.
EXEC_BAD_ENVELOPEEIP-712 v2 envelope failed shape validation.
EXEC_BAD_INTENTOrderIntent failed structural validation.
EXEC_BAD_SIZEOrder size is invalid (negative, zero, or out of range).
EXEC_BAD_PRICEOrder price is invalid (not on tick, out of [0,1]).
EXEC_BAD_SIDEOrder side is not BUY or SELL.
EXEC_BAD_TIFTime-in-force not one of GTC, IOC, FOK.
EXEC_BAD_REQUESTTransport-level request failed validation.
EXEC_INTERNALInternal exchange-side error.
EXEC_NO_LIQUIDITYNo liquidity available to fill this order.
EXEC_FOK_NOT_FULLY_FILLABLEFOK order cannot be fully filled at submit time.
EXEC_UNKNOWN_MARKETMarket ID not present on the venue.
EXEC_UNKNOWN_ORDEROrder ID not present in the venue's order book.
EXEC_UNKNOWN_ROUTEUnknown HTTP route or in-process method.
EXEC_ORDER_TERMINALOrder is already in a terminal state; no further action allowed.
EXEC_AMEND_OKOrder amend acknowledged by the exchange.
EXEC_AMEND_INFLIGHTOrder amend is in flight; awaiting acknowledgement.
EXEC_AMEND_UNKNOWNOrder amend outcome is unknown.
EXEC_AMEND_TIMEOUTOrder amend timed out before acknowledgement.
EXEC_CANCEL_OKOrder cancel acknowledged by the exchange.
EXEC_COST_ESTIMATEDExecution cost estimate produced from live inputs.
EXEC_COST_FALLBACKExecution cost estimate used the safe fallback.
EXEC_COST_FEE_SCHEDULE_STALEExecution cost estimate used a stale fee schedule.
EXEC_BUILDERCODE_MISSINGOutbound envelope lacked the required builderCode.
EXEC_OPERATOR_MANUAL_CASHOUTOperator manually closed the position; cash-out submitted at current mid.

Strategy family STRAT_*

CodeMeaning
STRAT_NO_EDGEModel edge fell below min_edge_bps; no intent emitted.
STRAT_EDGE_DETECTEDModel edge above threshold; intent emitted.
STRAT_PARAMETER_OUT_OF_DOMAINInput value outside the model's training domain; abstain.
STRAT_RESHAPED_BY_RISKOrderIntent was reshaped by Risk before submission.

Intelligence family INTEL_*

CodeMeaning
INTEL_FEED_STALEUpstream feed exceeded its freshness budget.
INTEL_FEED_DEGRADEDUpstream feed is degraded but still within tolerance.
INTEL_LIQUIDITY_DECAYQuoted depth has decayed below acceptable levels.
INTEL_MARKET_RESOLVING_SOONMarket is in or approaching its resolution window.

Security family SEC_*

CodeMeaning
SEC_WALLET_FUNDING_SHORTWallet pUSD balance below configured floor.
SEC_APPROVAL_MISSINGERC-1155 approval missing or revoked.
SEC_CONTRACT_ADDRESS_DRIFTOn-chain contract address differs from approved registry.
SEC_SIGNATURE_TYPE_INVALIDWallet signature type not on the allow-list.

Governance family GOV_*

CodeMeaning
GOV_CONFIG_DRIFTLive config differs from approved config.
GOV_API_DEGRADEDPolymarket API latency or error rate above warning.
GOV_RECONCILE_MISMATCHOn-chain state does not reconcile with internal state.
GOV_AUDIT_REPLAY_DIVERGEDReplay simulator diverged from production decision.
GOV_BUILDER_ATTRIBUTION_OKOrder carried the correct builderCode.
GOV_API_OKPolymarket API health probe within tolerance.
GOV_API_DOWNPolymarket API is unresponsive or returning errors.
GOV_API_UNKNOWNPolymarket API health probe inconclusive.
GOV_CONFIG_DRIFT_DETECTEDConfig drift detected against the approved baseline.
GOV_CONFIG_DRIFT_RESOLVEDConfig drift resolved; live matches approved.
GOV_CONFIG_DRIFT_UNKNOWNConfig drift check inconclusive.
GOV_EXPOSURE_NARRATIVEExposure narrative emitted with no anomalies.
GOV_EXPOSURE_CONCENTRATION_FLAGExposure narrative flagged a concentration anomaly.
GOV_EXPOSURE_FALLBACKExposure narrative used the safe fallback.
GOV_RECONCILE_OKOn-chain state reconciles with internal state.
GOV_REPLAY_MATCHReplay simulator output matched production decision.
GOV_REPLAY_ABORTEDReplay simulator aborted before completion.
GOV_REPLAY_NO_NETWORK_VIOLATIONReplay simulator confirmed no network-policy violation.