⚠ 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

CancelReplaceOptimizer

exec.cancelreplaceoptimizer
Execution planned Spec started frozen

CancelReplaceOptimizer selects the cheapest path to modify a resting order: amend-in-place if queue priority is preserved, or cancel-then-replace if t

What it does

CancelReplaceOptimizer selects the cheapest path to modify a resting order: amend-in-place if queue priority is preserved, or cancel-then-replace if the delta exceeds the amend threshold. It enforces rate-limit budgets across cancel and amend operations.

Pipeline placement

runs after: PartialFillHandler or strategy-driven requote signal CancelReplaceOptimizer runs before: Order signing and CLOB V2 submission

Applies to: Any request to modify a resting order's price or size

Why it matters

If this failsConsequence
Always using cancel-then-replaceLoses queue position on every requote, resulting in consistently worse fills on passive strategies where queue position matters.
Amend threshold set too wideLarge price changes that would trigger queue-position loss are processed as amends, causing the strategy to hold a stale order at a position that was meant to be cancelled.
Rate limit not enforced across cancelsA burst of cancel-replace operations hits the CLOB V2 rate limit, causing 429 errors and leaving orders unmodified at stale prices.

Inputs

Polymarket inputs

InputSourceRequiredUse
CLOB V2 amend endpoint semanticsclob_authrequiredDetermine whether amend preserves queue priority for the given price/size delta.
Market tick sizeclob_publicrequiredCompute tick distance between current and target price for amend vs. cancel-replace decision.

Internal inputs

InputSourceRequiredUse
Requote instruction with current order_id, target price, target sizeexec.partialfillhandler or strat layerrequiredReceive the requested modification and current order parameters.
Rate-limit budget stateinternal rate-limit trackerrequiredCheck remaining cancel and amend budget before issuing operations.

Authority

What this bot is permitted to do

Reshape

State

Readiness

Spec started

Status

planned

Class

Execution Utility

Default mode

shadow_only

Developer owner

Polytraders core — Execution pod

Capital impact

Direct

Reason codes emitted

CodeSeverityMeaningAction
AMEND_IN_PLACEINFOOrder amended without cancelling; queue priority preserved.Emit ExecutionReport; no further action.
CANCEL_REPLACE_EXECUTEDINFOOrder cancelled and resubmitted at new price/size.Emit ExecutionReport.
CANCEL_REPLACE_FORCEDRESHAPEDelta exceeds amend_threshold_ticks; cancel-replace forced.Cancel and resubmit.
CANCEL_REPLACE_RATE_LIMIT_SHEDWARNburst_max_per_s exceeded; request shed.Drop request; emit WARN; retry on next tick.
KILL_SWITCH_ACTIVEHARD_REJECTKillSwitch active; no cancel or amend operations.Halt all operations.

Used by

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

StrategyStateActivity
NBA props — line-shopdemo-wiredlast triggered 39m ago
Crypto Q2 — basket rebalancefrozenlast triggered 46m ago

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

Why this matters

Execution bots does NOT propose new positions; only routes and shapes approved intents. 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…