mass_cancel
Cancel every live order at once, optionally scoped to a venue and symbol — behind the confirm-plus-preview_token gate, and with one scoping combination that is deliberately ignored rather than guessed at.
mass_cancel clears the order book without touching positions. It is the coarse companion to
cancel_order, and the first half of what
market_exit does. Annotated destructiveHint: true, it previews
unless a call carries both confirm: true and the preview_token its own preview
returned, and needs vike-cli mcp --node <host:port> plus VIKE_TRADEHUB_CONTROL_KEY.
Arguments
| Parameter | Type | Required | Notes |
|---|---|---|---|
venue | string | no | Omit for every venue |
symbol | string | no | Omit for every symbol |
reason | string | no | Rationale for the node's audit trail |
confirm | boolean | no | Must be the JSON boolean true and be accompanied by preview_token — either one missing returns a preview |
preview_token | string | no | The token this tool's preview returned. Fires once, expires after 60s, bound to the command it previewed |
Nothing is required. mass_cancel_preview_allows_an_omitted_scope pins that the empty argument
object previews cleanly and produces a MassCancel wire command with both venue and symbol
null — the whole account, shown as exactly that.
The preview also carries a preview_token, and clearing the book takes a second call with
both confirm: true and that token. confirm: true on its own is not an error and does
not cancel anything: it returns a fresh preview, which
mass_cancel_confirm_without_a_token_is_a_preview_not_a_send pins by name. Read will_execute
before believing the book is empty — or read it from
node_snapshot, which is the real answer either way. The token's
rules — fires once, 60-second window, bound to this exact scope — are on
Live node.
What each scope means
OrderIntent::MassCancel is the authority, and it enumerates four combinations rather than three:
venue | symbol | What happens |
|---|---|---|
| absent | absent | all engines, and all conditional books cleared |
| present | present | that engine, and that (venue, symbol) conditional book cleared |
| present | absent | that engine, and that venue's conditional books cleared |
| absent | present | ignored, surfaced to recent-events |
A symbol with no venue cancels nothing
The fourth row is the one to carry. A symbol on its own does not mean "this symbol everywhere" —
the intent is ignored, and the fact that it was ignored is surfaced to the node's recent-events
rather than raised back to you as a refusal. The tool call itself succeeds, the node acknowledges
the command, and no order is cancelled. Always name the venue when you name a symbol, and check
node_snapshot if a scoped cancel appears to have done nothing.
It clears armed conditionals too
The scope table above is not only about resting venue orders. MassCancel is also the coarse
verb over the core-owned conditional book — the emulated stops and trailing orders a strategy
arms — and each scope clears the matching books as the table shows.
OrderIntent::DisarmConditional is the individual-cancel primitive that exists alongside it,
removing exactly one arm by the arm_id the runtime minted; MassCancel stays the blunt one. An
agent has no tool for the fine-grained disarm, so a mass cancel is how an emulated arm goes away
from this surface.
What the node does with it
lower_command maps WireCommand::MassCancel to the core intent and echoes an empty coid —
the account-wide-verb convention, since there is no single order id to name. The accepted response
says as much in its own note.
ControlLimits::vet consumes a rate token, as it does for every command, and applies no size cap:
mass-cancel is listed with cancel, flatten, market-exit and trading-state among the risk-reducing
verbs its doc says are never size-capped. The preview's guardrail is correspondingly
Guardrail::NoSize — within_limits: true, with a note saying there is no order size to check for
this verb.
Outcomes
Server::execute awaits this command's own ticket for two seconds. accepted returns
sent: true with an empty client_order_id; a refusal is an error result carrying the node's
reason; a timeout returns outcome: "unknown"; a dropped control connection is an error result
saying the outcome is unknown and it may have executed. Both ambiguous cases end at
node_snapshot before a retry.
A repeat is cheap here — cancelling an already-empty book is nothing — but it still spends a rate token, and the snapshot is the only thing that tells you whether the first one landed.
Related tools
cancel_order withdraws one order by id.
market_exit runs a mass cancel and then flattens every one-way
position, in that order — hedge-mode LONG/SHORT legs are skipped.
flatten closes one book's position without touching orders. What
happens to each cancelled order after the command lands is described in
Order lifecycle.
Cancel all resting orders on okx — venue okx, no symbol scope.
market_exit
The panic button — cancel every live order, then flatten every open one-way position (hedge-mode legs are skipped), optionally scoped to one venue; two-call gated like every other write tool, on confirm plus a preview_token.
set_trading_state
The account kill switch as an MCP tool — three states, applied to every engine the node runs, gated like every other write on confirm plus the single-use preview_token, and unable to arm a venue.