Change Log (2024-09-14)
Release Note 2024-09-14
- New api
- order:/fapi/copyTrading/v2/order,/fapi/v2/copyTrading/cancel
- user:/fapi/copyTrading/v2/account,/fapi/v2/copyTrading/positions,/fapi/v2/copyTrading/configQuerySymbols,/fapi/v2/copyTrading/status
order
Cancel Order (TRADE)(HMAC SHA256)
curl -X POST -H 'Content-Type: application/json' -i /fapi/v2/copyTrading/cancel --data '{
'contractName': 'E-SAND-USDT',
'clientOrderId': "",
'orderId': 1690615847831143159,
}
The above command returns JSON structured like this:
{
"code": "0",
"msg": "Success",
"data": {
"orderId": 1690615847831143159
}
}
URL: /fapi/v2/copyTrading/cancel
Type: POST
Content-Type: application/json
Description: Cancel Order (TRADE)(HMAC SHA256)
Body-parameters:
Parameter | Type | Required | Description |
---|---|---|---|
contractName | string | true | Contract name E.g. E-BTC-USDT |
clientOrderId | string | false | client Order id(clientOrderId and orderId cannot both be empty) |
orderId | long | false | order id(clientOrderId and orderId cannot both be empty) |
Response-fields:
Field | Type | Description |
---|---|---|
code | string | status code |
msg | string | message content |
data | object | return data |
└─orderId | long | Order ID(system generated) |
New Order (TRADE)(HMAC SHA256)
curl -X POST -H 'Content-Type: application/json' -i /fapi/v2/copyTrading/order --data '{
'contractName': 'E-SAND-USDT',
'clientOrderId': 7993967859,
'side': 'BUY',
'type': 'LIMIT',
'positionType': 1,
'open': 'OPEN',
'volume': 100,
'amount': 1,
'price': 2,
'leverage': 5
}'
The above command returns JSON structured like this:
{
"code": "0",
"msg": "Success",
"data": {
"orderId": 1690615676032452985
}
}
URL: /fapi/v2/copyTrading/order
Type: POST
Content-Type: application/json
Description: New Order (TRADE)(HMAC SHA256)
Body-parameters:
Parameter | Type | Required | Description |
---|---|---|---|
contractName | string | true | Contract name E.g. E-BTC-USDT |
clientOrderId | string | false | Client order identity, a string with length less than 32 bit |
side | string | true | trade direction, BUY/SELL |
type | string | true | Order type, LIMIT,MARKET,IOC,FOK,POST_ONLY |
positionType | int | true | 1 crossed position, 2 isolated position |
open | string | true | Open balancing direction, OPEN/CLOSE |
volume | bigdecimal | true | Order quantity |
amount | bigdecimal | true | Order amount |
price | bigdecimal | true | Order price |
leverage | bigdecimal | true | target initial leverage: int from 1 to 125 |
Response-fields:
Field | Type | Description |
---|---|---|
code | string | status code |
msg | string | message content |
data | object | return data |
└─orderId | long | Order ID(system generated) |
user
Account Information V2 (USER_DATA)(HMAC SHA256)
curl -X GET -i /fapi/v2/copyTrading/account
The above command returns JSON structured like this:
{
"code": "0",
"msg": "Success",
"data": {
"accountList": [{
"symbol": "USDT",
"usdtValuation": "1010.5999",
"fundsOutStatus": "1",
"unRealizedAmount": "-0.2294",
"realizedAmount": "0",
"futureModel": "copy",
"fundsInStatus": "1",
"trialFund": "0",
"totalMargin": "1010.5999",
"totalAmount": "1010.5999",
"canUseAmount": "950.7441",
"isolateMargin": "0",
"walletBalance": "946.2179",
"lockAmount": "0",
"canTransferAmount": "950.7441",
"totalMarginRate": "0.8441",
"btcValuation": "0.01688391",
"openRealizedAmount": "64.382",
"marginBalance": "1010.8293"
}]
}
}
URL: /fapi/v2/copyTrading/account
Type: GET
Content-Type: application/json
Description: Account Information V2 (USER_DATA)(HMAC SHA256)
Response-fields:
Field | Type | Description |
---|---|---|
code | string | status code |
msg | string | message content |
data | object | return data |
└─accountList | array | Account V2 |
└─symbol | string | symbol name |
└─usdtValuation | string | usdt Valuation |
└─fundsOutStatus | string | Fund transfer status 0. Close 1. Open |
└─unrealizedAmount | string | Unfilled profit and losses |
└─realizedAmount | string | Profit and losses occurred |
└─futureModel | string | Account type |
└─fundsInStatus | string | Fund transfer status 0. Close 1. Open |
└─trialFund | string | Available experience money |
└─totalMargin | string | Full position margin |
└─totalAmount | string | Total amount available |
└─isolateMargin | string | isolate Margin |
└─walletBalance | string | Total Balance |
└─lockAmount | string | Frozen amount |
└─canTransferAmount | string | Transferable amount |
└─totalMarginRate | string | Full position margin rate |
└─btcValuation | string | btc Valuation |
└─openRealizedAmount | string | Full account position gain or loss |
└─marginBalance | string | margin Balance |
Copy Trading positions (USER_DATA)
curl -X GET -i /fapi/v2/copyTrading/positions
The above command returns JSON structured like this:
{
"code": "0",
"msg": "Success",
"data": {
"copyPositionList": [{
"id": 12786287,
"contractId": 1,
"contractName": "E-BTC-USDT",
"symbol": "BTC-USDT",
"positionVolume": 80.0000000000000000,
"canCloseVolume": 80.0000000000000000,
"openAvgPrice": 62168.6625000000000000,
"indexPrice": 56552.8,
"avgPrice": 56505.5000000000000000,
"reducePrice": -59214.6521025115962417,
"holdAmount": 1.8097,
"marginRate": 0.0024,
"realizedAmount": 0.0000,
"returnRate": -1.8066537944257687,
"orderSide": "BUY",
"positionType": 1,
"canUseAmount": 900.8425883185153200,
"canSubMarginAmount": 0.0000,
"openRealizedAmount": -44.9269,
"openRealizedAmountValuation": -44.9269,
"keepRate": 0.004,
"maxFeeRate": 0.00085,
"unRealizedAmount": 0.3784,
"leverageLevel": 20,
"positionBalance": 452.4224,
"tradeFee": "-0.2661",
"capitalFee": "-1.6605",
"closeProfit": "0",
"settleProfit": "-45.3053",
"shareAmount": "0",
"historyRealizedAmount": "-47.2318",
"profitRealizedAmount": "-47.2318",
"adlPriority": 2,
"ctime": 1724569352000,
"futureModel": "copy",
"copyType": 1,
"copyPositionStat": {
"preShareRoyaltyAmount": 0,
"pnl": -45.9841394644627985,
"roe": -1.9179549727177029,
"copyUserCount": 1,
"volume": 77.0000000000000000,
"openAvgPrice": 62274.3103896103896104,
"closeAvgPrice": 0,
"marginAmount": 1.91804876000000000000032000000000000
},
"shareTraderUid": null,
"email": null,
"breakEvenPrice": 62168.6711105863125000
}]
}
}
URL: /fapi/v2/copyTrading/positions
Type: GET
Content-Type: application/json
Description: Copy Trading positions (USER_DATA)
Query-parameters:
Parameter | Type | Required | Description |
---|
Response-fields:
Field | Type | Description |
---|---|---|
code | string | status code |
msg | string | message content |
data | object | return data |
└─copyPositionList | array | copy positionList V2 |
└─id | int | Position ID |
└─contractId | int | Contract ID |
└─contractName | string | Contract Name |
└─symbol | string | Contract Symbol |
└─positionVolume | bigdecimal | Position Volume |
└─canCloseVolume | bigdecimal | Volume Available for Closing |
└─openAvgPrice | bigdecimal | Average Opening Price |
└─indexPrice | bigdecimal | Index Price |
└─avgPrice | bigdecimal | Last Settlement Price |
└─reducePrice | bigdecimal | Liquidation Price |
└─holdAmount | bigdecimal | Margin |
└─marginRate | bigdecimal | Margin Rate |
└─realizedAmount | bigdecimal | Realized Profit and Loss |
└─returnRate | bigdecimal | Rate of Return |
└─orderSide | string | Position Direction: BUY for long, SELL for short |
└─positionType | int | 1 crossed position, 2 isolated position |
└─canUseAmount | bigdecimal | Available Amount |
└─canSubMarginAmount | bigdecimal | Margin Reduction Amount |
└─openRealizedAmount | bigdecimal | Unrealized Profit and Loss for Open Positions |
└─openRealizedAmountValuation | bigdecimal | Valuation of Unrealized Profit and Loss for Open Positions |
└─keepRate | bigdecimal | Minimum Maintenance Margin Rate for Ladder |
└─maxFeeRate | bigdecimal | Maximum Fee Rate for Closing Position |
└─unRealizedAmount | bigdecimal | Unrealized Profit and Loss |
└─leverageLevel | int | Leverage Level |
└─positionBalance | bigdecimal | Position Value |
└─tradeFee | string | Trading Fee |
└─capitalFee | string | Funding Fee |
└─closeProfit | string | Profit and Loss from Closing Position |
└─settleProfit | string | Position Settlement |
└─shareAmount | string | Allocation Amount |
└─historyRealizedAmount | string | Cumulative Profit and Loss |
└─profitRealizedAmount | string | Settlement Profit and Loss |
└─adlPriority | int | |
└─ctime | int | |
└─futureModel | string | |
└─copyType | int | |
└─copyPositionStat | object | |
└─preShareRoyaltyAmount | bigdecimal | Accumulated pre-share royalty for copy position |
└─pnl | bigdecimal | Accumulated profit for copy position |
└─roe | bigdecimal | Accumulated return on equity (ROE) for copy position |
└─copyUserCount | int | bigdecimal of users copying the position |
└─volume | bigdecimal | Total position volume for the copy position |
└─openAvgPrice | bigdecimal | Average opening price for the copy position |
└─closeAvgPrice | bigdecimal | Average closing price for the copy position |
└─marginAmount | bigdecimal | Total initial margin for the copy position |
└─shareTraderUid | int | |
└─breakEvenPrice | bigdecimal | Break-even Price |
Copy Trading configQuerySymbols (USER_DATA)
curl -X GET -i /fapi/v2/copyTrading/configQuerySymbols
The above command returns JSON structured like this:
{
"code":"0",
"msg":"Success",
"data":{
"contractName":"E-SAND-USDT",
"openTakerFeeRate":0.0004,
"openMakerFeeRate":0.0002,
"closeTakerFeeRate":0.0004,
"closeMakerFeeRate":0.0002
}
}
URL: /fapi/v2/copyTrading/configQuerySymbols
Type: GET
Content-Type: application/json
Description: Copy Trading configQuerySymbols (USER_DATA)
Query-parameters:
Parameter | Type | Required | Description |
---|
Response-fields:
Field | Type | Description |
---|---|---|
code | string | status code |
msg | string | message content |
data | object | return data |
└─contractInfo | array | copy contractInfo V2 |
└─contractId | int | contract Id |
└─displaySymbolName | string | Symbol Name |
Copy Trading Status (USER_DATA)
curl -X GET -i /fapi/v2/copyTrading/status
The above command returns JSON structured like this:
{
"code": "0",
"msg": "Success",
"data": 1
}
URL: /fapi/v2/copyTrading/status
Type: POST
Content-Type: application/json
Description: Copy Trading Status (USER_DATA)
Body-parameters:
Parameter | Type | Required | Description |
---|
Response-fields:
Field | Type | Description |
---|---|---|
code | string | status code |
msg | string | message content |
data | object | return data |