Skip to main content
Cancel every open order in one call. Pass a market_id to scope the cancel to a single market.

Parameters

market_id
string?
When Some, cancel only orders on this market. When None, cancel all open orders across every market.

Returns

orders
Order[]
The set of orders that were successfully cancelled. Failed cancels are logged at WARN and omitted from the result on Polymarket; Kalshi includes per-order error entries from /portfolio/orders/batched and they are filtered out of the unified return.
Kalshi is a two-step flow: list resting orders (paginated) then DELETE /portfolio/orders/batched with the collected IDs. There is no single “cancel all” verb.Polymarket currently iterates cancel_order per open order. The CLOB has native DELETE /cancel-all and DELETE /cancel-market-orders endpoints; switching to those is a planned follow-up once the V2 SDK exposes them.
let cancelled = ex.cancel_all_orders(None).await?;
println!("cancelled {} orders", cancelled.len());

let scoped = ex.cancel_all_orders(Some("KXBTC-25MAR14-T20000")).await?;
[
  {
    "id": "abc123",
    "market_id": "KXBTC-25MAR14-T20000",
    "outcome": "Yes",
    "side": "buy",
    "price": 0.42,
    "size": 100.0,
    "filled": 0.0,
    "status": "Cancelled",
    "created_at": "2026-04-28T10:00:00Z"
  }
]