Cancel only buy or only sell orders (b=), by exchange
You have a buy limit waiting below the market and a sell limit waiting above it. Your strategy wants the buy gone and the sell kept. Add b= to the cancel:
c=order b=buyOn most exchanges that cancels your open buy orders on the symbol and leaves the sells. Leave b= out and both sides go. The catch is that a few exchanges read b= as the side of the position, not the side of the order, one family ignores it, and some use it to pick spot or margin as well. This page comes from the Autoview integrations code that runs on our servers today. We read the code; we did not run each exchange live for this guide. Test your own line with d=1 before you rely on it.
Exchanges that match the order's own side
On these, b=buy keeps only orders that buy and b=sell keeps only orders that sell. A stop-loss under a long is a sell order, so c=order b=sell cancels it.
- Alpaca, Binance spot, Binance.US, Bitfinex, Bitget spot, BitMEX, Bybit, Bybit copy trading, Capital.com, Coinbase Advanced, Crypto.com, Deribit, Gate.io spot and futures, Gemini, HTX spot, HTX USDT-margined swaps, Hyperliquid, Kraken, Kraken Futures, KuCoin, KuCoin Futures, OANDA, OKX and Tradovate.
- OANDA matches the side of entry orders, but its stop-loss, take-profit and trailing-stop orders count as buy orders, as described below.
- Charles Schwab and TradeStation also match the order side, with the exact-match gap described below.
Exchanges that match the position side
- Binance USD-M and COIN-M futures. Autoview sorts each order by the position it belongs to. In hedge mode that is the order's position side. In one-way mode, a reduce-only or close-position order counts as the side it closes. So a reduce-only sell that protects a long counts as the long side:
c=order b=buycancels your long entries and that stop, andc=order b=sellleaves the stop alone. - Bitget futures matches the order's position side (long or short) the same way. In hedge mode,
b=buycancels everything on your long side, closing orders included. We have not confirmed what Bitget reports as the position side in one-way mode, so test there withd=1.
Exchanges that ignore b= on a cancel
HTX coin-margined futures and coin-margined swaps list every open order on the contract and cancel all of them. b= does nothing there, and neither do the other cancel filters. To keep one side, use a separate account.
Bitget copy trading and KuCoin Futures copy trading do not cancel open orders at all. See cancel orders by price for that case.
Where b= also picks spot or margin
On some exchanges b=long and b=short are not just another way to say buy and sell. They also choose which orders Autoview looks at.
- Binance spot. With no
b=, the cancel covers spot, cross margin and isolated margin orders on the symbol.b=buyorb=selllooks at spot orders only.b=longorb=shortlooks at margin orders only. - Kraken.
b=buyandb=sellmatch orders without leverage.b=longandb=shortmatch leveraged orders only. - OKX.
b=buyandb=sellskip margin orders.b=longandb=shortmatch margin orders only, so on a perpetual swap,b=longmatches none of your plain open orders. Algo orders (stops, take-profits) are matched on side alone. - Bitfinex.
b=longandb=shortskip exchange (non-margin) orders.
Four things to watch
- On OANDA, stops and targets count as buy orders. OANDA attaches stop-loss, take-profit and trailing-stop orders to a trade and gives them no size. Autoview decides an order's side from the sign of its size, so these all land on the buy side.
c=order b=buycancels every one of them on the instrument, including the stop protecting a short.c=order b=sellleaves them all in place, even the stop under a long. To cancel only stop-losses, usec=order sl=1and leaveb=off. See cancel only stop-loss, take-profit or trailing orders. - Charles Schwab compares the exact instruction.
b=buymatches BUY andb=sellmatches SELL. An order Autoview placed withro=goes out as BUY_TO_CLOSE or SELL_TO_CLOSE, so ab=cancel skips it. Leaveb=off to include those. - TradeStation is not confirmed for options and shorts. Autoview compares the order's side to Buy or Sell. Options orders go out as buy-to-open, sell-to-close and so on. We have not seen what TradeStation reports back for those, so a
b=cancel may skip them. See TradeStation options open and close. - Use a value Autoview knows.
buy,bidandlongmean the buy side;sell,askandshortmean the sell side. Anything else, such asb=both, is treated assellon most exchanges and ignored on a few.b=flatis a different command: it turns the line intoc=all, which also closes positions. See close or reverse, by exchange.
Combine b= with the other filters
b= stacks with the other cancel filters where the exchange reads them. c=order b=sell t=open on Binance spot cancels sell limits and keeps sell stops. Check each filter for your venue first: id=, fp=, cm= and cmo= and t=. If several strategies share one symbol, several strategies on one account shows how to keep their cancels apart.
Test it once before you rely on it
Add d=1 to your cancel line. Autoview lists each order it would cancel in your log and cancels nothing. The log guide shows where to look.