Skip to main content

Account and trading endpoints

The API endpoint under the [Account and trading endpoints] module requires authentication.

Response

{
"success": true,
"code": 0,
"data": [
{
"currency": "BTC",
"positionMargin": 0,
"availableBalance": 0,
"cashBalance": 0,
"frozenBalance": 0,
"equity": 0,
"unrealized": 0,
"bonus": 0
},
{
"currency": "ETH",
"positionMargin": 0,
"availableBalance": 0,
"cashBalance": 0,
"frozenBalance": 0,
"equity": 0,
"unrealized": 0,
"bonus": 0
},
{
"currency": "USDT",
"positionMargin": 0,
"availableBalance": 0.03176562,
"cashBalance": 0.03176562,
"frozenBalance": 0,
"equity": 0.03176562,
"unrealized": 0,
"bonus": 0
}
]
}

Get all informations of user's asset

  • GET api/v1/private/account/assets

Required permissions: Trade reading permission

Request parameters:

None

Response parameters:

ParameterData TypeDescription
currencystringcurrency
positionMargindecimalposition margin
frozenBalancedecimalfrozen balance
availableBalancedecimalavailable balance
cashBalancedecimaldrawable balance
equitydecimaltotal equity
unrealizeddecimalunrealized profit and loss

Get the user's single currency asset information

Response

{
"success": true,
"code": 0,
"data": {
"currency": "USDT",
"positionMargin": 0,
"availableBalance": 0.03176562,
"cashBalance": 0.03176562,
"frozenBalance": 0,
"equity": 0.03176562,
"unrealized": 0,
"bonus": 0
}
}
  • GET api/v1/private/account/asset/{currency}

Required permissions: Account reading permission

Request parameters:

ParameterData TypeMandatoryDescription
currencystringtruecurrency

Response parameters:

ParameterData TypeDescription
currencystringcurrency
positionMargindecimalposition margin
frozenBalancedecimalfrozen balance
availableBalancedecimalavailable balance
cashBalancedecimaldrawable balance
equitydecimaltotal equity
unrealizeddecimalunrealized profit and loss

Get the user's asset transfer records

Response

{
"success": true,
"code": 0,
"data": {
"pageSize": 2,
"totalCount": 88,
"totalPage": 44,
"currentPage": 1,
"resultList": [
{
"id": 165230,
"txid": "db13d56ca887429a8f5fe1d1cbc4559c",
"currency": "USDT",
"amount": 0.03176562,
"type": "IN",
"state": "SUCCESS",
"createTime": 1609833219000,
"updateTime": 1609833219000
},
{
"id": 139320,
"txid": "a57ff46de96545839185aff7343f9b7c",
"currency": "USDT",
"amount": 60.53383524,
"type": "OUT",
"state": "SUCCESS",
"createTime": 1608200935000,
"updateTime": 1608200935000
}
]
}
}
  • GET api/v1/private/account/transfer_record

Required permissions: Account reading permission

Request parameters:

ParameterData TypeMandatoryDescription
currencystringfalsecurrency
statestringfalsestate:WAIT 、SUCCESS 、FAILED
typestringfalsetype:IN 、OUT
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size, default 20, maximum 100

Response parameters:

ParameterData TypeDescription
pageSizeintpage size
totalCountintthe total count
totalPageintthe total page
currentPageintthe current page
resultListlistdata consequence set
idlongid
txidstringflow number
currencystringcurrency
amountdecimaltransfer amount
typestringtype:IN 、OUT
statestringstate:WAIT 、SUCCESS 、FAILED
createTimelongcreate time
updateTimelongupdate time

Get the user's history position information

Response

{
"success": false,
"code": 0,
"message": "",
"data": [{
"positionId": 0,
"symbol": "",
"positionType": 0,
"openType": 0,
"state": 0,
"holdVol": 0.0,
"frozenVol": 0.0,
"closeVol": 0.0,
"holdAvgPrice": 0.0,
"openAvgPrice": 0.0,
"closeAvgPrice": 0.0,
"liquidatePrice": 0.0,
"oim": 0.0,
"im": 0.0,
"holdFee": 0.0,
"realised": 0.0,
"adlLevel": 0,
"leverage": 0,
"createTime": "",
"updateTime": "",
"autoAddIm": false
}]
}
  • GET api/v1/private/position/list/history_positions

