Binance command reference
This page lists every command parameter Autoview reads for Binance spot and Binance margin, and what each one does there. Autoview takes a webhook from whatever sends it: a charting alert, a script, your own server. The command inside that webhook is what this page covers. If you haven't connected Binance yet, start with getting started with Binance. For the parameters every exchange shares, see the command reference.
We built this list by reading Autoview's Binance connector line by line. If a parameter isn't here, the connector doesn't read it. These commands were read from code, not run live, so send each one with d=1 first and read the log before you trade.
Write Binance pairs with no separator: BTCUSDT, not BTC/USDT. Every example below ends in d=1, which builds the order and sends nothing. Remove it only when the log shows what you meant.
This page covers the binance connection only. Binance USD-M futures, COIN-M delivery, Binance.US and the testnets are separate connections with their own commands. To rehearse spot orders with demo funds, see the Binance Testnet guide.
The basics
A command is one line of key=value pairs separated by spaces. The order of the pairs doesn't matter. Here is a limit buy 5% under the market for 0.001 BTC:
e=binance s=BTCUSDT b=buy p=-5% q=0.001 d=1e=binance tells the Chrome extension to route the order to Binance. On the webhook platform the webhook already belongs to your Binance account, so you can leave e= off.
Two parameters need care on every order. b= is required, and it has to be spelled right (see the warning below). q= defaults to 100% of your available balance, so set it every time.
A misspelled b= becomes a sell. Autoview only checks that b= is there. It accepts buy and sell, long and short, and also bid and ask. Any other value, such as b=by, goes to Binance as a sell order sized from your base coin. Leaving b= off entirely gives an invalid order book error instead.
Parameter table
| Parameter | What it does on Binance | Test line |
|---|---|---|
e= | Routes the command to Binance on the Chrome extension. | e=binance s=BTCUSDT b=buy p=-5% q=0.001 d=1 |
a= | Picks which saved Binance key to use, by the name you gave it. Leave it off if you only have one key. | e=binance a=main s=BTCUSDT b=buy p=-5% q=0.001 d=1 |
s= | The pair, in Binance's form. Autoview checks it against Binance's list of pairs and rejects one it can't find. | e=binance s=ETHUSDT b=buy p=-5% q=0.01 d=1 |
b= | Side: buy or sell for spot, long or short for margin. Required. | e=binance s=BTCUSDT b=sell p=5% q=0.001 d=1 |
t= | Order type: limit (the default), market, ioc, or fok. | e=binance s=BTCUSDT b=buy t=market q=0.001 d=1 |
p= / fp= | Limit price. p= is an offset from the current best price, fp= is a fixed price. | e=binance s=BTCUSDT b=sell fp=150000 q=0.001 d=1 |
q= | Size in the base coin (the BTC in BTCUSDT). A percent uses that share of your available balance. | e=binance s=BTCUSDT b=buy p=-5% q=25% d=1 |
u=currency | Reads q= as an amount of the quote coin instead. | e=binance s=BTCUSDT b=buy p=-5% q=20 u=currency d=1 |
y=equity | Makes a percent q= count funds locked in open orders too. | e=binance s=BTCUSDT b=sell p=5% q=50% y=equity d=1 |
h= | Iceberg. Shows only part of a limit order on the book. | e=binance s=BTCUSDT b=buy p=-5% q=0.01 h=10% d=1 |
sl= / fsl= | Places a stop-loss order on the opposite side of b=. | e=binance s=BTCUSDT b=buy sl=-3% p=-4% q=0.001 d=1 |
tp= / ftp= | Places a take-profit order on the opposite side of b=. | e=binance s=BTCUSDT b=buy tp=5% p=4% q=0.001 d=1 |
ts= / fts= | Trailing distance, sent as Binance's trailing delta in basis points. Pair it with sl= or tp=. | e=binance s=BTCUSDT b=buy sl=-3% p=-4% ts=1% q=0.001 d=1 |
oco= / px= / fpx= | One-cancels-the-other: a limit leg at p= and a stop leg triggered at px=. | e=binance s=BTCUSDT b=sell p=5% px=-3% sl=-4% oco=1 q=0.001 d=1 |
lt= | Margin account for b=long and b=short: lt=isolated for isolated margin, otherwise cross. | e=binance s=BTCUSDT b=long lt=isolated p=-1% q=0.001 d=1 |
y=borrow / y=repay | On a margin order, borrows what the order needs or repays your loan after it fills. | e=binance s=BTCUSDT b=long p=-1% q=0.001 y=borrow d=1 |
id= | Tags the order with your own client order ID, so a later cancel can target it. | e=binance s=BTCUSDT b=buy p=-5% q=0.001 id=dip1 d=1 |
c=order | Cancels open orders on the pair. | e=binance s=BTCUSDT c=order d=1 |
cm= / cmo= | Cancel only some orders. cm= is how many, cmo= is which ones. | e=binance s=BTCUSDT b=buy c=order cm=1 cmo=oldest d=1 |
w= / y= | Moves a coin between your Binance wallets. w= is the coin, y= is the direction. | e=binance w=USDT y=futures q=50 d=1 |
d= | d=1 builds the order, cancel, or transfer, logs it, and sends nothing to Binance. | e=binance s=BTCUSDT b=buy p=-5% q=0.001 d=1 |
Order types
t= picks the order type. Without it you get a limit order that stays open until it fills or you cancel it.
| Command | What Autoview sends |
|---|---|
e=binance s=BTCUSDT b=buy p=-5% q=0.001 d=1 | A limit buy 5% under the best bid, good until cancelled. |
e=binance s=BTCUSDT b=sell t=market q=0.001 d=1 | A market sell of 0.001 BTC. |
e=binance s=BTCUSDT b=buy t=ioc p=0.1% q=0.001 d=1 | A limit buy that fills what it can right away and cancels the rest. |
e=binance s=BTCUSDT b=buy t=fok p=0.1% q=0.001 d=1 | A limit buy that fills in full right away or not at all. |
Any other t= value, including t=post and t=gtc, falls back to a plain limit order. There is no post-only option on this connection.
Setting the price
With no price at all, a limit buy sits at the best bid and a limit sell at the best ask. Autoview reads those from Binance's order book ticker when the command arrives.
p= moves the price from there. The sign is the direction: p=-5% is 5% lower, p=2% is 2% higher, and p=-100 is 100 USDT lower on BTCUSDT. fp= sets a fixed price instead:
e=binance s=BTCUSDT b=sell fp=150000 q=0.001 d=1Autoview rounds the price and size to the decimals Binance allows for the pair, which it reads from Binance's exchange info.
Sizing
q= reads three ways.
- A number is base coin.
q=0.001onBTCUSDTis 0.001 BTC. That holds for market buys too. - A percent is a share of your free balance. For a buy that's your USDT, converted to BTC at the order price. For a sell it's your BTC. Add
y=equityto count funds locked in open orders too. - With
u=currency, a number is quote coin.q=20 u=currencybuys about 20 USDT of BTC.
Binance has a minimum order value per pair. An order under it comes back rejected, so size test orders above it.
No q= means 100%. A command without a size uses your whole free balance. Write the size you mean on every order.
Stop-loss, take-profit and trailing orders
On Binance spot, sl= and tp= don't attach to an entry. Each one places its own order on the opposite side of b=. Write b= as the side of the trade you are protecting: b=buy sl=-3% places a sell stop under the market.
e=binance s=BTCUSDT b=buy sl=-3% p=-4% q=0.001 d=1That sends a stop-limit sell. When the price falls 3%, Binance places a limit sell 4% under today's price. Because it sells, a percent q= comes from your BTC, not your USDT.
Set p= on every stop. The stop trigger and the limit price are both measured from the price when the command arrives. Leave p= off and the limit sits at that old price, which can be above a falling market, so the stop may never fill. Add t=market instead if you want a market order once the stop triggers.
tp= works the same way for a target:
e=binance s=BTCUSDT b=buy tp=5% p=4% q=0.001 d=1fsl= and ftp= take a fixed trigger price instead of an offset. One command can't carry both sl= and tp=; that returns an unsupported feature error. Send two commands, or use OCO below.
ts= adds a trailing distance, sent to Binance as a trailing delta in basis points. ts=1% is 100 basis points. A plain number is a price distance: ts=500 on BTCUSDT is 500 USDT. fts= takes a fixed price and uses its distance from the current price.
e=binance s=BTCUSDT b=buy sl=-3% p=-4% ts=1% q=0.001 d=1Use ts= together with sl= or tp=. On its own, Autoview adds the trailing delta to a plain limit order, and Binance's API docs list trailing delta only for stop and take-profit types, so expect a rejection.
OCO orders
oco= with any value sends a one-cancels-the-other pair: a limit leg at p= and a stop leg that triggers at px= (or a fixed fpx=). When one leg fills, Binance cancels the other.
e=binance s=BTCUSDT b=sell p=5% px=-3% sl=-4% oco=1 q=0.001 d=1That rests a sell 5% above the ask and a stop that triggers 3% below, with its limit 4% below. Here b= is the real side of both legs; there's no flip.
px=is required. Without it the command fails.sl=ortp=sets the stop leg's limit price. Either name does the same thing here. Leave both off witht=marketfor a stop that becomes a market order.t=iocort=fokset the time in force on the stop leg.h=makes the limit leg an iceberg, andts=adds a trailing delta to the stop leg.- Prices must sit on the right side. Binance's rule for a sell OCO is limit price above the last price, stop trigger below it. A buy reverses that.
Margin orders with borrow and repay
b=long buys and b=short sells through your margin account instead of spot. Cross margin is the default. Add lt=isolated for isolated margin on that pair.
e=binance s=BTCUSDT b=long lt=isolated p=-1% q=0.001 d=1A percent q= on margin comes from that wallet's free balance of the coin, cross or isolated.
To have Binance borrow or repay for you, add y= to the margin order:
y=borrowasks Binance to borrow what the order needs.y=repayasks Binance to repay your loan after the order fills.
e=binance s=BTCUSDT b=short p=1% q=0.001 y=borrow d=1Autoview doesn't read ab= or ar= for Binance. Use y= instead. Keep y=borrow and y=repay on long and short orders; Binance's spot order docs don't list the field Autoview sends for them.
Two margin cautions. An OCO on margin always goes to cross margin, even with lt=isolated, because the OCO path never marks the order as isolated. And keep lt= off spot orders: with b=buy or b=sell, lt=isolated makes Autoview size from your isolated wallet while the order still goes to spot.
Autoview doesn't set leverage on Binance margin. It reads no l= here. c=position returns an unsupported feature error, so exit a margin position with an opposite long or short order.
Cancelling orders
c=order cancels open orders on the pair.
e=binance s=BTCUSDT c=order d=1b= narrows what gets cancelled:
- No
b=: spot orders plus cross and isolated margin orders.lt=crossorlt=isolatedlimits the margin part to one account. b=buyorb=sell: spot orders on that side only.b=longorb=short: margin orders on that side only.
If you don't use margin, add b=buy or b=sell. Without it, Autoview also asks for your margin orders, and a failed margin lookup shows up in the log as an exception even when the spot cancel works.
More filters:
fp=keeps only orders at that exact price.t=opencancels only plain limit orders.t=closecancels only the others, such as stops and take-profits.id=cancels only orders you placed with that sameid=.cm=andcmo=cancel a subset.cmo=acceptsnewest,oldest,lowest,highest,smallest,biggest, orrandom.
e=binance s=BTCUSDT b=buy c=order id=dip1 d=1Moving funds between wallets
w= names the coin and y= names the direction. w= takes a list, such as w=USDT,BTC. A w= without y= returns a "Wallet Type not found" error.
e=binance w=USDT y=futures q=50 d=1That moves 50 USDT from spot to your USD-M futures wallet.
| y= | Direction |
|---|---|
futures | Spot to USD-M futures. |
delivery | Spot to COIN-M delivery. |
spot-futures, spot-delivery | Back to spot. Use a fixed q=; Autoview reads no balance for these. |
margin, spot | Spot to cross margin, and back. |
isolated, spot-isolated | Spot to isolated margin, and back. Add s= for the pair. |
borrow, repay | Takes out or repays a margin loan in the w= coin. |
Expect the margin directions to fail. For the six margin directions (margin, spot, isolated, spot-isolated, borrow, repay), Autoview calls Binance endpoints that Binance's margin changelog lists as replaced, with a retirement date of March 31, 2024. Move those funds on Binance itself. The futures and delivery directions use a different endpoint with no retirement entry in Binance's wallet changelog.
Percent sizes read the source wallet's balance, including funds locked in orders. q= defaults to 100%, so on a y=borrow command with no q=, Autoview asks for the most Binance will lend. Write a fixed q= on every transfer.
What Binance doesn't support
These look like they should work and don't:
- No stop-loss and take-profit on one command. Send two commands or an OCO.
- No
c=positionorc=all. Both return an unsupported feature error, and so doesb=flat. Cancel withc=orderand exit with an opposite order. - No post-only.
t=postbecomes a plain limit order. - No leverage, reduce-only, or hedge flags.
l=,ro=andhedge=aren't read here. - No futures on this connection. Binance USD-M and COIN-M futures are separate connections with their own commands.
When a command does something you didn't expect, put d=1 back on it and compare the log with this page. For more on reading the log, see test and debug your setup.