vike
Tools

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

ParameterTypeRequiredNotes
venuestringnoOmit for every venue
symbolstringnoOmit for every symbol
reasonstringnoRationale for the node's audit trail
confirmbooleannoMust be the JSON boolean true and be accompanied by preview_token — either one missing returns a preview
preview_tokenstringnoThe 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:

venuesymbolWhat happens
absentabsentall engines, and all conditional books cleared
presentpresentthat engine, and that (venue, symbol) conditional book cleared
presentabsentthat engine, and that venue's conditional books cleared
absentpresentignored, 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.

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.

On this page