Required permissions: Trade reading permissions

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract
typeintfalseposition type, 1long 2short
page_numinttruecurrent page number , default is 1
page_sizeinttruepage size , default 20, maximum 100

Response parameters:

ParameterData TypeDescription
codenumberStatus code
messagestringMisdescription (If there has )
positionIdlongposition id
symbolstringthe name of the contract
positionTypeintposition type, 1 long 2 short
openTypeintopen type, 1isolated 2cross
stateintposition state,1holding 2 system auto-holding 3closed
holdVoldecimalholding volume
frozenVoldecimalfrozen volume
closeAvgPricedecimalclose average price
openAvgPricedecimalopen average price
liquidatePricedecimalliquidation price
oimdecimaloriginal initial margin
imdecimalinitial margin, add or subtract items can be used to adjust the liquidate price
holdFeedecimalholding fee, positive means get it, negative means lost it
realiseddecimalrealized profit and loss
adlLevelintadl level
leverageintleverage multiple
createTimedatecreate time
updateTimedateupdate time
autoAddImbooleanautomatic margin

Get the user's current holding position

Response

{
"success": true,
"code": 0,
"data": [
{
"positionId": 1394650,
"symbol": "ETH_USDT",
"positionType": 1,
"openType": 1,
"state": 1,
"holdVol": 1,
"frozenVol": 0,
"closeVol": 0,
"holdAvgPrice": 1217.3,
"openAvgPrice": 1217.3,
"closeAvgPrice": 0,
"liquidatePrice": 1211.2,
"oim": 0.1290338,
"im": 0.1290338,
"holdFee": 0,
"realised": -0.0073,
"leverage": 100,
"createTime": 1609991676000,
"updateTime": 1609991676000,
"autoAddIm": false
}
]
}
  • GET api/v1/private/position/open_positions

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract

Response parameters:

ParameterData TypeDescription
positionIdlongposition id
symbolstringthe name of the contract
holdVoldecimalholding volume
positionTypeintposition type, 1 long 2 short
openTypeintopen type, 1 isolated 2 cross
stateintposition state,1holding. 2 system auto-holding 3 closed
frozenVoldecimalfrozen volume
closeVoldecimalclose volume
holdAvgPricedecimalholdings average price
closeAvgPricedecimalclose average price
openAvgPricedecimalopen average price
liquidatePricedecimalliquidate price
oimdecimaloriginal initial margin
adlLevelintthe value of ADL is 1-5. If it is empty, wait for the refresh
imdecimalinitial margin, add or subtract items can be used to adjust the liquidate price
holdFeedecimalholding fee, positive means get it, negative means lost it
realiseddecimalrealized profit and loss
createTimedatecreate time
updateTimedateupdate time

Get details of user's funding rate

Response

{
"success": true,
"code": 0,
"data": {
"pageSize": 2,
"totalCount": 73,
"totalPage": 37,
"currentPage": 1,
"resultList": [
{
"id": 328033,
"symbol": "SUSHI_USDT",
"positionType": 1,
"positionValue": 41.8899,
"funding": 0.0837798,
"rate": -0.002,
"settleTime": 1606435200000
},
{
"id": 327194,
"symbol": "SUSHI_USDT",
"positionType": 1,
"positionValue": 34.2654,
"funding": 0.0685308,
"rate": -0.002,
"settleTime": 1606406400000
}
]
}
}
  • GET api/v1/private/position/funding_records

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract
position_idintfalseposition id
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size, default 20, maximum 100

Response parameters:

ParameterData TypeDescription
pageSizeintpage size
totalCountintthe total count
totalPageintthe total page
currentPageintthe current page
resultListlistdata consequence list
idlongid
symbolstringthe name of the contract
positionIdlongposition id
positionTypeint1 long 2 short
positionValuedecimalposition value
fundingdecimalfunding
ratedecimalfunding rate
settleTimedateliquidation time

Get the user's current pending order

Response

{
"success": false,
"code": 0,
"message": "",
"data": [{
"orderId": 0,
"symbol": "",
"positionId": 0,
"price": 0.0,
"vol": 0.0,
"leverage": 0,
"side": 0,
"category": 0,
"orderType": 0,
"dealAvgPrice": 0.0,
"dealVol": 0.0,
"orderMargin": 0.0,
"takerFee": 0.0,
"makerFee": 0.0,
"profit": 0.0,
"feeCurrency": "",
"openType": 0,
"state": 0,
"externalOid": "",
"errorCode": 0,
"usedMargin": 0.0,
"createTime": "",
"updateTime": "",
"stopLossPrice": 0.0,
"takeProfitPrice": 0.0
}

]
}
  • GET api/v1/private/order/list/open_orders/{symbol}

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract, return all the contract parameters if there no fill in
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size default 20, maximum 100

