Skip to main content

Frequently Asked Questions

Where are Bybit's servers located?

AWS Singapore, Availability Zone ID apse1-az3.

reduceOnly and closeOnTrigger - what's the difference?

  • To close your position, submit an order and specify reduceOnly to true. closeOnTrigger is not strictly applicable here, but you can also set it to true if it's required.
  • reduceOnly is the one that really matters for closing position, and we will improve the interface in the future.
  • Be careful when you specify closeOnTrigger to true as it could cause conflict when reduceOnly is false.

Why I get 10003 API key is invalid?

The most likely cause is that the key used does not match the domain name:
a. When request to api.bybit.com or stream.bybit.com, make sure the api key is created from Prodution production

# pybit example
session = HTTP(
testnet=False,
api_key="XXXXX",
api_secret="XXXXX",
)

b. When request to api-demo.bybit.com or stream-demo.bybit.com, make sure the api key is created from Production - demo trading prod-demo

# pybit example
session = HTTP(
testnet=False,
demo=True,
api_key="XXXXX",
api_secret="XXXXX",
)

c. When request to api-testnet.bybit.com or stream-testnet.bybit.com, make sure the api key is created from Testnet test

# pybit example
session = HTTP(
testnet=True,
demo=False,
api_key="XXXXX",
api_secret="XXXXX",
)

d. Do not use Testnet - Demo trading service, it is pointless test-demo

Why aren't all my orders showing on the website?

  • Users who have bots which place large numbers of laddered orders will be restricted by the frontend interface, which only shows a maximum of 50 orders on-screen.
  • Don't worry, your orders are still in the system and can be queried by the API, but the frontend cannot show more than 50.

Calculating order size based on available wallet balance

  • price * availableBalance * leverage * perc * (1 - (0.0006 * 2))
  • Unfortunately this is not a perfectly accurate formula; the real calculation is complex and may be published in the docs at a later date.
    • price - last price (or your entry price) - can be found with the Tickers.
    • availableBalance - can be found with the Position Info endpoint.
    • leverage - up to the respective maximum leverage for the market and your risk limit (eg 2, 10, 50).
    • perc - 0.1 for 10%, 0.25 for 25%, etc.
    • 1 - (0.0006 * 2) - used to calculate the maximum order cost (always assumes entry & exit orders use taker fee regardless actual fee).

Can I exchange assets with the API?

Yes, convert API, but currently there is no API to convert small balances to MNT

Can I crypto loan with the API?

Yes, crypto loan API

How do I get funds for testnet?

To get testnet funds, just go to master account asset page to request.

Why are my Closed PNL prices inaccurate?

  • The entryPrice and exitPrice returned by Closed PNL endpoints are not the actual execution prices of the orders.
  • It is based on the total costs of the order (whether or not the position was only opened/closed by one order executed at one price - it is more complicated if multiple orders opened/closed a position.)
  • For instance, the entry_price and exit_price reported by this endpoint are influenced by the fee paid/received on the orders.

How can I ensure I am using up-to-date data?

  • It is possible, although unlikely, that the REST API or (even less likely) the websocket could return/push old data.
  • For the greatest level of data resilience, we recommend clients to:
    • firstly, rely on the websocket, which will not only ensure you get the latest data as fast as possible, but will also ensure you get complete data
    • secondly, query the REST API to fill in any discrepencies in data - or between websocket disconnections.
  • The best practice is to save all of this data locally in your own database or cache.
  • This frees up your rate limits for other requests and also ensures a level of redundancy against the exchange in case of data delays.

What is the difference between turnover and volume?

  • Turnover: is in the opposite currency to the quantity's currency
  • Volume: is in the same currency as the quantity's currency

Why is the price returned in the place market order response wrong?

Market orders are (in the backend) just limit orders submitted at a worse price. This is to reduce the chance of a flash crash or a similar event, where a trader might submit a market order which executes at a significantly worse price than they expected it to. The price returned here is that internal limit order price. This "inaccurate" price is returned because the place order endpoint is asynchronous, meaning the response is returned to you before the order is actually executed.

If you want the true execution price (execPrice) you should subscribe to the execution websocket.

How can I process WebSocket snapshot and delta messages?

Please refer to the orderbook topic's documentation.

Note that if you're using pybit, it handles these messages for you and always delivers a complete orderbook. Working code examples:

  • Python: _process_delta_orderbook() method within pybit (the Python SDK)
  • Node.js: orderbooks, a library made by the creator of bybit-api (the Node.js SDK)

