Sizing spot orders in currency
By default a plain q= is counted in the coin. On a Bitcoin pair, q=0.01 buys 0.01 BTC. Add u=currency and the same number is counted in the quote currency instead. This alert buys about 100 USDT worth of BTC:
e=binance s=BTCUSDT b=buy q=100 u=currencyThis page covers opening orders on spot exchanges: where u=currency works, which price it converts at, and the cases where it does nothing. It comes from the Autoview integrations code that runs on our servers today, read exchange by exchange.
How u=currency works
- It divides by the order price. Autoview takes your
q, divides it by the price the order will use, and sends the result as the coin amount.q=100at a price of 50,000 becomes 0.002 BTC, then rounded to the exchange's order step. - The quote currency is the second half of the pair. On BTCUSDT it is USDT, on ETHBTC it is BTC, on Kraken's XBT/EUR it is EUR. Autoview does not convert between currencies, so pick a pair quoted in what you want to spend.
- Percentages ignore it. When
qends in a percent sign, Autoview skips the conversion.q=10%is 10% of your balance with or withoutu=currency. - Anything else means the default. The default is
u=contracts, the exchange's own unit. Autoview only checks for the wordcurrency, so a typo such asu=usdquietly leaves the size in the coin. - It works on buys and sells. On most spot exchanges
q=100 u=currencyon a sell sells about 100 USDT worth of the coin. Bybit is the exception, below.
Which price the conversion uses
The conversion uses the same price as the order itself:
- A market buy uses the best ask. A market sell uses the best bid.
- A limit order starts from the other side of the book (the bid for a buy) and moves by your
p=offset. fp=sets a fixed price, and the conversion uses it.- On exchanges that read
price=(Alpaca, Binance.US, Bitget, Bybit and Kraken in this list), that value is used first.
So on a limit buy placed below the market, q=100 u=currency buys a little more coin than it would at the ask, because 100 is divided by a lower price.
Exchanges where u=currency works on spot orders
- Alpaca
- Binance (spot) and Binance.US
- Bitfinex
- Bitget (spot)
- Coinbase Advanced
- Crypto.com
- Gate.io (spot)
- Gemini
- Kraken
- Kucoin (spot)
- Bybit (spot), buys only, see below
On Coinbase Advanced, Gate.io and Bitget, those exchanges take a market buy as a quote amount, so Autoview converts the coin amount back. Your market buy goes out as close to the currency amount you wrote, after rounding to the coin step.
Exchange rules to know
- Bybit spot sells stay in the coin. On a Bybit spot buy,
u=currencydivides by the price as usual. On a Bybit spot sell, Autoview does not convert, soq=100 u=currencyasks to sell 100 of the coin, not 100 USDT worth. Use a percentage to sell part of a Bybit spot balance, or dropu=currencyand write the coin amount. - Kraken, Alpaca and Bitfinex also trade with leverage. The conversion on a leveraged open is the same division by price, and the leverage is not applied to your
q.q=100 u=currencyopens about 100 of the quote currency in notional size, not 100 of margin. Which exchanges receive yourl=at all is listed in leverage by exchange.
What this page does not cover
- Closing positions. We have not verified how
u=currencybehaves on ac=positionclose. Leaveu=off close alerts and close with a percentage. Partial closes by exchange shows how. - Futures, perpetuals and brokers. Contract units differ by venue, and we have not finished checking how each one converts a currency amount. Until this page lists one, test it with
d=1first. - HTX (spot) and Charles Schwab. Not checked to the same standard yet, so they are left off the list above.
Test it once before you rely on it
Add d=1 to the alert. Autoview writes the order it would send to your log and places nothing, so you can check that the coin amount matches the currency amount you meant. When it looks right, take d=1 off. The log guide shows where to look, and the command reference covers q= and y=equity in full.