Response parameters:

ParameterData TypeDescription
codenumberStatus code
messagestringMisdescription (If there has )
orderIdlongorderid
symbolstringthe name of the contract
positionIdlongposition id
pricedecimaltrigger price
voldecimaltrigger volume
leveragelongleverage
sideintorder direction 1open long,2close short,3open short, 4 close long
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderTypeint1:price limited order,2:post only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
dealAvgPricedecimaldeal average price
dealVoldecimaltransaction volume
orderMargindecimalorder margin
usedMargindecimalused margin
takerFeedecimaltaker fee
makerFeedecimalmaker fee
profitdecimalclose profit
feeCurrencystringfee currency
openTypeintopen type,1 isolated,2 cross
stateintorder state,1 uninformed, 2uncompleted, 3completed, 4cancelled, 5invalid
errorCodeinterror code,0:normal,1:parameter errors,2:account balance is insufficient,3:the position does not exist,4: position insufficient,5:For long positions, the order price is less than the close price, while for short positions, the order price is more than the close rice,6:When opening long, the close price is more than the fair price, while when opening short, the close price is less than the fair price ,7:exceed risk quota restrictions, 8: system canceled
externalOidstringexternal order ID
createTimedatecreate time
updateTimedateupdate time
stopLossPricedecimalstop-loss price
takeProfitPricedecimaltake-profit price

Get all of the user's historical orders

Response

{
"success": false,
"code": 0,
"message": "",
"data": [{
"orderId": 0,
"symbol": "",
"positionId": 0,
"price": 0.0,
"vol": 0.0,
"leverage": 0,
"side": 0,
"category": 0,
"orderType": 0,
"dealAvgPrice": 0.0,
"dealVol": 0.0,
"orderMargin": 0.0,
"takerFee": 0.0,
"makerFee": 0.0,
"profit": 0.0,
"feeCurrency": "",
"openType": 0,
"state": 0,
"externalOid": "",
"errorCode": 0,
"usedMargin": 0.0,
"createTime": "",
"updateTime": "",
"stopLossPrice": 0.0,
"takeProfitPrice": 0.0
}

]
}
  • GET api/v1/private/order/list/history_orders

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract
statesstringfalseorder state,1 1 uninformed, 2uncompleted, 3completed, 4cancelled, 5invalid; multiple separate by ','
categoryintfalseorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
start_timelongfalsestart time, start time and end time span can only check 90 days at a time, default return the last 7 days of data without fill in
end_timelongfalseend time, start time, and end time spans can only be checked for 90 days at a time
sideintfalseorder direction long,2close short,3open short 4 close long
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size, default 20, maximum 100

Response parameters:

ParameterData TypeDescription
codenumberStatus code
messagestringMisdescription (If there has )
orderIdlongorderid
symbolstringthe name of the contract
positionIdlongposition id
pricedecimaltrigger price
voldecimaltrigger volume
leveragelongleverage
sideintorder direction 1open long,2close short,3open short 4 close long
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderTypeint1:price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
dealAvgPricedecimaltransaction average price
dealVoldecimaltransaction volume
orderMargindecimalorder margin
takerFeedecimaltaker fee
makerFeedecimalmaker fee
profitdecimalclose profit
feeCurrencystringfee currency
openTypeintopen type,1 isolated,2 cross
stateintorder state,1 uninformed, 2 uncompleted, 3 completed, 4 cancelled, 5 invalid
errorCodeinterror code,0:normal,1:parameter errors,2:account balance is insufficient,3:the position does not exist,4: position insufficient,5:For long positions, the order price is less than the close price, while for short positions, the order price is more than the close rice.,6:When opening long, the close price is more than the fair price, while when opening short, the close price is less than the fair price.
externalOidstringexternal order ID
usedMargindecimalused margin
createTimedatecreate time
updateTimedateupdate tine
stopLossPricedecimalstop-loss price
takeProfitPricedecimaltake-profit price

