Trade
Create a new futures order.
POST /fapi/v1/order HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-TS: text
X-CH-APIKEY: text
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 146
{
"volume": 1,
"price": 1,
"contractName": "text",
"type": "LIMIT",
"side": "BUY",
"open": "OPEN",
"positionType": 1,
"clientOrderId": "text",
"timeInForce": "IOC"
}
Order successfully created
{
"orderId": 256609229205684220
}
Create a new condition order.
POST /fapi/v1/conditionOrder HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-TS: text
X-CH-APIKEY: text
X-CH-SIGN: text
Content-Type: application/json
Accept: */*
Content-Length: 146
{
"volume": 1,
"triggerType": "text",
"triggerPrice": "text",
"positionType": 1,
"open": "text",
"side": "text",
"type": "text",
"contractName": "text",
"price": 1
}
Condition order successfully created
{
"orderId": 256609229205684220
}
Cancel a specific order by ID.
POST /fapi/v1/cancel HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: 1
Content-Type: application/json
Accept: */*
Content-Length: 40
{
"contractName": "text",
"orderId": "text"
}
Order cancelled successfully
{
"orderId": 256609229205684220
}
Cancel all open orders.
POST /fapi/v1/cancel_all HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: 1
Accept: */*
All orders cancelled successfully
{
"code": "0",
"msg": "Success",
"data": null
}
Retrieve details of a specific order.
GET /fapi/v1/order HTTP/1.1
Host: futuresopenapi.coinlocally.com
Content-Type: application/json
Accept: */*
Content-Length: 23
{
"contractName": "text"
}
Order details retrieved successfully
[
{
"side": "BUY",
"executedQty": 0,
"orderId": 259396989397942270,
"price": 10000,
"origQty": 1,
"avgPrice": 0,
"transactTime": "1607702400000",
"action": "OPEN",
"contractName": "E-BTC-USDT",
"type": "LIMIT",
"status": "INIT"
}
]
Retrieve currently open futures orders for a user.
Speed Limit: Defined by exchangeSecurity Type: TRADE
Contract name E.g. E-BTC-USDT
Signature
Your API-key
Timestamp
GET /fapi/v1/openOrders HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: 1
Accept: */*
Successfully retrieved open orders.
[
{
"side": "BUY",
"executedQty": 0,
"orderId": 259396989397942270,
"price": 10000,
"origQty": 1,
"avgPrice": 0,
"transactTime": "1607702400000",
"action": "OPEN",
"contractName": "E-BTC-USDT",
"type": "LIMIT",
"status": "INIT"
}
]
Retrieve historical order records for a user.
Security Type: TRADE
Signature
Your API-key
Timestamp
100
POST /fapi/v1/orderHistorical HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: text
Content-Type: application/json
Accept: */*
Content-Length: 48
{
"contractName": "text",
"limit": "100",
"fromId": 1
}
Successfully retrieved historical orders.
[
{
"side": "BUY",
"clientId": "0",
"ctimeMs": 1632903411000,
"positionType": 2,
"orderId": 777293886968070100,
"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
}
]
Retrieves historical realized profits for a given contract.
POST /fapi/v1/profitHistorical HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: text
Content-Type: application/json
Accept: */*
Content-Length: 49
{
"contractName": "text",
"limit": "text",
"fromId": 1
}
Profit history retrieved successfully
[
{
"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
}
]
Retrieve a list of past trades executed under a contract.
Contract name E.g. E-BTC-USDT
Lines per page, default 100, max 1000
Start retrieving from this tradeId
Signature
Your API-key
Time stamp
GET /fapi/v1/myTrades HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: 1
Accept: */*
Successfully retrieved trade history
[
{
"symbol": "ETHBTC",
"id": 100211,
"bidId": 150695552109032480,
"askId": 150695552109032480,
"price": "4.00000100",
"qty": "12.00000000",
"time": 1499865549590,
"isBuyer": true,
"isMaker": false,
"fee": "0.001"
}
]
Switch between Net Position and Two-way Position modes.
E-BTC-USDT
1
POST /fapi/v1/edit_user_position_model HTTP/1.1
Host: futuresopenapi.coinlocally.com
Content-Type: application/json
Accept: */*
Content-Length: 47
{
"contractName": "E-BTC-USDT",
"positionModel": 1
}
Position mode changed successfully.
{
"code": "0",
"msg": "Success",
"data": null
}
Modify the margin mode for a given contract (Cross or Isolated).
E-BTC-USDT
1
POST /fapi/v1/edit_user_margin_model HTTP/1.1
Host: futuresopenapi.coinlocally.com
Content-Type: application/json
Accept: */*
Content-Length: 45
{
"contractName": "E-BTC-USDT",
"marginModel": 1
}
Margin mode changed successfully.
{
"code": "0",
"msg": "Success",
"data": null
}
Adjust the margin for an open futures position.
Weight: 1
Position ID
Amount to adjust
POST /fapi/v1/edit_position_margin HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: 1
Content-Type: application/json
Accept: */*
Content-Length: 27
{
"positionId": 1,
"amount": 1
}
Margin adjustment was successful.
{
"code": "0",
"msg": "Success",
"data": null
}
Change the leverage setting for a specific contract.
Weight: 1
Contract name
New leverage level (e.g., 50)
POST /fapi/v1/edit_lever HTTP/1.1
Host: futuresopenapi.coinlocally.com
X-CH-SIGN: text
X-CH-APIKEY: text
X-CH-TS: 1
Content-Type: application/json
Accept: */*
Content-Length: 36
{
"contractName": "text",
"nowLevel": 1
}
Leverage level changed successfully.
{
"code": "0",
"msg": "Success",
"data": null
}
Last updated