Contract Account Endpoints

Get all contract account information

Rate Limit:1 requests per 1 seconds

HTTP Requests Retrieve information from all tokens in the perpetual swap account

  • GET /api/swap/v3/account/accounts

Response:

[ 
  {
   "symbol":"cmt_btcusdt",      //Contract name
   "equity":"0.00000000",      //Equity of the account
   "fixed_balance":"0.00000000",      //Obsolete field
   "total_avail_balance":"0.00000000",   //Available Balance
   "margin":"0",                        //Used margin
   "realized_pnl":"0",                 //Realized profits and losses
   "unrealized_pnl":"0",              //Unrealized profits and losses
   "longMarginRatio":"0",            //Margin rate for multiple positions
   "shortMarginRatio": "0",         //Margin rate for short positions
   "marginRatio": "0",             //Whole position margin rate
   "margin_frozen":"0",              //Freeze margin for opening positions
   "timestamp":"1658098718494",     //Creation time
   "margin_mode":"fixed",          //Margin Mode: crossed / fixed
   "forwardContractFlag":true     //Is it a forward contract
 }
]

Response Field

Field
Description

symbol

Contract name

equity

Equity of the account

fixed_balance

Available balance by warehouse

total_avail_balance

Available balance

margin

Used margin

realized_pnl

Realized profits and losses

unrealized_pnl

Unrealized profits and losses

longMarginRatio

Margin rate for multiple positions

shortMarginRatio

Margin rate for short positions

marginRatio

Whole position margin rate

margin_frozen

Freeze margin for opening positions

timestamp

Creation time

margin_mode

Margin Mode: crossed / fixed

forwardContractFlag

Is it a forward contract

Get contract account by symbol

Rate Limit:5 requests per second

HTTP Requests Retrieve the perpetual swap account information of a single trading pair.

  • GET /api/swap/v3/account/account

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

Response:

{
     "symbol":"cmt_btcusdt",      //Contract name
     "equity":"0.00000000",      //Equity of the account
     "fixed_balance":"0.00000000",      //Obsolete field
     "total_avail_balance":"0.00000000",   //Available Balance
     "margin":"0",                        //Used margin
     "realized_pnl":"0",                 //Realized profits and losses
     "unrealized_pnl":"0",              //Unrealized profits and losses
     "longMarginRatio":"0",            //Margin rate for multiple positions
     "shortMarginRatio": "0",         //Margin rate for short positions
     "marginRatio": "0",             //Whole position margin rate
     "margin_frozen":"0",              //Freeze margin for opening positions
     "timestamp":"1658098718494",     //Creation time
     "margin_mode":"fixed",          //Margin Mode: crossed / fixed
     "forwardContractFlag":true     //Is it a forward contract
 }

Response Field

Field
Description

symbol

Contract name

equity

Equity of the account

fixed_balance

Available balance by warehouse

total_avail_balance

Available Balance

margin

Used margin

realized_pnl

Realized profits and losses

unrealized_pnl

Unrealized profits and losses

longMarginRatio

Margin rate for multiple positions

shortMarginRatio

Margin rate for short positions

marginRatio

Crossed mode margin rate

margin_frozen

Freeze margin for opening positions

timestamp

Creation time

margin_mode

Margin Mode: crossed / fixed

forwardContractFlag

Is it a forward contract

Get Swap Leverage

Rate Limit:5 requests per second

HTTP Requests Retrieve the leverage ratio and margin mode of a perpetual swap.

  • GET /api/swap/v3/account/settings

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

Response:

 {
   "symbol":"cmt_btcusdt",        //Contract name
   "long_leverage":"100",        //Leverage level for long positions
   "margin_mode":"fixed",       //Margin Mode: crossed / fixed
   "short_leverage":"2",       //Leverage level for short positions
   "forwardContractFlag":true     //Is it a forward contract
 }

Response Field

Parameters
Description

symbol

Contract name

long_leverage

Leverage level for long positions

margin_mode

Margin Mode: crossed / fixed

short_leverage

Leverage level for short positions

forwardContractFlag

Is it a forward contract

Set Swap Leverage

Rate Limit:5 requests per second

HTTP Requests Set swap leverage

  • POST /api/swap/v3/account/leverage

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

leverage

Integer

Yes

New leverage level from 1-100

side

Integer

Yes

Position direction (1-long position, 2-short position) Mark obsolete

holdSide

Integer

Yes

Position direction (1-long position, 2-short position) crossed mode the holdSide field does not need to be passed

Response:

{
   "symbol":"cmt_btcusdt",        //Contract name
   "long_leverage":"100",        //Leverage level for long positions
   "margin_mode":"fixed",       //Margin Mode: crossed / fixed
   "short_leverage":"2",       //Leverage level for short positions
   "forwardContractFlag":true     //Is it a forward contract
 }

Response Field

Field
Description

symbol

Contract name

long_leverage

Leverage level for long positions

margin_mode

Margin Mode: crossed / fixed

short_leverage

Leverage level for short positions