Note: The price returned from this interface is the platform's takeover price. If you want to query the liquidation price of a liquidation order, you can do so through the Get the user's current holding position interface. For liquidation orders, the price will be the platform's takeover price, which may differ from the liquidation price. For more information, please refer to Liquidation and Risk Limit.

Query the order based on the external number

Response

{
"success": true,
"code": 0,
"data": {
"orderId": "102015012431820288",
"symbol": "ETH_USDT",
"positionId": 1394917,
"price": 1209.05,
"vol": 1,
"leverage": 0,
"side": 2,
"category": 1,
"orderType": 5,
"dealAvgPrice": 1208.35,
"dealVol": 1,
"orderMargin": 0,
"takerFee": 0.0072501,
"makerFee": 0,
"profit": 0,
"feeCurrency": "USDT",
"openType": 1,
"state": 3,
"externalOid": "_m_f95eb99b061d4eef8f64a04e9ac4dad3",
"errorCode": 0,
"usedMargin": 0,
"createTime": 1609992674000,
"updateTime": 1609992674000
}
}
  • GET api/v1/private/order/external/{symbol}/{external_oid}

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
external_oidstringtrueexternal order ID

Response parameters:

ParameterData TypeDescription
orderIdlongorderid
symbolstringthe name of the contract
positionIdlongposition id
pricedecimaltrigger price
voldecimaltrigger volume
leveragelongleverage
sideintorder direction 1open long,2close short,3open short 4 close long
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderTypeint1:price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
dealAvgPricedecimaltransaction average price
dealVoldecimaltransaction volume
orderMargindecimalorder margin
takerFeedecimaltaker fee
makerFeedecimalmaker fee
profitdecimalclose profit
feeCurrencystringfee currency
openTypeintopen type,1isolated,2cross
stateintorder state,1: uninformed,2uncompleted,3completed,4canceled,5invalid
externalOidstringexternal order ID
createTimedatecreate time
updateTimedateupdate time

Query the order based on the order number

Response

{
"success": true,
"code": 0,
"data": {
"orderId": "102015012431820288",
"symbol": "ETH_USDT",
"positionId": 1394917,
"price": 1209.05,
"vol": 1,
"leverage": 0,
"side": 2,
"category": 1,
"orderType": 5,
"dealAvgPrice": 1208.35,
"dealVol": 1,
"orderMargin": 0,
"takerFee": 0.0072501,
"makerFee": 0,
"profit": 0,
"feeCurrency": "USDT",
"openType": 1,
"state": 3,
"externalOid": "_m_f95eb99b061d4eef8f64a04e9ac4dad3",
"errorCode": 0,
"usedMargin": 0,
"createTime": 1609992674000,
"updateTime": 1609992674000
}
}
  • GET api/v1/private/order/get/{order_id}

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
order_idlongtrueorder ID

Response parameters:

ParameterData TypeDescription
orderIdlongorderid
symbolstringthe name of the contract
positionIdlongposition id
pricedecimaltrigger price
voldecimaltrigger volume
leveragelongleverage
sideintorder direction :1 open long,2close short,3open short, 4 close long
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderTypeint1:price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
dealAvgPricedecimaltransaction average price
dealVoldecimaltransaction volume
orderMargindecimalorder margin
takerFeedecimaltaker fee
makerFeedecimalmaker fee
profitdecimalclose profit
feeCurrencystringfee currency
openTypeintopen type,1isolated,2cross
stateintorder state,1 uninformed, 2 uncompleted, 3completed, 4cancelled, 5 invalid
externalOidstringExternal order ID
createTimedatecreate time
updateTimedateupdate time

Query the order in bulk based on the order number

  • GET /api/v1/private/order/batch_query

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
order_idslongtrueorder number array,can be separated by "," for example :order_ids = 1,2,3(maximum 50 orders):

Response parameters:

ParameterData TypeDescription
orderIdlongorderid
symbolstringthe name of the contract
positionIdlongposition id
pricedecimaltrigger price
voldecimaltrigger volume
leveragelongleverage
sideintorder direction 1open long,2close short,3open short, 4 close long
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderTypeint1:price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
dealAvgPricedecimaltransaction average price
dealVoldecimaltransaction volume
orderMargindecimalorder margin
takerFeedecimaltaker fee
makerFeedecimalmaker fee
profitdecimalclose profit
feeCurrencystringfee currency
openTypeintopen type,1isolated,2cross
stateintorder state,1: uninformed, 2uncompleted 3 completed, 4cancelled, 5invalid
externalOidstringexternal order ID
createTimedatecreate time
updateTimedateupdate time

