API naming convention: WhiteBIT’s API uses “collateral” endpoints for both
Margin and Futures trading. The market pair determines the product:
spot pairs (e.g.,
BTC_USDT) for Margin, perpetual pairs (e.g., BTC_PERP)
for Futures. All endpoints under /api/v4/order/collateral/ and
/api/v4/collateral-account/ serve both products.Prerequisites
- A WhiteBIT account (register)
- An API key with Trading permission (create one)
- Funds in the Collateral balance (transfer from Main balance if needed — see Balances & Transfers)
- Familiarity with HMAC-SHA512 signing — see Authentication
Authentication Helper
All Python examples in the steps below use the following signing helper. See Authentication for the full explanation.Steps
- Margin Trading
- Futures Trading
Margin Trading uses spot pairs (e.g.,
BTC_USDT) with up to 10x leverage.1
Check collateral balance
Verify available collateral funds.Expected response:The response maps each collateral asset to an available balance amount.
- cURL
- Python
2
Set leverage
Set the account leverage to 5x. Leverage applies account-wide across all collateral positions.Expected response:Allowed leverage values: 1, 2, 3, 5, 10. Margin Trading supports up to 10x.
- cURL
- Python
3
Place a collateral limit order
Create a limit buy order on BTC_USDT. Set the price well below the current market price — the order remains open without filling, allowing safe testing.Expected response:When a collateral limit order fills, a position is created. Open positions include a
- cURL
- Python
liquidationPrice field — monitor the liquidation price for risk management. See the open positions endpoint for details.4
Check open positions
Query open positions. If the limit order from the previous step has not filled, the response is empty. Once an order fills, positions appear with key risk fields.Expected response (when a position exists):Key fields:
- cURL
- Python
basePrice (entry price), liquidationPrice (price at which the position is force-closed), positionSide (LONG, SHORT, or BOTH), margin (funds allocated to the position).5
Cancel the order
Cancel the limit order to release the reserved collateral.To close an open position (after a filled order), use the close position endpoint with
- cURL
- Python
positionId and market:BTC_USDT vs. BTC_PERP).
What just happened?
What just happened?
Collateral balance isolation — Leveraged trading requires funds in the Collateral balance specifically. Depositing to the Main balance is not sufficient — an explicit transfer to Collateral is required before any collateral order can be placed. The Collateral balance is shared between Margin and Futures; there is no separate pool per product.How leverage amplifies risk — At 5x leverage, 1 USDT of collateral controls 5 USDT of market exposure. A 20% adverse price move against a 5x position wipes the allocated margin entirely, triggering partial liquidation. WhiteBIT’s partial liquidation mechanism closes 20–30% of the position first to restore margin; full liquidation follows only if that is insufficient. The
liquidationPrice field in position responses shows exactly where this occurs — monitor it alongside the collateral balance in production.Why the pair name determines the product — The API has no “margin” or “futures” parameter. The endpoint paths (/api/v4/order/collateral/limit, etc.) are identical for both products. Sending BTC_USDT routes the order to Margin Trading; sending BTC_PERP routes it to Futures Trading. Leverage is also set account-wide — a single call to /api/v4/collateral-account/leverage affects all open and future positions across both products.What’s Next
Margin Trading Overview
Capabilities, integration patterns, and risk context for up to 10x leverage.
Futures Trading Overview
Perpetual contracts, Hedge Mode, funding rates, and risk mechanics.
API Reference
Full endpoint documentation for all 19 collateral trading endpoints.