Futures trading
Base URL for all endpoints in this module:
https://openapi.bitbaby.com/futures/openFull URL =
{baseurl}{requestPath}, e.g.https://openapi.bitbaby.com/futures/open/fapi/v1/order.When signing,
requestPathmust be/fapi/v1/...only — do not include the gateway prefix/futures/open. See General information → Signed endpoints.
General
Security: NONE
Public endpoints below require no API key or signature.
Test connectivity
GET /fapi/v1/ping
Checks REST API connectivity.
200
{}Server time
GET /fapi/v1/time
200
{
"serverTime": 1607702400000,
"timezone": "China Standard Time"
}Response
| Field | Type | Description |
|---|---|---|
| serverTime | long | Server time (ms) |
| timezone | string | Timezone name |
Contracts
GET /fapi/v1/contracts
Returns metadata for all contracts. Optional header brokerId filters by broker.
200
[
{
"symbol": "E-BTC-USDT",
"type": "E",
"status": 1,
"side": 1,
"multiplier": 0.001,
"multiplierCoin": "BTC",
"pricePrecision": 2,
"minOrderVolume": 1,
"minOrderMoney": 0.001,
"maxMarketVolume": 100000,
"maxMarketMoney": 10000000,
"maxLimitVolume": 1000000,
"maxLimitMoney": 1000000,
"maxValidOrder": 20
}
]Response
| Field | Type | Description |
|---|---|---|
| symbol | string | Contract, e.g. E-BTC-USDT |
| status | number | 0 not tradable / 1 tradable |
| type | string | E perpetual, S simulated, other = mixed |
| side | number | 0 inverse / 1 linear |
| multiplier | number | Contract size |
| multiplierCoin | string | Size unit |
| pricePrecision | number | Price decimals |
| minOrderVolume | number | Min order size |
| minOrderMoney | number | Min notional |
| maxMarketVolume | number | Max market size |
| maxMarketMoney | number | Max market notional |
| maxLimitVolume | number | Max limit size |
| maxValidOrder | number | Max open orders |
Market data
Security: NONE
Market endpoints require no API key or signature.
Order book depth
GET /fapi/v1/depth
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract, e.g. E-BTC-USDT |
| limit | integer | Default 100; max 100 |
200
{
"time": 1595563624731,
"bids": [
["3.90000000", "431.00000000"],
["4.00000000", "431.00000000"]
],
"asks": [
["4.00000200", "12.00000000"],
["5.10000000", "28.00000000"]
]
}Each level is [price, size], sorted best price first.
24h ticker
GET /fapi/v1/ticker
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract, e.g. E-BTC-USDT |
200
{
"high": "9279.0301",
"low": "9279.0301",
"last": "9200",
"vol": "1302",
"rose": "0",
"time": 1595563624731
}All tickers
GET /fapi/v1/all_ticker
Returns a Map<contractName, ticker> with the same fields as above.
Index / mark price
GET /fapi/v1/index
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract, e.g. E-BTC-USDT |
200
{
"contractName": "E-ETH-USDT",
"indexPrice": 646.3933333333333,
"markPrice": 581.5,
"lastFundingRate": 0.001,
"time": 1608273554063
}All-contracts index price
GET /fapi/v1/get_all_indexPrice
Returns Map<contractName, BigDecimal> of all index prices.
All-contracts index + mark prices
GET /fapi/v1/public_all_index_tag_price
Returns symbol, indexPrice, markPrice per contract.
K-lines / candles
GET /fapi/v1/klines
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract, e.g. E-BTC-USDT |
| interval* | string | One of 1min, 5min, 15min, 30min, 1h, 1day, 1week, 1month |
| limit | integer | Default 100; max 300 |
| startTime | long | Start time (ms) |
| endTime | long | End time (ms) |
200
[
{
"idx": 1594640340,
"open": "6228.77",
"close": "6228.77",
"high": "6228.77",
"low": "6228.77",
"vol": "111"
}
]Trading
Security: TRADE
Every trading endpoint requires the same headers; we don't repeat them in each section.
| Header | Type | Description |
|---|---|---|
| X-CH-APIKEY* | string | API key |
| X-CH-TS* | string | Timestamp (ms) |
| X-CH-SIGN* | string | HMAC-SHA256 hex |
| Content-Type* | string | application/json |
Place order
POST /fapi/v1/order
Places a single order (limit or market).
Request body
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract, e.g. E-BTC-USDT |
| volume* | number | Contracts; for market open, this is notional value |
| side* | string | BUY / SELL |
| type* | string | LIMIT / MARKET |
| open* | string | OPEN / CLOSE |
| positionType* | number | 1 cross / 2 isolated |
| price | number | Required for LIMIT |
| clientOrderId | string | Client order id (< 32 chars) |
| timeInForce | string | IOC, FOK, POST_ONLY |
200
{
"orderId": 256609229205684228
}Conditional order
POST /fapi/v1/conditionOrder
Places a trigger-price order (stop-loss / take-profit / trailing).
Request body
In addition to the fields of Place order:
| Name | Type | Description |
|---|---|---|
| triggerType* | number | 3 stop-loss / 4 take-profit |
| triggerPrice* | number | Trigger price |
| trailCallbackRatio | number | Trailing callback ratio (trailing stops) |
200
{
"orderId": 256609229205684228
}Cancel order
POST /fapi/v1/cancel
Rate limit: 20 req / 2s
Request body
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract, e.g. E-BTC-USDT |
| orderId* | string | Order id |
200
{
"orderId": 256609229205684228
}Batch place
POST /fapi/v1/batchOrders
Alias POST /fapi/v1/placeBatchOrder behaves identically.
Request body
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract |
| orders* | array | Array of orders; each item uses the Place order body |
200
{
"ids": ["256609229205684228", "256609229205684229"]
}Batch cancel
POST /fapi/v1/batchCancel
Request body
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract |
| orderIds* | array | Order ids to cancel |
200
{
"success": ["256609229205684228"],
"failed": ["256609229205684229"]
}Order detail
GET /fapi/v1/order
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName* | string | Contract |
| orderId | string | Order id (or use clientOrderId) |
| clientOrderId | string | Client order id |
200
{
"orderId": 259396989397942275,
"contractName": "E-BTC-USDT",
"side": "BUY",
"action": "OPEN",
"type": "LIMIT",
"price": 10000,
"origQty": 1,
"executedQty": 0,
"avgPrice": 0,
"transactTime": "1607702400000",
"status": "INIT",
"fills": []
}Response
| Field | Type | Description |
|---|---|---|
| orderId | long | Order id |
| contractName | string | Contract |
| side | string | BUY / SELL |
| action | string | OPEN / CLOSE |
| type | string | LIMIT / MARKET |
| price | number | Order price |
| origQty | number | Order quantity |
| executedQty | number | Filled quantity |
| avgPrice | number | Average fill price |
| transactTime | string | Create time (ms) |
| status | string | INIT / NEW / PARTIALLY_FILLED / FILLED / CANCELED / REJECTED |
| fills | array | Fills array |
Open orders
GET /fapi/v1/openOrders
Returns the user's open orders. contractName is optional; omit it to query across all contracts.
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName | string | Contract (optional) |
200 Same shape as the Order detail array.
Open orders count (paginated)
POST /fapi/v1/openOrdersCount
Useful for paginated browsing of open orders.
Request body
| Name | Type | Description |
|---|---|---|
| contractId | integer | Contract id (optional) |
| page | integer | Page number (1-based) |
| pageSize | integer | Page size |
200
{
"code": "0",
"data": {
"count": 12,
"orderList": [ /* same shape as openOrders */ ]
}
}Order history
POST /fapi/v1/orderHistorical
Request body
| Name | Type | Description |
|---|---|---|
| contractName | string | Contract (optional; omit for all) |
| limit | integer | Page size; default 100; max 1000 |
| fromId | long | Start after this order id |
200
[
{
"orderId": 777293886968070157,
"contractName": "E-BTC-USDT",
"side": "BUY",
"openOrClose": "OPEN",
"positionType": 2,
"type": 4,
"price": 41000,
"volume": 2,
"dealVolume": 1,
"dealMoney": 4.1,
"avgPrice": 41000,
"leverageLevel": 26,
"openTakerFeeRate": 0.00065,
"openMakerFeeRate": 0.00025,
"closeTakerFeeRate": 0.00065,
"closeMakerFeeRate": 0.00025,
"status": 4,
"ctime": "2021-09-29T16:16:51",
"ctimeMs": 1632903411000
}
]PnL history
POST /fapi/v1/profitHistorical
Same request body as Order history.
200
[
{
"id": 8764,
"contractId": 1,
"side": "SELL",
"positionType": 2,
"leverageLevel": 26,
"openPrice": 44500,
"openEndPrice": 44500,
"volume": 900,
"tradeFee": -5.23575,
"capitalFee": 0,
"shareAmount": 0,
"closeProfit": -45,
"settleProfit": 0,
"realizedAmount": 0,
"historyRealizedAmount": -50.23575,
"ctime": 1632882691000,
"mtime": 1632882739000
}
]User trades
GET /fapi/v1/myTrades
Rate limit: 20 req / 2s
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName | string | Contract, e.g. E-BTC-USDT |
| limit | integer | Page size; default 100; max 1000 |
| fromId | long | Start from this trade id |
200
[
{
"tradeId": 100211,
"symbol": "E-BTC-USDT",
"contractName": "E-BTC-USDT",
"bidId": 150695552109032492,
"askId": 150695552109032493,
"bidUserId": 10024,
"askUserId": 10025,
"price": "4.00000100",
"qty": "12.00000000",
"amount": "48.00",
"time": 1499865549590,
"side": "BUY",
"isBuyer": true,
"isMaker": false,
"fee": "0.001"
}
]Open / close / ADL / liquidation records
GET /fapi/v1/tradesRecord
Paginated user fills with open/close direction labels. Same parameters as User trades.
GET /fapi/v1/adlRecord
Auto-deleveraging records. contractName required, paging same as above.
GET /fapi/v1/liquidationList
Liquidation records.
Conditional orders
| Method | Path | Description |
|---|---|---|
| POST | /fapi/v1/profitLossOrder | Create stop-loss / take-profit attached to a position |
| POST | /fapi/v1/trigger_order_list | List trigger orders |
| POST | /fapi/v1/cancel_trigger_order | Cancel a trigger order |
profitLossOrder body — main fields:
| Name | Type | Description |
|---|---|---|
| contractName | string | Contract |
| positionId | integer | Position id |
| side | string | BUY / SELL |
| positionType | integer | 1 cross / 2 isolated |
| orderList | array | Sub trigger orders |
orderList[] items:
| Name | Type | Description |
|---|---|---|
| triggerType | integer | 3 stop-loss / 4 take-profit |
| triggerPrice | number | Trigger price |
| price | number | Order price after trigger |
| volume | number | Order quantity after trigger |
| type | integer | Order type |
| expiredTime | integer | Expiry time (ms) |
| tagPriceTrigger | integer | 1 use mark price / 0 use last trade price |
Account
Security: USER_DATA
Account endpoints require API key + signature. Headers as in Trading.
Account information
GET /fapi/v1/account
Rate limit: 20 req / 2s
200
{
"account": [
{
"marginCoin": "USDT",
"accountNormal": 999.5606,
"accountLock": 23799.5017,
"partPositionNormal": 9110.7294,
"totalPositionNormal": 0,
"achievedAmount": 4156.5072,
"unrealizedAmount": 650.6385,
"totalEquity": 99964804.560,
"partEquity": 13917.8753,
"totalCost": 0,
"totalMarginRate": 0,
"sumMarginRate": 873.4608,
"positionVos": [
{
"contractId": 1,
"contractName": "E-BTC-USDT",
"contractSymbol": "BTC-USDT",
"positions": [
{
"id": 13603,
"contractId": 1,
"positionType": 2,
"side": "BUY",
"volume": 69642.0,
"openPrice": 11840.2394,
"avgPrice": 11840.3095,
"leverageLevel": 24,
"holdAmount": 7014.2111,
"marginRate": 0.2097,
"reducePrice": 9740.8083,
"unRealizedAmount": 2164.5289,
"realizedAmount": 8115.9125,
"positionBalance": 82458.2839,
"indexPrice": 12151.1175,
"status": 1
}
]
}
]
}
]
}Response — quick guide:
| Section | Key fields | Notes |
|---|---|---|
| Account | marginCoin, accountNormal, accountLock, totalEquity, partEquity | Margin asset, balance, locked, cross/isolated equity |
| Account | unrealizedAmount, achievedAmount, sumMarginRate | Unrealized PnL, realized PnL, account margin ratio |
| Position | positionVos[].positions[] | Per-contract position list |
| Position | volume, avgPrice, leverageLevel, positionType, side | Size and leverage |
| Position | marginRate, reducePrice, unRealizedAmount, indexPrice | For risk monitoring / liquidation alerts |
Full field reference below.
account[] fields
| Field | Type | Description |
|---|---|---|
| marginCoin | string | Margin asset |
| accountNormal | number | Wallet balance |
| accountLock | number | Locked margin |
| partPositionNormal | number | Isolated margin balance |
| totalPositionNormal | number | Cross initial margin in use |
| achievedAmount | number | Realized PnL |
| unrealizedAmount | number | Unrealized PnL |
| totalEquity | number | Cross equity |
| partEquity | number | Isolated equity |
| totalCost | number | Cross cost |
| totalMarginRate | number | Cross margin ratio |
| sumMarginRate | number | Account margin ratio |
| positionVos | array | Positions grouped by contract |
positionVos[].positions[] fields
| Field | Type | Description |
|---|---|---|
| id | integer | Position id |
| positionType | integer | 1 cross / 2 isolated |
| side | string | BUY long / SELL short |
| volume | number | Size |
| openPrice | number | Entry price |
| avgPrice | number | Average price |
| leverageLevel | number | Leverage |
| holdAmount | number | Margin held |
| realizedAmount | number | Realized PnL |
| historyRealizedAmount | number | Cumulative realized PnL |
| unRealizedAmount | number | Unrealized PnL |
| openRealizedAmount | number | Open-leg unrealized |
| positionBalance | number | Position value |
| marginRate | number | Margin rate |
| reducePrice | number | Liquidation / reduce price |
| returnRate | number | Return rate |
| indexPrice | number | Mark price |
| keepRate | number | Tiered maintenance margin rate |
| maxFeeRate | number | Max close fee rate |
| tradeFee | number | Trade fee |
| capitalFee | number | Funding fee |
| shareAmount | number | Socialized loss share |
| freezeLock | integer | 0 normal / 1 liquidation freeze / 2 delivery freeze |
| status | integer | 0 invalid / 1 valid |
Positions
GET /fapi/v1/positions
Query parameters
| Name | Type | Description |
|---|---|---|
| contractName | string | Contract (optional) |
200
{
"positions": [
/* each item matches account.positionVos[].positions[] */
]
}Capital flow
GET /fapi/v1/capital
Query parameters
| Name | Type | Description |
|---|---|---|
| beginTime | long | Start time (ms) |
| endTime | long | End time (ms) |
| page | integer | Page |
| limit | integer | Page size |
200
{
"records": [
{
"contractName": "E-BTC-USDT",
"type": "TRADE_FEE",
"amount": "-0.123",
"balance": "1000.5",
"time": 1607702400000
}
]
}Adjust leverage / position model
| Method | Path | Description |
|---|---|---|
| POST | /fapi/v1/edit_lever | Adjust leverage for a contract |
| POST | /fapi/v1/level_edit | Legacy alias for leverage adjustment |
| POST | /fapi/v1/edit_user_position_model | Switch cross / isolated mode |
| POST | /fapi/v1/edit_user_margin_model | Switch margin model |
| POST | /fapi/v1/trigger_time_edit | Adjust trigger expiry time |
edit_lever request example:
{
"contractName": "E-BTC-USDT",
"leverageLevel": 20,
"positionType": 2
}Funds transfer (RSA-signed)
Different from HMAC endpoints
The two endpoints below use a separate RSA signing scheme. They require the request headers Ex-sign and Ex-ts and do not reuse X-CH-SIGN / X-CH-TS. They are reserved for institutional integrations — please contact support to obtain an RSA key pair before using them.
| Header | Description |
|---|---|
Ex-ts | Timestamp (ms) |
Ex-sign | Base64 RSA signature over JSON.stringify(body) + Ex-ts |
| Method | Path | Description |
|---|---|---|
| POST | /fapi/v1/futures_transfer | Transfer between spot and futures wallets |
| POST | /fapi/v1/futures_balance | Query futures wallet balance |