Get order transaction details based on the order ID

Response

{
"success": true,
"code": 0,
"data": [
{
"id": "159274416",
"symbol": "ETH_USDT",
"side": 2,
"vol": 1,
"price": 1208.35,
"feeCurrency": "USDT",
"fee": 0.0072501,
"timestamp": 1609992674000,
"profit": 0,
"category": 1,
"orderId": "102015012431820288",
"taker": true
}
]
}
  • GET api/v1/private/order/deal_details/{order_id}

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
order_idlongtrueorder id

Response parameters:

ParameterData TypeDescription
idlongtransactionid
symbolstringthe name of the contract
sideintorder direction 1open long,2close short,3open short 4 close long
voldecimaltransaction volume
pricedecimaltransaction price
feedecimalfee
feeCurrencystringfee currency
profitdecimalprofit
isTakerbooleanIs it taker order
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderIdlongorder id
timestamplongtransaction timestamp

Get all transaction details of the user's order

Response

{
"success": false,
"code": 0,
"message": "",
"data": [{
"id": 0,
"symbol": "",
"side": 0,
"vol": 0.0,
"price": 0.0,
"feeCurrency": "",
"fee": 0.0,
"timestamp": "",
"profit": 0.0,
"isTaker": false,
"category": 0,
"orderId": 0,
"opponentOrderId": 0,
}]
}
  • GET api/v1/private/order/list/order_deals

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contact
start_timelongfalsethe starting time, the default is to push forward 7 days, and the maximum span is 90 days
end_timelongfalsethe end time, start and end time span is 90 days
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size , default 20, maximum 100

Response parameters:

ParameterData TypeDescription
codenumberStatus code
messagestringMisdescription (If there has )
idlongorder id
symbolstringthe name of the contact
sideintorder direction 1open long,2close short,3open short 4 close long
voldecimaltransaction volume
pricedecimaltransaction price
feedecimalfee
feeCurrencystringcurrency
profitdecimalprofit
isTakerbooleanis it taker order
categoryintorder category:1limit order, 2 system take-over delegate, 3 close delegate 4 ADL reduction
orderIdlongorder id
timestamplongtransaction timestamp

Gets the trigger order list

Response

{
"success": false,
"code": 0,
"message": "",
"data": [{
"id": 0,
"symbol": "",
"leverage": 0,
"side": 0,
"triggerPrice": 0.0,
"price": 0.0,
"vol": 0.0,
"openType": 0,
"triggerType": 0,
"state": 0,
"executeCycle": 0,
"trend": 0,
"orderType": 0,
"orderId": 0,
"errorCode": 0,
"createTime": "",
"updateTime": ""
}

]
}
  • GET api/v1/private/planorder/list/orders

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract
statesstringfalseorder state,1 uninformed, 2uncompleted,3completed,4cancelled, 5invalid; Multiple separate by ','
start_timelongfalsestart time, start time and end time span can only check 90 days at a time, default return the last 7 days of data without fill in
end_timelongfalseend time, start time, and end time spans can only be checked for 90 days at a time
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size, default 20, maximum 100

Response parameters:

ParameterData TypeDescription
codenumberStatus code
messagestringMisdescription (If there has )
idinttrigger order id
symbolstringthe name of the contract
leveragelongleverage
sideintorder direction 1open long, 3open short
triggerPricedecimaltrigger price
pricedecimalexecute price
voldecimalorder volume
openTypeintopen type, 1isolated 2cross
triggerTypeinttrigger type,1: more than or equal, 2: less than or equal
stateintstatus,1: untriggered, 2: cancelled, 3: executed,4: invalid,5: execution failed
executeCycleintexecution cycle, unit: hours
trendinttrigger price type,1: latest price, 2: fair price, 3: index price
errorCodeinterror code on failed execution, 0: normal
orderIdlongorder ID, Return on successful execution
orderTypeintorder type,1: limit order,2:Post Only Maker,3: close or cancel instantly 4: close or cancel completely,5: Market order
createTimelongcreate time
updateTimelongupdate time

Get the Stop-Limit order list

Response

