Contract Trades Endpoints

New Order

Rate Limit:10 requests per second

HTTP Requests new order

  • POST /api/swap/v3/order/placeOrder

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

client_oid

String

Yes

Custom order number (not more than 40 characters, and cannot be special characters, such as Martian characters, etc.), can not be repeated in the pending order. If vacant, the system will automatically assign value

size

String

Yes

Quantity to buy or sell (value not equal to 0 or negative)

type

String

Yes

1:Open long, 2:Open short,3: Close long,4: Close short

order_type

String

Yes

0: Normal order (Unfilled and 0 imply normal limit order) 1: Post only 2: Fill or Kill 3: Immediate Or Cancel

match_price

String

Yes

0 Limit price

1 market price

price

String

Yes

price

presetTakeProfitPrice

BigDecimal

Yes

Preset take profit price

presetStopLossPrice

BigDecimal

Yes

Preset stop Loss Price

Response:

{
    "client_oid":"ww#123456",      //Client  ID 
    "order_id":"513466539039522813"   //Order ID 
}

Response Filed

Field
Description

client_oid

Client ID

order_id

Order ID

Place Multiple Orders

Rate Limit:10 requests per second

HTTP Requests Place multiple orders

  • POST /api/swap/v3/order/batchOrders

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

orderDataList

List

Yes

Object attributes, e.g (price=5,size=2,type=1,match_price=1,order_type=1,client_oid="abc"),The fields refer to the [Contract trading] endpoints, and can only process up to 20 orders in batch

Response:

{
    "result":true,  
    "order_info":[
        {
            "result":true,         //Result of an Order
            "client_oid":"dxdanzi",     //Client  ID
            "order_id":"513468410013679613"   //Order ID
        },
        {
            "result":true,
            "client_oid":"dxdanzi",
            "order_id":"513468410001096713"
        }
    ]
}

Response Filed

Filed
Description

result

Contract name

client_oid

Client ID

order_id

Order ID

Cancel Order

Rate Limit:10 requests per seconds

HTTP Requests request to cancel order

  • POST /api/swap/v3/order/cancel_order

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

orderId

String

Yes

Order ID

Response:

{
   "symbol":"cmt_btcusdt",          //Contract name
   "order_id":"513468410013679613",   //Order ID
   "client_oid":"bitget#123456",     //Client ID
   "result":true                    //Cancellation status
}

Response Filed

Filed
Description

symbol

Contract name

order_id

Order id

client_oid

Client id

result

Cancellation status

Cancel Multiple Orders

Rate Limit:10 requests per seconds

HTTP Requests Cancel multiple orders

  • POST /api/swap/v3/order/cancel_batch_orders

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

ids

List

Yes

Order id combination

Response:

{
   "symbol":"cmt_btcusdt",      //Contract name
   "result":true,              //processing result
   "order_ids":[
          "258414711",   //Successful id
          "478585558"
    ],
   "fail_infos":[
          {
        "order_id":"258414711",   //Failed id
        "err_code":"401",        //Error code
        "err_msg":""            //Error message
     }
  ]
}

Response Filed

Filed
Description

symbol

Contract name

result

Processing result

order_ids

Orders

order_id

Order id

err_code

Error code

err_msg

Error message

Get The Order Details By Order Id

Rate Limit:10 requests per second

HTTP Requests get the order details by order id

  • GET /api/swap/v3/order/detail

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

orderId

String

Yes

Order id

Response:

{
     "symbol":"cmt_btcusdt",    //Contract name
     "size":"12",              //The amount in this order
     "timestamp":"15582271175271",     //Obsolete field
     "client_oid":"cmdtde",           //Client ID
     "createTime":"1698475585258",   //Creation time
     "filled_qty":"0",              //The amount which has been filled
     "fee":"0",                    //Transaction fee
     "order_id":"513468410013679613",    //Order ID
     "price":"12",                      //The limit price of limit order 
     "price_avg":"0",                  //Average filled price
     "status":"-1",                   //Order status
     "type":"1",                     //Commission type
     "order_type":"0",              //Order type
     "totalProfits":"253"          //Total profit and loss          
}

Response Filed

Filed
Description

symbol

Contract name

size

The amount in this order

timestamp

System time

client_oid

Client id

createTime

Creation time

filled_qty

The amount which has been filled

fee

Transaction fee

order_id

Order id

price

The limit price of limit order

price_avg

Average filled price

status

Order status -1 Cancelled successful 0 submitted 1partial-filled 2filled

type

Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short

order_type

Order Type 0. Normal limit order 1. Only be Maker (Post only)"2 Fill or Kill (FOK) 3. Immediate or Cancel (IOC)

totalProfits

Total profit and loss

Get order history commission