Why is the balance sufficient but Withdrawal or Transfer reports insufficient balance?

Scenario Reproduction: when the master account encounters error code 131001 (“Withdrawal amount is greater than your available balance (XXXX USDT)”) during withdrawal, or when transferring funds from a sub-account to the master account, encounters 131228 (“Your balance is not enough”), but calling Get All Coins Balance shows that transferBalance is sufficient.

/v5/asset/transfer/query-account-coins-balance?accountType=FUND
{
"retCode": 0,
"retMsg": "success",
"result": {
"memberId": "247200692",
"accountType": "FUND",
"balance": [
{
"coin": "BTC",
"transferBalance": "0.06",
"walletBalance": "0.06",
"bonus": ""
}
]
},
"retExtInfo": {},
"time": 1735189176388
}

Reason: this occurs due to recent deposits to the master or sub-account, which lock the corresponding USD value. For example, 1 ETH was deposited into the master account 5 minutes ago and immediately traded into 0.05 BTC. However, due to the deposit risk not being fully released, this 0.05 BTC cannot be withdrawn. Similarly, if the deposit is made to a sub-account, the corresponding amount cannot be transferred to the master account.
Recommendation: 1. If you need to confirm the available balance for withdrawal or transfer of a single currency, always use Get Single Coin Balance. Additionally, institutional loan accounts transferring out of risk unit may be affected by LTV and can use this API to query accurate transferable balances. See examples 4 and 5 below.

//Example 1: Query the withdrawal balance or transferable balance of a specific coin in a specific wallet of the current account.
GET /v5/asset/transfer/query-account-coin-balance?accountType=XXX&coin=XXX&withTransferSafeAmount=1
see field `transferSafeAmount`

//Example 2: Query the transferable balance of a specific coin to sub-accounts or other wallets within the account.
GET /v5/asset/transfer/query-account-coin-balance?accountType=XXX&coin=XXX&withTransferSafeAmount=1
see field `transferBalance`

//Example 3: Use the master account to query the transferable balance of a specific coin in a specific wallet of a sub-account.
GET /v5/asset/transfer/query-account-coin-balance?memberId=XXX&accountType=XXX&coin=XXX&withTransferSafeAmount=1
-> transfer to other sub-accounts or other wallets within the accounts: see field `transferBalance`
-> transfer to master account: see field `transferSafeAmount`

//Example 4: When transferring out of an institutional loan risk unit, the transferable balance under the LTV safety line (transfers within the account to funding wallets).
GET /v5/asset/transfer/query-account-coin-balance?withLtvTransferSafeAmount=1&accountType=UNIFIED&toAccountType=FUND&coin=XXX
see field `ltvTransferSafeAmount`

//Example 5: When transferring out of an institutional loan risk unit, the transferable balance under the LTV safety line (transfers to non-institutional loan accounts).
GET /v5/asset/transfer/query-account-coin-balance?withLtvTransferSafeAmount=1&toMemberId=XXX&accountType=UNIFIED&toAccountType=FUND&coin=XXX&
see field `ltvTransferSafeAmount`
  1. If you need to query the transferable balances of multiple coins simultaneously, use Get All Coins Balance. However, if there are recent deposits, the returned transferBalance field will be less than or equal to the actual withdrawal or transferable balance to the master account. Additionally, for institutional loan accounts transferring out of risk units, the result may also be inaccurate. In such cases, refer to examples 4 and 5 in Recommendation 1.
//Example 1: Query the balance of all coins in the funding wallet of the current account (after January 9, 2025, querying all coins will no longer be supported, and the coin parameter must be provided).
GET /v5/asset/transfer/query-account-coins-balance?accountType=FUND

//Example 2: Query the balance of specific coins in the unified wallet of the current account (after January 9, 2025, up to 10 coins can be queried).
GET /v5/asset/transfer/query-account-coins-balance?accountType=UNIFIED&coin=USDT,ETH,BTC,USDC

//Example 3: Query the balance of specific coins in the unified wallet of a specified sub-account.
GET /v5/asset/transfer/query-account-coins-balance?memberId=XXX&accountType=UNIFIED&coin=USDT,ETH,BTC,USDC
  1. If you need to know whether the master account has any unresolved deposit risks, use Get Withdrawable Amount. Check the limitAmountUsd field:
GET /v5/asset/withdraw/withdrawable-amount?coin=XXX
-> If it equals 0, it indicates that all deposit risks have been released.
-> If it is not 0, it indicates that some assets, equivalent to the displayed USD value, still have unresolved risks.