{
"success": false,
"code": 0,
"message": "",
"data": [{
"id": 0,
"orderId": 0,
"symbol": "",
"positionId": 0,
"stopLossPrice": 0.0,
"takeProfitPrice": 0.0,
"state": 0,
"triggerSide": 0,
"positionType": 0,
"vol": 0.0,
"realityVol": 0.0,
"placeOrderId": 0,
"errorCode": 0,
"version": 0,
"isFinished": 0,
"createTime": "",
"updateTime": ""
}]
}
  • GET api/v1/private/stoporder/list/orders

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contact
is_finishedintfalsefinal state indicator :0: uncompleted, 1: completed
start_timelongfalsestart time, start time and end time span can only check 90 days at a time, default return the last 7 days of data without fill in
end_timelongfalseend time, start time, and end time spans can only be checked for 90 days at a time
page_numinttruecurrent page number, default is 1
page_sizeinttruepage size, default 20, maximum 100

Response parameters:

ParameterData TypeDescription
codenumberStatus code
messagestringMisdescription (If there has )
idlongStop-Limit order ID
symbolstringthe name of the contract
orderIdlonglimit order ID, which is 0 if it is based on a position
positionIdlongposition id
stopLossPricedecimalstop-loss price
takeProfitPricedecimaltake-profit price
stateintstatus,1: untriggered, 2: cancelled, 3: executed,4: invalid,5: execution failed
triggerSideinttrigger direction, 0: untriggered , 1: taker-profit , 2: stop-loss
positionTypeintposition type,1: long, 2: short
voldecimaltrigger volume
realityVoldecimalactual number of orders
placeOrderIdlongorder id after successful delegation
errorCodeinterrorCode,0: normal, other errorCode details
isFinishedintwhether the order status is the end-state identifier (for query),0. Non-terminal, 1. Terminal
versionintversion
createTimelongcreateTime
updateTimelongupdate time

Get risk limits

Response

{
"success": true,
"code": 0,
"data": {
"BTC_USDT": [
{
"level": 1,
"maxVol": 150000,
"maxLeverage": 125,
"mmr": 0.004,
"imr": 0.008,
"symbol": "BTC_USDT",
"positionType": 2
},
{
"level": 1,
"maxVol": 150000,
"maxLeverage": 125,
"mmr": 0.004,
"imr": 0.008,
"symbol": "BTC_USDT",
"positionType": 1
}
]
}
}
  • GET api/v1/private/account/risk_limit

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract , not uploaded will return all

Response parameters:

ParameterData TypeDescription
symbolstringthe name of the contract
positionTypeintposition type 1:long,2:short
levelintcurrent risk level
maxVoldecimalmaximum position volume
maxLeverageintmaximum leverage rate
mmrdecimalmaintenance margin rate
imrdecimalinitial margin rate

Gets the user's current trading fee rate

Response

{
"success": true,
"code": 0,
"data": {
"level": 0,
"dealAmount": 1786.2594,
"walletBalance": 0.03176562,
"makerFee": 0.0002,
"takerFee": 0.0006,
"makerFeeDiscount": 1,
"takerFeeDiscount": 1
}
}
  • GET api/v1/private/account/tiered_fee_rate

Required permissions: Trade reading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract

Response parameters:

ParameterData TypeDescription
levelinttiered trading fee rate
dealAmountintthe last 30 days' turnover
walletBalanceintwallet balance of yesterday
makerFeedecimalmakerFee
takerFeeinttakerFee
makerFeeDiscountdecimalmakerFee discount
takerFeeDiscountdecimaltakerFee discount

Increase or decrease margin

Response

{
"success": true,
"code": 0
}
  • POST api/v1/private/position/change_margin

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
positionIdlongtrueposition id
amountdecimaltrueamount
typestringtruetype ,ADD: increase,SUB: decrease

Response parameters:

public parameters, success: true, success, false ,failure

Get leverage

  • GET api/v1/private/position/leverage

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruesymbol

Response parameters:

ParameterTypeDescription
positionTypeintpositon type, 1:long 2:short
levelintrisk level
imrdecimalThe leverage risk limit level corresponds to initial margin rate
mmrdecimalLeverage risk limit level corresponds to maintenance margin rate
leverageintleverage

Switch leverage

  • POST api/v1/private/position/change_leverage

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
positionIdlongtrueposition id
leverageinttrueleverage
openTypeintfalseRequired when there is no position, openType, 1: isolated position, 2: full position
symbolstringfalseequired when there is no position,symbol
positionTypeintfalseequired when there is no position, positionType: 1 Long 2:short

Response parameters:

public parameters, success: true, success, false ,failure

request parameters example:

  • Has positon:
{
"positionId": 1,
"leverage": 20
}
  • no positon:
{
"openType": 1,
"leverage": 20,
"symbol": "BTC_USDT",
"positionType": 1
}

Get position mode

  • GET api/v1/private/position/position_mode

Required permissions: Trading permission

Request parameters:

None

Response parameters:

public parameters, success: true, success, false ,failure

position mode,1:hedge,2:one-way

request parameters example:

{"success":true,"code":0,"data":2}

Change position mode

  • POST api/v1/private/position/change_position_mode

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
positionModeinttrue1: Hedge,2, 2: One-way, the modification of the position mode must ensure that there are no active orders, planned orders, or unfinished positions, otherwise it cannot be modified. When switching the one-way mode in both directions, the risk limit level will be reset to level 1. If you need to change the call interface, modify

Response parameters:

public parameters, success: true, success, false ,failure

request parameters example:

{"success":true,"code":0}

Order (Under maintenance)

Response

{
"success": true,
"code": 0,
"data": 102057569836905984
}

USDT perpetual contract trading offers limit and market orders. You can place an order only you have enough money in your account. Once you place an order, your account funds will be frozen . The amount of funds frozen depends on the type and parameters specified in the order.

  • POST api/v1/private/order/submit

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
pricedecimaltrueprice
voldecimaltruevolume
leverageintfalseleverage ,Leverage is necessary on Isolated Margin
sideinttrueorder direction 1 open long ,2close short,3open short ,4 close l
typeinttrueorderType,1:price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
openTypeinttrueopen type,1:isolated,2:cross
positionIdlongfalseposition Id,It is recommended to fill in this parameter when closing a position
externalOidstringfalseexternal order ID
stopLossPricedecimalfalsestop-loss price
takeProfitPricedecimalfalsetake-profit price
positionModeintfalseposition mode,1:hedge,2:one-way,default: the user's current config
reduceOnlybooleanfalseDefault false,For one-way positions, if you need to only reduce positions, pass in true, and two-way positions will not accept this parameter.

Response parameters:

success, success =true, data represent the order id success =false, failure data=null

Bulk order (Under maintenance)

Response

[
{
"symbol": "BTC_USD",
"price": 8800,
"vol": 100,
"leverage": 20,
"side": 1,
"type": 1,
"openType": 1,
"externalOid": "order1"
},
{
"symbol": "BTC_USD",
"price": 500,
"vol": 100,
"leverage": 50,
"side": 3,
"type": 1,
"openType": 1,
"externalOid": "order2"
}
]

Order the contract in batch. Each contract can place 50 orders in the batch. This endpoint is not available for all users , please contact customer service to get this permission.

  • POST api/v1/private/order/submit_batch

Required permissions: Trading permission

Request parameters:(maximum 50 )

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
pricedecimaltrueprice
voldecimaltruevolume
leverageintfalseleverage ,Leverage is necessary on Isolated Margin
sideinttrueorder side 1open long,2close short,3open short, 4 close long
typeinttrueorder type :1 price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price
openTypeinttrueopen type,1:isolated,2:cross
positionIdlongfalseposition Id,It is recommended to fill in this parameter when closing a position
externalOidstringfalseexternal order ID, return the existing order ID if it already exists
stopLossPricedecimalfalsestop-loss price
takeProfitPricedecimalfalsetake-profit price

Response parameters:

ParameterData TypeDescription
externalOidstringexternal order ID
orderIdlongorder ID, null on failure
errorMsgstringerror message, not null when failed
errorCodeinterror code, default is 0

Cancel the order (Under maintenance)

Response

{
"success":true,
"code":0,
"data":[
{
"orderId":101716841474621953,
"errorCode":2040,
"errorMsg":"order not exist"
},
{
"orderId":108885377779302912,
"errorCode":2041,
"errorMsg":"order state cannot be cancelled"
},
{
"orderId":108886241042563584,
"errorCode":0,
"errorMsg":"success"
}
]
}

Cancel the pending order placed before, each time can cancel up to 50 orders.

  • POST api/v1/private/order/cancel

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
NoneListtrueorder id list, maximum 50

Response parameters:

ParameterData TypeDescription
orderIdlongorder ID
errorMsgstringerror message
errorCodeinterror code,Not 0 means the revoke failed

Cancel the order according to the external order ID (Under maintenance)