Rate Limit:10 requests per second

HTTP Requests Get order history commission

  • GET /api/swap/v3/order/history

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

pageIndex

String

Yes

Page number, empty default first page, starting from 1

pageSize

String

Yes

Number of data per page

createDate

Integer

Yes

Number of days (the number of days must be less than or equal to 90, cannot be a negative number)

Response:

[
   {
     "symbol":"cmt_btcusdt", //合约名称
     "size":"12", //委托数量
     "client_oid":"cmdtde", //客户端标识
     "createTime":"1698475585258", //创建时间戳
     "filled_qty":"0", //成交数量
     "fee":"0", //手续费
     "order_id":"513468410013679613", //订单id
     "price":"12", //委托价格
     "price_avg":"0", //成交均价
     "status":"-1", //订单状态
     "type":"1", //委托类型
     "order_type":"0", //订单类型
     "totalProfits":"253" //总盈亏
 }
]

Response Filed

Parameters
Description

symbol

Contract name

size

The amount in this order

client_oid

Client id

createTime

Creation time

filled_qty

The amount which has been filled

fee

Transaction fee

order_id

Order id

price

The limit price of limit order

price_avg

Average filled price

status

Order status -1 Cancelled successful 0 submitted 1partial-filled 2filled

type

Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short

order_type

Order Type 0. Normal limit order 1. Only be Maker (Post only)"2 Fill or Kill (FOK) 3. Immediate or Cancel (IOC)

totalProfits

Total profit and loss

Get the current order of the order

Rate Limit:10 requests per second

HTTP Requests Get the current order of the order

  • GET /api/swap/v3/order/current

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

Response:

[
   {
          "symbol":"cmt_btcusdt",    //Contract name
          "size":"12",              //The amount in this order
          "client_oid":"cmdtde",           //Client ID
          "createTime":"1698475585258",   //Creation time
          "filled_qty":"0",              //The amount which has been filled
          "fee":"0",                    //Transaction fee
          "order_id":"513468410013679613",    //Order ID
          "price":"12",                      //The limit price of limit order 
          "price_avg":"0",                  //Average filled price
          "status":"-1",                   //Order status
          "type":"1",                     //Commission type
          "order_type":"0",              //Order type
          "totalProfits":"253"          //Total profit and loss    
 }
]

Response Filed

Filed
Description

symbol

Contract name

size

The amount in this order

client_oid

Client id

createTime

Creation time

filled_qty

The amount which has been filled

fee

Transaction fee

order_id

Order id

price

The limit price of limit order

price_avg

Average filled price

status

Order status -1 Cancelled successful 0 submitted 1partial-filled 2filled

type

Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short

order_type

Order Type 0. Normal limit order 1. Only be Maker (Post only)"2 Fill or Kill (FOK) 3. Immediate or Cancel (IOC)

totalProfits

Total profit and loss

Get Transaction Details

Rate Limit:10 requests per second

HTTP Requests get transaction details

  • GET /api/swap/v3/order/fills

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

orderId

String

Yes

Order id

Response:

[
  {
      "symbol":"cmt_btcusdt",    //Contract name
      "trade_id":"6667390",     //trade Id
      "order_id":"525946425993854915",   //order id
      "price":"9839.00",      //deal price
      "order_qty":"3466",    //Quantity
      "fee":"-0.0000528407360000",    //transaction fee
      "timestamp":"1561121514442",   //Creation time
      "exec_type":"M",              //Liquidity direction   Taker or maker (T or M)
      "side":"3",                 //Commission type    Mark obsolete
      "delegateType":"3"          //Commission type
}
]

Response Filed

Parameters
Description

symbol

Contract name

trade_id

Trade Id

order_id

Order id

price

Deal price

order_qty

Quantity

fee

transaction fee

timestamp

Creation time

exec_type

Liquidity direction Taker or maker (T or M)

delegateType

Commission type, 1,Open long 2 Open short 3 Close long 4 Close short 5 Buy limit 6Sell limit 7.Long close agreement 8. Short close agreement 9. Forced liquidity long 10 Forced liquidity short

New Trigger Order

Rate Limit:10 requests per second

HTTP Requests New trigger order

  • POST /api/swap/v3/order/plan_order

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

client_oid

String

Yes

not more than 40 characters, and cannot be special characters, such as Martian characters, etc.

size

String

Yes

Quantity to buy or sell (value not equal to 0 or negative))

type

String

Yes

1 Open position

2 Close position

holdSide

String

Yes

Position Direction

1 Long,2 Short

match_type

String

Yes

Order Type

0 Limit price;1 market price

execute_price

String

Yes

execute price

trigger_price

String

Yes

trigger price

Response:

