⚠ 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

FeeAndGasGuard

risk.feeandgasguard
Risk Guardrail planned Planned frozen

FeeAndGasGuard estimates the total transaction cost (CLOB maker/taker fee plus Polygon gas) for a proposed order and rejects or downsizes it when the

What it does

FeeAndGasGuard estimates the total transaction cost (CLOB maker/taker fee plus Polygon gas) for a proposed order and rejects or downsizes it when the cost-to-edge ratio exceeds the configured ceiling. It prevents strategies from placing orders where fee drag exceeds the expected edge, turning a positive-expected-value intent into a negative-EV execution.

Pipeline placement

runs after: Strategy OrderIntent FeeAndGasGuard runs before: ExecutionPlan emit

Applies to: Every OrderIntent — refuses trades whose realistic fee and Polygon gas burden consumes more than the configured fraction

Why it matters

If this failsConsequence
Fee drag exceeds edgePlacing an order where fees exceed the expected edge results in a systematically negative-EV trade that erodes capital over many repetitions.
Gas spike not accounted forPolygon gas spikes during congestion can materially increase transaction cost; ignoring gas makes fee estimates unreliable during high-traffic periods.

Inputs

Polymarket inputs

InputSourceRequiredUse
CLOB fee rate for the target market (operator-set, bps)clob_publicrequiredCompute taker or maker fee for the proposed order size and probability.
Current Polygon gas price estimateonchainrequiredEstimate the Polygon gas cost for the CTFExchangeV2.matchOrders() settlement transaction.
Current market probability (best bid/ask midpoint)clob_publicrequiredCompute the fee using the V2 formula: C * feeRate * p * (1-p), which peaks at p=0.5.

Internal inputs

InputSourceRequiredUse
Strategy expected edge (bps) per orderinternalrequiredCompare against the estimated fee-to-notional ratio to enforce the max_fee_to_edge_ratio limit.
KillSwitch active flagKillSwitchrequiredIf active, reject immediately.

Authority

What this bot is permitted to do

Veto Reshape

State

Readiness

Planned

Status

planned

Class

Guardrail

Default mode

planned

Developer owner

Polytraders core — Risk pod

Capital impact

Direct

Reason codes emitted

CodeSeverityMeaningAction
KILL_SWITCH_ACTIVEHARD_REJECTGlobal kill switch active.Immediate HARD_REJECT.
FEE_GUARD_COST_EXCEEDS_EDGEHARD_REJECTTotal cost-to-edge ratio exceeds the hard ceiling.HARD_REJECT; log total_cost_usd, edge_usd, and ratio.
FEE_GUARD_RATE_ANOMALYHARD_REJECTEffective fee rate exceeds max_fee_bps (V2 protocol ceiling).HARD_REJECT; alert on-call — anomalous fee rate detected.
FEE_GUARD_ORDER_TOO_SMALLHARD_REJECTOrder size is below min_order_usd; gas costs dominate.HARD_REJECT.
FEE_GUARD_COST_APPROACHINGWARNCost-to-edge ratio between warning and hard threshold.Attach WARN annotation; APPROVE.

Used by

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

StrategyStateActivity
US Elections — sentiment fadedemo-wiredlast triggered 1m ago
BTC weekly — close-aware quotesdemo-wiredlast triggered 8m ago
Fed Rates — surprise driftfrozenlast triggered 15m ago

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