Futures Trading
Public Endpoints Security Type: None Public endpoints below can be freely accessed without API keys or signatures.
Test Connectivity GET https://api.xxx.com/futures/open/fapi/v1/ping
Tests connectivity to the REST API.
json {}
Get Server Time GET https://api.xxx.com/futures/open/fapi/v1/time
json { "serverTime": 1607702400000, "timezone": "China Standard Time" }
Response: Name Type Example Description serverTime long 1607702400000 Server timestamp (ms) timezone string China Standard Time Server timezone Contract List GET https://api.xxx.com/futures/open/fapi/v1/contracts
json [ { "symbol": "H-HT-USDT", "pricePrecision": 8, "side": 1, "maxMarketVolume": 100000, "multiplier": 6, "minOrderVolume": 1, "maxMarketMoney": 10000000, "type": "H", "maxLimitVolume": 1000000, "maxValidOrder": 20, "multiplierCoin": "HT", "minOrderMoney": 0.001, "maxLimitMoney": 1000000, "status": 1 } ]
Response: Name Type Example Description symbol string E-BTC-USDT Contract name status number 1 Contract status (0: non-tradable, 1: tradable) type string S Contract type (E: Perpetual, S: Simulation, Others: Hybrid) side number 1 Contract direction (0: Inverse, 1: Linear) multiplier number 0.5 Contract face value multiplierCoin string BTC Face value denomination pricePrecision number 4 Price precision (decimal places) minOrderVolume number 10 Minimum order quantity minOrderMoney number 10 Minimum order value maxMarketVolume number 100000 Max market order quantity maxMarketMoney number 100000 Max market order value maxLimitVolume number 100000 Max limit order quantity maxValidOrder number 100000 Max number of active orders Market Data Security Type: None Market data endpoints below can be freely accessed without API keys or signatures.
Order Book Depth GET https://api.xxx.com/futures/open/fapi/v1/depth
Market depth data.
Query Parameters Name Type Description limit integer Default 100; Max 100 contractName string Contract name e.g. E-BTC-USDT
json { "bids": [ ["3.90000000", "431.00000000"], // [Price, Quantity] ["4.00000000", "431.00000000"] ], "asks": [ ["4.00000200", "12.00000000"], ["5.10000000", "28.00000000"] ], "time": 1595563624731 }
Response: Name Type Example Description time long 1595563624731 Current timestamp (ms) bids list As above Buy-side depth data (best first) asks list As above Sell-side depth data (best first) Bids/asks arrays contain [price, quantity] pairs sorted best-to-worst.
24hr Ticker GET https://futuersopenapi.xxx.com/fapi/v1/ticker
24-hour price change statistics.
Query Parameters Name Type Description contractName string Contract name e.g. E-BTC-USDT
json { "high": "9279.0301", "vol": "1302", "last": "9200", "low": "9279.0301", "rose": "0", "time": 1595563624731 }
Response: Name Type Example Description time long 1595563624731 Timestamp high float 9900 24h high price low float 8800.34 24h low price last float 8900 Last price vol float 4999 24h trading volume rose string +0.5 24h price change Get Index/Mark Price GET https://futuersopenapi.xxx.com/fapi/v1/index
Query Parameters Name Type Description contractName string Contract name e.g. E-BTC-USDT limit string Default 100; Max 1000
json { "markPrice": 581.5, "indexPrice": 646.3933333333333, "lastFundingRate": 0.001, "contractName": "E-ETH-USDT", "time": 1608273554063 }
Response: Name Type Example Description indexPrice float 0.055 Index price markPrice float 0.0578 Mark price contractName string E-BTC-USDT Contract name lastFundingRate float 0.123 Current funding rate Kline/Candlestick Data GET https://api.xxx.com/futures/open/fapi/v1/klines
Query Parameters Name Type Description contractName string Contract name e.g. E-BTC-USDT interval string Kline interval: 1min,5min,15min,30min,1h,1day,1week,1month limit integer Default 100; Max 300
json [ { "high": "6228.77", "vol": "111", "low": "6228.77", "idx": 1594640340, "close": "6228.77", "open": "6228.77" } ]
Response: Name Type Example Description idx long 1538728740000 Open time (ms) open float 36.00000 Open price close float 33.00000 Close price high float 36.00000 High price low float 30.00000 Low price vol float 2456.111 Trading volume Trading Security Type: TRADE All trading endpoints require signature and API-key authentication.
Create Order POST https://api.xxx.com/futures/open/fapi/v1/order
Creates a new order.
Headers Header Type Description X-CH-TS string Timestamp X-CH-APIKEY string Your API-KEY X-CH-SIGN string Signature Request Body Name Type Description volume number Order quantity (in USD value for MARKET open orders) price number Order price contractName string Contract name e.g. E-BTC-USDT type string Order type: LIMIT/MARKET side string Direction: BUY/SELL open string Open/Close: OPEN/CLOSE positionType number Position type: 1 (Cross) / 2 (Isolated) clientOrderId string Client order ID (max 32 chars) timeInForce string IOC, FOK, POST_ONLY
json { "orderId": "256609229205684228" }
Response: Name Type Example Description orderId string 256609229205684228 Order ID Create Conditional Order POST https://api.xxx.com/futures/open/fapi/v1/conditionOrder
Headers Header Type Description X-CH-TS string Timestamp X-CH-APIKEY string Your API-KEY X-CH-SIGN string Signature Request Body Name Type Description volume number Order quantity (in USD value for MARKET open orders) price number Order price contractName string Contract name e.g. E-BTC-USDT type string Order type: LIMIT/MARKET side string Direction: BUY/SELL open string Open/Close: OPEN/CLOSE positionType number Position type: 1 (Cross) / 2 (Isolated) clientOrderId string Client order ID (max 32 chars) triggerType string Conditional order type: 1 (Stop-loss), 2 (Take-profit), 3 (Trailing buy), 4 (Trailing sell) triggerPrice string Trigger price
json { "orderId": "256609229205684228" }
Cancel Order POST https://api.xxx.com/futures/open/fapi/v1/cancel
Rate Limit: 20 requests/2s
Headers Header Type Description X-CH-SIGN string Signature X-CH-APIKEY string Your API-KEY X-CH-TS integer Timestamp Request Body Name Type Description contractName string Contract name e.g. E-BTC-USDT orderId string Order ID
json { "orderId": "256609229205684228" }
Order Detail GET https://api.xxx.com/futures/open/fapi/v1/order
Query Parameters Name Type Description contractName string Contract name orderId string Order ID clientOrderId string Client order ID (optional)
json { "side": "BUY", "executedQty": 0, "orderId": 259396989397942275, "price": 10000.0000000000000000, "origQty": 1.0000000000000000, "avgPrice": 0, "transactTime": "1607702400000", "action": "OPEN", "contractName": "E-BTC-USDT", "type": "LIMIT", "status": "INIT" }
Response: Name Type Example Description orderId long 150695552109032492 System-generated order ID contractName string E-BTC-USDT Contract name price float 10.5 Order price origQty float 10.5 Original quantity executedQty float 10.1 Filled quantity avgPrice float 10.5 Average fill price symbol string BHTUSDT Trading pair status string NEW Order status: NEW, PARTIALLY_FILLED, FILLED, CANCELED, REJECTED side string BUY Order side: BUY (long), SELL (short) action string OPEN OPEN/CLOSE transactTime long 1607702400000 Order creation time Current Open Orders GET https://api.xxx.com/futures/open/fapi/v1/openOrders
Rate Limit: 20 requests/2s Retrieves current open orders for the specified contract.
Query Parameters Name Type Description contractName string Contract name e.g. E-BTC-USDT Headers Header Type Description X-CH-SIGN string Signature X-CH-APIKEY string Your API-KEY X-CH-TS string Timestamp
json [ { "side": "BUY", "executedQty": 0, "orderId": 259396989397942275, "price": 10000.0000000000000000, "origQty": 1.0000000000000000, "avgPrice": 0, "transactTime": "1607702400000", "action": "OPEN", "contractName": "E-BTC-USDT", "type": "LIMIT", "status": "INIT" } ]
Response: Same fields as Order Detail
Order History POST https://api.xxx.com/futures/open/fapi/v1/orderHistorical
Headers Header Type Description X-CH-SIGN string Signature X-CH-APIKEY string Your API-KEY X-CH-TS string Timestamp Request Body Name Type Description contractName string Contract name e.g. E-BTC-USDT limit string Default 100; Max 1000 fromId long Start order ID for pagination
json [ { "side": "BUY", "clientId": "0", "ctimeMs": 1632903411000, "positionType": 2, "orderId": 777293886968070157, "avgPrice": 41000, "openOrClose": "OPEN", "leverageLevel": 26, "type": 4, "closeTakerFeeRate": 0.00065, "volume": 2, "openMakerFeeRate": 0.00025, "dealVolume": 1, "price": 41000, "closeMakerFeeRate": 0.00025, "contractId": 1, "ctime": "2021-09-29T16:16:51", "contractName": "E-BTC-USDT", "openTakerFeeRate": 0.00065, "dealMoney": 4.1, "status": 4 } ]
Profit/Loss History POST https://api.xxx.com/futures/open/fapi/v1/profitHistorical
Headers Header Type Description X-CH-SIGN string Signature X-CH-APIKEY string Your API-KEY X-CH-TS string Timestamp Request Body Name Type Description contractName string Contract name e.g. E-BTC-USDT limit string Default 100; Max 1000 fromId long Start ID for pagination
json [ { "side": "SELL", "positionType": 2, "tradeFee": -5.23575, "realizedAmount": 0, "leverageLevel": 26, "openPrice": 44500, "settleProfit": 0, "mtime": 1632882739000, "shareAmount": 0, "openEndPrice": 44500, "closeProfit": -45, "volume": 900, "contractId": 1, "historyRealizedAmount": -50.23575, "ctime": 1632882691000, "id": 8764, "capitalFee": 0 } ]
Account Trade List GET https://api.xxx.com/futures/open/fapi/v1/myTrades
Rate Limit: 20 requests/2s
Query Parameters Name Type Description contractName string Contract name e.g. E-BTC-USDT limit string Default 100; Max 1000 fromId long Start trade ID for pagination Headers Header Type Description X-CH-SIGN string Signature X-CH-APIKEY string Your API-KEY X-CH-TS integer Timestamp
json [ { "symbol": "ETHBTC", "id": 100211, "bidId": 150695552109032492, "askId": 150695552109032493, "price": "4.00000100", "qty": "12.00000000", "time": 1499865549590, "isBuyer": true, "isMaker": false, "fee": "0.001" } ]
Response: Name Type Example Description symbol string ETHBTC Trading pair tradeId number 28457 Trade ID bidId long 150695552109032492 Buyer order ID askId long 150695552109032493 Seller order ID bidUserId integer 10024 Buyer user ID askUserId integer 10025 Seller user ID price float 4.01 Execution price qty float 12 Execution quantity amount float 5.38 Execution value time number 1499865549590 Execution timestamp fee number 0.001 Trading fee side string buy Order side: BUY/SELL contractName string E-BTC-USDT Contract name isMaker boolean true Whether maker order isBuyer boolean true Whether buyer Account Security Type: USER_DATA All account endpoints require signature and API-key authentication.
Account Information GET https://api.xxx.com/futures/open/fapi/v1/account
Rate Limit: 20 requests/2s
Headers Header Type Description X-CH-SIGN string Signature X-CH-APIKEY string Your API-KEY X-CH-TS integer Timestamp
json { "account": [ { "marginCoin": "USDT", "accountNormal": 999.5606, "accountLock": 23799.5017, "partPositionNormal": 9110.7294, "totalPositionNormal": 0, "achievedAmount": 4156.5072, "unrealizedAmount": 650.6385, "totalMarginRate": 0, "totalEquity": 99964804.560, "partEquity": 13917.8753, "totalCost": 0, "sumMarginRate": 873.4608, "positionVos": [ { "contractId": 1, "contractName": "E-BTC-USDT", "contractSymbol": "BTC-USDT", "positions": [ { "id": 13603, "uid": 10023, "contractId": 1, "positionType": 2, "side": "BUY", "volume": 69642.0, "openPrice": 11840.2394, "avgPrice": 11840.3095, "closePrice": 12155.3005, "leverageLevel": 24, "holdAmount": 7014.2111, "closeVolume": 40502.0, "pendingCloseVolume": 0, "realizedAmount": 8115.9125, "historyRealizedAmount": 1865.3985, "tradeFee": -432.0072, "capitalFee": 2891.2281, "closeProfit": 8117.6903, "shareAmount": 0.1112, "freezeLock": 0, "status": 1, "ctime": "2020-12-11T17:42:10", "mtime": "2020-12-18T20:35:43", "brokerId": 21, "marginRate": 0.2097, "reducePrice": 9740.8083, "returnRate": 0.3086, "unRealizedAmount": 2164.5289, "openRealizedAmount": 2165.0173, "positionBalance": 82458.2839, "settleProfit": 0.4883, "indexPrice": 12151.1175, "keepRate": 0.005, "maxFeeRate": 0.0025 } ] } ] } ] }
Response: Name Type Description account array Balance details account Object:
Name Type Example Description marginCoin string USDT Margin currency accountNormal float 999.56 Available balance accountLock float 23799.5 Locked margin partPositionNormal float 9110.72 Isolated margin balance totalPositionNormal float 0 Cross margin used achievedAmount float 4156.50 Realized P&L unrealizedAmount float 650.63 Unrealized P&L totalMarginRate float 0 Cross margin rate totalEquity float 99964804 Cross equity partEquity float 13917.8 Isolated equity totalCost float 0 Cross position cost sumMarginRate float 873.46 Total account margin rate positionVos array Position details positionVos Object:
Name Type Example Description contractId integer 2 Contract ID contractName string E-BTC-USDT Contract name contractSymbol string BTC-USDT Contract symbol positions array Position details positions Object:
Name Type Example Description id integer 2 Position ID uid integer 10023 User ID positionType integer 1 Position type: 1 (Cross), 2 (Isolated) side string SELL Position side: BUY (long), SELL (short) volume float 1.05 Position quantity openPrice float 1.05 Entry price avgPrice float 1.05 Average entry price closePrice float 1.05 Exit price leverageLevel float 1.05 Leverage level holdAmount float 1.05 Position margin closeVolume float 1.05 Closed quantity pendingCloseVolume float 1.05 Pending close quantity realizedAmount float 1.05 Realized P&L historyRealizedAmount float 1.05 Historical realized P&L tradeFee float 1.05 Trading fee capitalFee float 1.05 Funding fee closeProfit float 1.05 Close profit shareAmount float 1.05 Shared amount freezeLock integer 0 Lock status: 0 (Normal), 1 (Liquidation lock), 2 (Delivery lock) status integer 0 Validity: 0 (Invalid), 1 (Valid) ctime timestamp Creation time mtime timestamp Update time brokerId integer 1023 Broker ID lockTime timestamp Liquidation lock time marginRate float 1.05 Margin rate reducePrice float 1.05 Liquidation price returnRate float 1.05 Return rate unRealizedAmount float 1.05 Unrealized P&L openRealizedAmount float 1.05 Open position unrealized P&L positionBalance float 1.05 Position value indexPrice float 1.05 Latest mark price keepRate float 1.05 Minimum maintenance margin rate maxFeeRate float 1.05 Maximum closing fee rate
Last updated