{
      "client_oid":"bitget#123456",       //Client ID
      "order_id":"589579827556646928"    //trigger Order ID 
}

Response Filed

Filed
Description

client_oid

Client ID

order_id

trigger order id

Cancel Trigger Order

Rate Limit:10 requests per second

HTTP Requests Cancel trigger order

  • POST /api/swap/v3/order/cancel_plan

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

orderId

String

Yes

order id

Response:

{
     "order_id":"5895798275566469458",      //Order ID
     "client_oid":"bitget#123456",         //Client ID
     "result":false,                      //Status of cancellation
     "err_code":"403",                   //Code of cancellation 
     "err_msg":"order not exist"        //Reason of cancellation
}

Response Filed

Filed
Description

order_id

Order id

client_oid

Client id

result

Status of cancellation

err_code

Code of cancellation

err_msg

Reason of cancellation

Get Current Trigger Orders

Rate Limit:10 requests per second

HTTP Requests Get current trigger orders

  • GET /api/swap/v3/order/currentPlan

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

delegateType

String

Yes

Commission type 1 Open long 2 Open short 3 Close long 4 Close short

pageIndex

String

Yes

Current page (1-200)

pageSize

String

Yes

Number per page(1-100)

startTime

String

Yes

Query start time

endTime

String

Yes

Query stop time

Response:

{
      "list":[
              {
                 "symbol":"cmt_btcusdt",     //Contract name
                 "execute_count":"0",       //amount of Stop
                 "delegate_count":"1222222",     //amount of Limit
                 "create_time":1576294708136,   //Created time
                 "update_time":1576294708136,  //Updated time
                 "direction":1,               //Direction
                 "direction_desc":"开多",     //Description of direction
                 "trigger_price":"22222210.0",       //Stop price 
                 "execute_price":"7490.0",          //limit price (execute price) 
                 "order_id":"589588227514433528",  //Order ID
                 "order_type":0,                  //Order Type
                 "status":1,                     //status
                 "status_desc":"status",        //Description of status
                 "create_trade_price":"7490"   //Executed price of stop limit
           }
         ],
    "nextPage":false   //Next page 
}

Response Filed

Filed
Description

symbol

Contract name

nextPage

Next page

execute_count

Amount of Stop

delegate_count

Wmount of Limit

create_time

Created time

update_time

Updated time

direction

Direction 1.Open long 2.Open short 3 Close long 4 Close short

direction_desc

1.Open long 2.Open short 3 Close long 4 Close short

trigger_price

Trigger price

execute_price

Execute price

order_id

Order id

order_type

Order Type

0 Limit price;1 market price

status

Status 1: waiting to order 2: order placing 3: failed status 4 under cancellation

status_desc

1: waiting to order 2: order placing 3: failed status 4 under cancellation

create_trade_price

Executed trade price

Get The History Of Trigger Order

Rate Limit:10 requests per second

HTTP Requests Get The History Of Trigger Order

  • GET /api/swap/v3/order/historyPlan

Request Parameter

Parameters
Type
Required
Description

symbol

String

Yes

Contract name

delegateType

String

Yes

Commission type 1 Open long 2 Open short 3 Close long 4 Close short

pageIndex

String

Yes

current page(1-200)

pageSize

String

Yes

Number per page(1-100)

startTime

String

No

Query start time

endTime

String

No

Query end time

Response:

{
        "list":[
                    {
                       "symbol":"cmt_btcusdt",     //Contract name
                       "execute_count":"0",       //amount of Stop
                       "delegate_count":"1222222",     //amount of Limit
                       "create_time":1576294708136,   //Created time
                       "update_time":1576294708136,  //Updated time
                       "direction":1,               //Direction
                       "direction_desc":"开多",     //Description of direction
                       "trigger_price":"22222210.0",       //Stop price 
                       "execute_price":"7490.0",          //limit price (execute price) 
                       "order_id":"589588227514433528",  //Order ID
                       "order_type":0,                  //Order Type
                       "status":1,                     //status
                       "status_desc":"status",        //Description of status
                       "create_trade_price":"7490"   //Executed price of stop limit
                 }
               ],
          "nextPage":false   //Next page 
}

Response Filed

Filed
Description

symbol

Contract name

nextPage

Next page

execute_count

amount of limit

delegate_count

amount of order

create_time

Created time

update_time

Updated time

direction

Direction 1.Open long 2.Open short 3 Close long 4 Close short

direction_desc

Direction

trigger_price

trigger price

execute_price

execute price

order_id

Order ID

order_type

0 Limit price

1 Market price

status

1: waiting to order 2: order placing 3: failed status 4 under cancellation

status_desc

description of 1: waiting to order 2: order placing 3: failed status 4 under cancellation

create_trade_price

Executed trade price

Last updated