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

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

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

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

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

Set Swap Leverage

Rate Limit:5 requests per second

HTTP Requests Set swap leverage

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

Request Parameter

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

Adjust Margin

Rate Limit:20 requests per 2 seconds

HTTP Requests adjust margin

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

Request Parameter

Response:

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

Response Field

Auto Margin Replenishment (AMR)

Rate Limit:5 requests per second

HTTP Requests Auto Margin Replenishment (AMR)

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

Request Parameter

Response:

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

Response Field

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

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

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

Change Account Mode

Rate Limit:20 requests per second

HTTP Requests Change account mode by symnol

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

Request Parameter

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

Last updated