Response

{
"symbol":"BTC_USDT",
"externalOid":"mexc-a-001"
}

Cancel the uncompleted order under a contract according to the specified externalOid, only 1 order for each cancellation.

  • POST api/v1/private/order/cancel_with_external

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
externalOidstringtrueexternal orderid

Cancel all orders under a contract (Under maintenance)

Cancel all uncompleted orders under a contract.

  • POST api/v1/private/order/cancel_all

Required permissions: Trading permission

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract, cancel specific orders placed under this contract when fill the symbol , otherwise , cancel all orders without filling

Response parameters:

public parameters , success: true success, false failure

Switch the risk level

- POST api/v1/private/account/change_risk_level

- Disabled The call returns the error code 8817 Prompt information: The risk restriction function has been upgraded. For details, please go to the web to view

Trigger order (Under maintenance)

  • POST api/v1/private/planorder/place

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
pricedecimalfalseexecut price, market price may not fill in
voldecimaltruevolume
leverageintfalseleverage , Leverage is necessary on Isolated Margin
sideinttrue1open long,2close short,3open short 4 close long
openTypeinttrueopen type,1:isolated,2:cross
triggerPricedecimaltruetrigger price
triggerTypeinttruetrigger type,1: more than or equal, 2: less than or equal
executeCycleinttrueexecution cycle,1: 24 hours,2: 7 days
orderTypeinttrueorder type,1: limit order,2:Post Only Maker,3: close or cancel instantly ,4: close or cancel completely,5: Market order
trendinttruetrigger price type,1: latest price, 2: fair price, 3: index price

Response parameters:

success, success =true, data value is the order ID, success =false, failure data=null

Cancel the trigger order (Under maintenance)

Response

[
{
"symbol": "BTC_USDT",
"orderId": 1
},
{
"symbol": "ETH_USDT",
"orderId": 2
}
]
  • POST api/v1/private/planorder/cancel

Request parameters:

ParameterData TypeMandatoryDescription
NoneListtruecancel the order list, maximum 50

CancelOrderRequest:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
orderIdstringtrueorderId

Response parameters:

public parameters, Success: true success, false failure

Cancel all trigger orders (Under maintenance)

  • POST api/v1/private/planorder/cancel_all

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract, cancel specific orders placed under this contract when fill the symbol , otherwise , cancel all orders without filling

Response parameters:

public parameters, Success: true success, false failure

Cancel the Stop-Limit trigger order (Under maintenance)

Response

[
{
"stopPlanOrderId": 1
},
{
"stopPlanOrderId": 2
}
]
  • POST api/v1/private/stoporder/cancel

Request parameters:

ParameterData TypeMandatoryDescription
noneListtruecancel order list, maximum 50

CancelOrderRequest:

ParameterData TypeMandatoryDescription
stopPlanOrderIdlongtruethe Stop-Limit trigger order ID

Cancel all Stop-Limit price trigger orders (Under maintenance)

  • POST api/v1/private/stoporder/cancel_all

Request parameters:

ParameterData TypeMandatoryDescription
positionIdlongfalseposition id, fill in positionId,only cancel the trigger order of the corresponding position, and check the symbol without filling
symbolstringfalsethe name of the contact ,only cancels the delegate order under this contract based on the symbol, cancel all orders without filling the symbol

Response parameters:

public parameters, success: true success ,false failure

Switch Stop-Limit limited order price

  • POST api/v1/private/stoporder/change_price

Request parameters:

ParameterData TypeMandatoryDescription
orderIdlongtruelimit order id
stopLossPricedecimalfalsestop-loss price, take-profit and stop-loss price are empty or 0 at the same time, indicating to cancel and take profit
takeProfitPricedecimalfalsetake-profit price,take-profit and stop-loss price are empty or 0 at the same time, indicating to cancel stop-loss and take profit

Response parameters:

public parameters, success: true success ,false failure

Switch the Stop-Limit price of trigger orders

  • POST api/v1/private/stoporder/change_plan_price

Request parameters:

ParameterData TypeMandatoryDescription
stopPlanOrderIdlongtruethe Stop-Limit price of trigger order id
stopLossPricedecimalfalseat least one stop-loss price and one take-profit price is not empty and must be more than 0
takeProfitPricedecimalfalseat least one take-profit price and stop-loss price is not empty and must be more than 0

Response parameters:

public parameters, success: true success ,false failure