forwardContractFlag

Is it a forward contract

Adjust Margin

Rate Limit:20 requests per 2 seconds

HTTP Requests adjust margin

  • POST /api/swap/v3/account/adjustMargin

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

amount

String

Yes

Adjust amount

positionType

Integer

Yes

Direction 0 Long; 1 Short

type

Integer

Yes

Type 1 Increase; 2 Reduce

Response:

{
    "result":true,      //result
    "orderNo":"527252921197264814"   //Order ID
 }

Response Field

Field
Description

result

Result

orderNo

Order ID

Auto Margin Replenishment (AMR)

Rate Limit:5 requests per second

HTTP Requests Auto Margin Replenishment (AMR)

  • POST /api/swap/v3/account/modifyAutoAppendMargin

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

holdSide

Integer

Yes

Position direction 1 Long; 2 Short

append_type

Integer

Yes

Adjust margin type: 0 Manually; 1 Automatic

Response:

{
     "result":true,       //Setting result
     "append_type":1     //Current setting: 0 Manually 1 Automatic
 }

Response Field

Field
Description

result

Setting result

append_type

Current setting: 0 Manually 1 Automatic

Get All Contract Position Information

Rate Limit:5 requests per second

HTTP Requests get all contract position information

  • GET /api/swap/v3/position/allPosition

Response:

 [
 {
    "margin_mode":"fixed",       //Margin mode: crossed / fixed
    "holding":[
           {
              "symbol":"cmt_btcusdt",      //Contract name
              "liquidation_price":"0.00",    //Estimated liquidation price
              "position":"0",               //Position Margi(the margin for holding current positions)
              "avail_position":"0",        //Available position
              "avg_cost":"0.00",          //Transaction average price
              "leverage":"2",            //Leverage
              "realized_pnl":"0.00000000",      //Realized Profit and loss
              "keepMarginRate":"0.005",        //Maintenance margin rate
              "side":"1",                      // Position Direction Long or short     Mark obsolete
              "holdSide":"1",                      //Position Direction Long or short
              "timestamp":"1557571623963",    //System timestamp
              "margin":"0.0000000000000000"  //Used margin
              "unrealized_pnl":"0.00000000" //Unrealized profit and loss
       }
     ]
 }
]

Response Field

Field
Description

margin_mode

Margin mode: crossed / fixed

symbol

Contract name

liquidation_price

Estimated liquidation price

position

Position Margi(the margin for holding current positions)

avail_position

Available position

avg_cost

Transaction average price

leverage

Leverage

realized_pnl

Realized Profit and loss

keepMarginRate

Maintenance margin rate

side

Direction Long or short

holdSide

Position Direction Long or short

timestamp

System timestamp

margin

Used margin

unrealized_pnl

Unrealized profit and loss

Get Position Information By Symbol

Rate Limit:10 requests per second

HTTP Requests Retrieve information on your positions of a single contract.

  • GET /api/swap/v3/position/singlePosition

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

Response:

{
    "margin_mode":"fixed",       //Margin mode: crossed / fixed
    "holding":[
           {
              "symbol":"cmt_btcusdt",       //Contract name
              "liquidation_price":"0.00",  //Estimated liquidation price
              "position":"0",             //Position Margi(the margin for holding current positions)
              "avail_position":"0",      //Available position
              "avg_cost":"0.00",        //Transaction average price
              "leverage":"2",          //Leverage
              "realized_pnl":"0.00000000",    //Realized Profit and loss
              "keepMarginRate":"0.005",      //Maintenance margin rate
              "side":"1",                    //Position Direction Long or short     Mark obsolete
              "holdSide":"1",                    //Position Direction Long or short
              "timestamp":"1557571623963",  // System timestamp
              "margin":"0.0000000000000000"   //Used margin
              "unrealized_pnl":"0.00000000" //Unrealized profit and loss
       }
     ]
 }

Response Field

Field
Description

margin_mode

Margin mode: crossed / fixed

symbol

Contract name

liquidation_price

Estimated liquidation price

position

Position Margi(the margin for holding current positions)

avail_position

Available position

avg_cost

Transaction average price

leverage

Leverage

realized_pnl

Realized Profit and loss

keepMarginRate

Maintenance margin rate

holdSide

Direction: Long or short

timestamp

System timestamp

margin

Used margin

unrealized_pnl

Unrealized profit and loss

Change Account Mode

Rate Limit:20 requests per second

HTTP Requests Change account mode by symnol

  • POST /api/swap/v3/position/changeHoldModel

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

holdModel

Integer

Yes

account mode (1 position by position 2 full position)

Response:

{
    "symbol":"cmt_btcusdt",     //Contract name
    "resultHoldMode":1,        //Return to the account mode 1 position by position 2 full position
    "switchSuccess":true      //Whether the modification is successful true success false failure
}

Response Field

Field
Description

symbol

Contract name

resultHoldMode

Return to the account mode 1 position by position 2 full position

switchSuccess

Whether the modification is successful true success false failure

Last updated