Contract API

Base Info

The base url

Time zone

The time zone for all times is UTC+0

WebSocket Overview

WebSocket is a new protocol for HTML5, which enables full-duplex communication between the client and the server, allowing data to travel in both directions quickly. The client and server connections can be established through a simple handshake, and the server can actively push information to the client according to the business rules. The advantages are as follows:

  • When the client and the server perform data transmission, the request header information is relatively small, about 2 bytes.

  • Both the client and the server can actively send data to the other party.

  • There is no need to create TCP requests and destroy multiple times, saving bandwidth and server resources.

Market Endpoint

Contract info

Exchange trading rules and symbol information

Limit:

Speed limit: 1 times/second, Speed limit rule: IP

Request Url:

GET /basic/refData

Parameters:

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": [
    {
      "lotSize": 1.0,
      "symbol": "MASKUSDT",
      "tick": 0.001,
      "type": "PERP"
    }
  ]
}

Klines

Obtain K line by from and step

Limit:

Speed limit: 15 times/1min, Speed limit rule: IP

Request URL:

GET /kLine/byFrom

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        [
            "25559.4",
            "25559.7",
            "1686905040",
            "25553.2",
            "25554.1",
            "1",
            "7.08",
            "181074.0"
        ]
    ]
}

Klines By Time

Obtain K line by time and step

Limit:

Speed limit: 15 times/1min, Speed limit rule: IP

Request URL:

GET /kLine/byTime

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        [
            "25559.4",
            "25559.7",
            "1686905040",
            "25553.2",
            "25554.1",
            "1",
            "7.08",
            "181074.0"
        ]
    ]
}

Index

Index price of underlying asset

Limit:

Speed limit: 10 times/second, Speed limit rule: IP

Request Url:

GET /basic/indexPrice

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "symbol": "BTCUSDT",
            "price": 26442.32666666667,
            "time": 1686209050099
        }
    ]
}

Last Price

Query last price of instrument(s)

Limit:

Speed limit: 1 times/second, Speed limit rule: IP

Request Url:

GET /basic/lastPrice

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "price": 26627.7,
            "symbol": "BTCUSDT",
            "time": 1686304783617
        }
    ]
}

Mark Price

Query mark price of instrument(s)

Limit:

Speed limit: 10 times/second, Speed limit rule: IP

Request Url:

GET /basic/markPrice

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "price": 26627.7,
            "symbol": "BTCUSDT",
            "time": 1686304783617
        }
    ]
}

Funding Rate

Obtain funding rate of instrument

Limit:

Speed limit: 5 times/second, Speed limit rule: IP

Request Url:

GET /kLine/fundingRate

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "symbol": "BTCUSDT",
            "rate": 0.0001,
            "date": "2023-06-08T08:00:00.000+00:00",
            "timestamp": 1686207600020
        }
    ]
}

Depth

Query market depth Snapshot & trades of instrument

Limit:

Speed limit: 10 times/second, Speed limit rule: IP

Request Url:

GET /depth/list

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": {
        "buyDepth": [
            {
                "price": 26418.5,
                "qty": 50056.0,
                "count": 6,
                "iceCount": 0
            },
            {
                "price": 26418.4,
                "qty": 80489.0,
                "count": 6,
                "iceCount": 0
            },
            {
                "price": 26418.1,
                "qty": 58500.0,
                "count": 4,
                "iceCount": 0
            }
        ],
            "sellDepth": [
            {
                "price": 26418.8,
                "qty": 7797.0,
                "count": 2,
                "iceCount": 0
            },
            {
                "price": 26418.9,
                "qty": 9891.0,
                "count": 2,
                "iceCount": 0
            },
            {
                "price": 26419.0,
                "qty": 17483.0,
                "count": 5,
                "iceCount": 0
            },
            {
                "price": 26419.1,
                "qty": 19006.0,
                "count": 6,
                "iceCount": 0
            },
            {
                "price": 26419.2,
                "qty": 17266.0,
                "count": 6,
                "iceCount": 0
            }
        ],
            "trades": null
    }
}

trades

Retrieve the latest trades that have occurred for a specific contract.

Limit:

Speed limit: 10 times/second, Speed limit rule: IP

Request URL:

GET /depth/trades

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "id": "1686213904404000035",
            "symbol": "BTCUSDT",
            "price": 26428.9,
            "qty": 1295.0,
            "buyActive": false,
            "timestamp": "2023-06-08T08:45:04.404+00:00",
            "tms": "1686213904404"
        },
        {
            "id": "1686213899234000003",
            "symbol": "BTCUSDT",
            "price": 26438.2,
            "qty": 2000.0,
            "buyActive": false,
            "timestamp": "2023-06-08T08:44:59.234+00:00",
            "tms": "1686213899234"
        },
        {
            "id": "1686213884863000003",
            "symbol": "BTCUSDT",
            "price": 26433.3,
            "qty": 9100.0,
            "buyActive": true,
            "timestamp": "2023-06-08T08:44:44.863+00:00",
            "tms": "1686213884863"
        }
    ]
}

Trade Statistics in latest 24 hours

Trade Statistics in latest 24 hours

Limit:

Speed limit: 10 times/second, Speed limit rule: IP

Request URL:

GET /kLine/tradeStatistics

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "lastPrice": 25971.3,
            "maxPrice": 26420.9,
            "minPrice": 25713.4,
            "priceChange": -142.0,
            "priceChangeRatio": -0.005437842019200944,
            "symbol": "BTCUSDT",
            "turnover": 16171.504782381482,
            "volume": 4.19809141E8
        }
    ]
}

Open Position In Exchange

Total Open Position In Exchange

Limit:

Speed limit: 5 times/second, Speed limit rule: IP

Request URL:

GET /kLine/openInterest

Parameters:

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": {
        "symbol": "BTCUSDT",
            "value": 41.035743951380205,
            "date": "2023-06-19T02:37:53.617+00:00",
            "qty": 1084388.0
    }
}

Public Websocket Endpoints

Receiving data requires an event subscription

Kline

Parameters:

Example:

{
  "op": "subscribe",
  "key": "BTCUSDT",
  "type": "1M",
  "channel": "kLine"
}

Response:

Example:

{
    "hisPrice": [
    "25557.4",
    "25557.7",
    "1686905100",
    "25557.4",
    "25557.5",
    "1",
    "0.69",
    "17681.0"
],
    "isNew": false,
    "key": "MEXO_BTCUSDT_1M"
}

Depth

Parameters:

Example:

{
  "buyDepth": [
    {
      "price": 25916.1,
      "qty": 26144.0,
      "count": 4,
      "iceCount": 0
    },
    {
      "price": 25915.9,
      "qty": 82419.0,
      "count": 7,
      "iceCount": 0
    }
  ],
  "sellDepth": [
    {
      "price": 25916.4,
      "qty": 6233.0,
      "count": 2,
      "iceCount": 0
    },
    {
      "price": 25917.3,
      "qty": 33746.0,
      "count": 5,
      "iceCount": 0
    }
  ],
  "trades": [
    {
      "id": "1686733223325000025",
      "symbol": "BTCUSDT",
      "price": 25916.4,
      "qty": 3648.0,
      "buyActive": true,
      "timestamp": "Jun 14, 2023 09:00:23 AM",
      "tms": "1686733223325"
    },
    {
      "id": "1686733223325000023",
      "symbol": "BTCUSDT",
      "price": 25916.4,
      "qty": 4289.0,
      "buyActive": true,
      "timestamp": "Jun 14, 2023 09:00:23 AM",
      "tms": "1686733223325"
    }

  ],
  "key": "BTCUSDT"
}

Trade Statistics

Parameters:

Example:

{
  "op": "subscribe",
  "key": "BTCUSDT",
  "channel": "tradeStatistics"
}

Response:

Example:

{
  "tradeStatistics": {
    "symbol": "BTCUSDT",
    "maxPrice": 26081.8,
    "minPrice": 24800.2,
    "priceChange": -919.1000000000022,
    "priceChangeRatio": -0.03533002494743365,
    "volume": 4.55661746E8,
    "turnover": 17834.7449180242,
    "lastPrice": 25095.6
  },
  "key": "BTCUSDT"
}

Open Interest

Total Open Position In Exchange

Parameters:

Example:

{
  "op": "subscribe",
  "key": "BTCUSDT",
  "channel": "openInterest"
}

Response:

Example:

{
  "key": "BTCUSDT",
  "event": "openInterest",
  "value": 45.36721464659362,
  "date": "Jun 19, 2023 03:06:10 AM",
  "qty": 1199212.0
}

Trade Http Endpoints

Trade Endpoints Check signature. Check parameters are passed in header

Place order for a contract. This API endpoint requires your signed request.

Request Weight:

Speed limit: 20 times/second Speed limit rule: apiKey

Request URL:

POST /trade/enterOrder

Parameters:

NOTE For Market Orders, you need to set orderType as Market.

You can get contract price and quantity precision configuration data in the exchange endpoint.

Note: if your balance does not meet the margin requirement (which is the minimum margin requirement + open position fee + close position fee), "insufficient balance" error message will be returned.

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": {
    "ordStatus": "PENDING_NEW",
    "symbol": "BTCUSDT",
    "clientOrderId": "213443",
    "showQty": 0.0,
    "side": "Sell",
    "created": 1685699501000,
    "fee": 0.0,
    "cumQty": 0.0,
    "source": "Normal",
    "type": "Market",
    "pnl": 0.0,
    "tif": "GOOD_TILL_CANCEL",
    "openPosition": true,
    "uid": "1323056886107491328",
    "avgPx": 0.0,
    "price": 0.0,
    "qty": 100.0,
    "iceberg": false,
    "modified": 1685699501000,
    "currency": "BTC",
    "id": "O101-20230602-095141-711-1878"
  }
}

Query Order

Request order by id

Limit:

Speed limit: 20 times/second, Speed limit rule: apiKey

Request URL:

GET /trade/queryOrderById

Parameters:

NOTE orderId and clientOrderId must pick one of two

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": {
    "id": "O101-20230531-040439-546-1837",
    "uid": "1323056886107491328",
    "symbol": "BTCUSDT",
    "created": 1685505879000,
    "modified": 1685505879000,
    "side": "Buy",
    "type": "Market",
    "tif": "GOOD_TILL_CANCEL",
    "currency": "BTC",
    "price": 0.0,
    "qty": 100.0,
    "openPosition": false,
    "cumQty": 100.0,
    "avgPx": 27620.2,
    "ordStatus": "FILLED",
    "iceberg": false,
    "showQty": 0.0,
    "source": "Normal",
    "pnl": 1.3365529862569942E-6,
    "fee": -1.448215436528338E-6,
    "triggerPrice": null,
    "triggerType": null,
    "stopLossPrice": null,
    "stopWinType": null,
    "stopWinPrice": null,
    "trailingStop": null
  }
}

Query Order List

Request order by time

Limit:

Speed limit: 10 times /1 minutes, Speed limit rule: apiKey, Response data limitation: 300

Request URL:

GET /trade/queryOrders

Parameters:

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": [
    {
      "id": "O101-20230531-040439-546-1837",
      "uid": "1323056886107491328",
      "symbol": "BTCUSDT",
      "created": 1685505879000,
      "modified": 1685505879000,
      "side": "Buy",
      "type": "Market",
      "tif": "GOOD_TILL_CANCEL",
      "currency": "BTC",
      "price": 0.0,
      "qty": 100.0,
      "openPosition": false,
      "cumQty": 100.0,
      "avgPx": 27620.2,
      "ordStatus": "FILLED",
      "iceberg": false,
      "showQty": 0.0,
      "source": "Normal",
      "pnl": 1.3365529862569942E-6,
      "fee": -1.448215436528338E-6,
      "triggerPrice": null,
      "triggerType": null,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null
    }
  ]
}

Query Trade List

Request trades by order id

Limit:

Speed limit: 10 times/1min, Speed limit rule: apiKey

Request URL:

GET /trade/queryTrades

Parameters:

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": [
    {
      "id": "T101-20230531-040439-548-1608",
      "symbol": "BTCUSDT",
      "orderId": "O101-20230531-040439-546-1837",
      "side": "Buy",
      "openPosition": false,
      "userId": "1323056886107491328",
      "accountId": "1323056886107491328-CCF-BTC",
      "price": 27620.2,
      "qty": 100.0,
      "fee": -1.448215436528338E-6,
      "feeRate": -4.0E-4,
      "createdTimestamp": "1685505880000",
      "currency": "BTC"
    }
  ]
}

Query Active Orders

Limit:

Speed limit: 60 times /1 minutes, Speed limit rule: apiKey

Request URL:

GET /trade/queryActiveOrders

Parameters:

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": [
    {
      "id": "O101-20230531-040439-546-1837",
      "uid": "1323056886107491328",
      "symbol": "BTCUSDT",
      "created": 1685505879000,
      "modified": 1685505879000,
      "side": "Buy",
      "type": "Market",
      "tif": "GOOD_TILL_CANCEL",
      "currency": "BTC",
      "price": 0.0,
      "qty": 100.0,
      "openPosition": false,
      "cumQty": 100.0,
      "avgPx": 27620.2,
      "ordStatus": "FILLED",
      "iceberg": false,
      "showQty": 0.0,
      "source": "Normal",
      "pnl": 1.3365529862569942E-6,
      "fee": -1.448215436528338E-6,
      "triggerPrice": null,
      "triggerType": null,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null
    }
  ]
}

Cancel order

Cancel an order, orderId or clientOrderId is required. This API endpoint requires your signed request.

Request Weight:

Speed limit: 40 times/second Speed limit rule: apiKey

Request Url:

POST /trade/cancelOrder

Parameter:

orderId and clientOrderId, at least one MUST be provided.

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": "O101-20230531-023520-732-0610"
}

Close Position

Close all position with market price

Request Weight:

Speed limit: 8 times/second Speed limit rule: apiKey

Request URL:

POST /trade/closePosition

Parameters:

Response:

{
  "code": 0,
  "message": "OK",
  "result": null
}

Query Position

Query all the position of the user

Limit:

Speed limit: 60 times /1 minutes, Speed limit rule: apiKey

Request URL:

GET /trade/queryPosition

Parameters:

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": [
    {
      "uid": "1323056886107491328",
      "currency": "ETH",
      "symbol": "BTCUSDT",
      "side": "Long",
      "qty": 0.0,
      "individualPosition": true,
      "price": 0.0,
      "closableQty": 0.0,
      "pnlRate": 0.0,
      "value": 0.0,
      "positionLeverage": 20.0,
      "trailingStopPrice": 0.0,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null,
      "pnl": 0.0,
      "urPnL": 0.0,
      "liquidationPrice": 0.0,
      "deposit": 0.0,
      "created": "2023-02-15T11:40:13.000+00:00",
      "lastPrice": 27128.5
    },
    {
      "uid": "1323056886107491328",
      "currency": "USDT",
      "symbol": "BTCUSDT",
      "side": "Short",
      "qty": 100.0,
      "individualPosition": false,
      "price": 27117.1,
      "closableQty": 100.0,
      "pnlRate": -0.013644526885249529,
      "value": 100.0,
      "positionLeverage": 20.0,
      "trailingStopPrice": 0.0,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null,
      "pnl": -0.04,
      "urPnL": -0.09742929738062658,
      "liquidationPrice": 162026.91766730743,
      "deposit": 5.0,
      "created": "2023-05-31T08:03:45.000+00:00",
      "lastPrice": 27128.5
    },
    {
      "uid": "1323056886107491328",
      "currency": "TUSDT",
      "symbol": "TBTCTUSDT",
      "side": "Long",
      "qty": 0.0,
      "individualPosition": true,
      "price": 0.0,
      "closableQty": 0.0,
      "pnlRate": 0.0,
      "value": 0.0,
      "positionLeverage": 20.0,
      "trailingStopPrice": 0.0,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null,
      "pnl": 0.0,
      "urPnL": 0.0,
      "liquidationPrice": 0.0,
      "deposit": 0.0,
      "created": "2023-02-17T09:06:52.000+00:00",
      "lastPrice": 27135.0
    },
    {
      "uid": "1323056886107491328",
      "currency": "TUSDT",
      "symbol": "TBTCTUSDT",
      "side": "Short",
      "qty": 0.0,
      "individualPosition": true,
      "price": 0.0,
      "closableQty": 0.0,
      "pnlRate": 0.0,
      "value": 0.0,
      "positionLeverage": 20.0,
      "trailingStopPrice": 0.0,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null,
      "pnl": 0.0,
      "urPnL": 0.0,
      "liquidationPrice": 0.0,
      "deposit": 0.0,
      "created": "2023-02-15T11:05:54.000+00:00",
      "lastPrice": 27135.0
    },
    {
      "uid": "1323056886107491328",
      "currency": "BTC",
      "symbol": "BTCUSDT",
      "side": "Long",
      "qty": 0.0,
      "individualPosition": false,
      "price": 0.0,
      "closableQty": 0.0,
      "pnlRate": 0.0,
      "value": 0.0,
      "positionLeverage": 16.0,
      "trailingStopPrice": 0.0,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null,
      "pnl": 0.0,
      "urPnL": 0.0,
      "liquidationPrice": 0.0,
      "deposit": 0.0,
      "created": "2023-02-15T11:08:13.000+00:00",
      "lastPrice": 27128.5
    },
    {
      "uid": "1323056886107491328",
      "currency": "BTC",
      "symbol": "BTCUSDT",
      "side": "Short",
      "qty": 0.0,
      "individualPosition": false,
      "price": 0.0,
      "closableQty": 0.0,
      "pnlRate": 0.0,
      "value": 0.0,
      "positionLeverage": 16.0,
      "trailingStopPrice": 0.0,
      "stopLossPrice": null,
      "stopWinType": null,
      "stopWinPrice": null,
      "trailingStop": null,
      "pnl": 0.0,
      "urPnL": 0.0,
      "liquidationPrice": 0.0,
      "deposit": 0.0,
      "created": "2023-05-31T04:04:07.000+00:00",
      "lastPrice": 27128.5
    }
  ]
}

Switch PosSide

Switch position side

Limit:

Speed limit: 8 times/second, Speed limit rule: apiKey

Request Url:

POST /trade/switchPosSide

Parameter:

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": null
}

Change Position Mode

Change position mode between Individual and Cross

Limit:

Speed limit: 8 times/second, Speed limit rule: apiKey

Request Url:

POST /trade/changePosMode

Parameter:

Response:

{
  "code": 0,
  "message": "OK",
  "result": null
}

Change PosLeverage

Change position leverage

Limit:

Speed limit: 8 times/second, Speed limit rule: apiKey

Request Url:

POST /trade/changePosLeverage

Parameter:

Response:

{
  "code": 0,
  "message": "OK",
  "result": null
}

Change Risk

Change risk setting of position

Limit:

Speed limit: 10 times/second, Speed limit rule: apiKey

Request Url:

POST /trade/riskSetting

Parameter:

Response:

{
  "code": 0,
  "message": "OK",
  "result": null
}

Query Accounts

This endpoint is used to retrieve contract account balance. This endpoint requires your signed request.

Limit:

Speed limit: 60 times/min, Speed limit rule: apiKey

Request Url:

GET  /trade/queryAccounts

Parameters:

None

Response:

Example:

{
    "code": 0,
        "message": "OK",
        "result": [
        {
            "uid": "1323056886107491328",
            "currency": "ETH",
            "cash": 0.0,
            "withdrawableCash": 0.0,
            "frozenCash": 0.0,
            "urPnl": 0.0,
            "cashAvailable": 0.0
        },
        {
            "uid": "1323056886107491328",
            "currency": "USDT",
            "cash": 499.90922659263174,
            "withdrawableCash": 499.90922659263174,
            "frozenCash": 0.0,
            "urPnl": 0.0,
            "cashAvailable": 499.90922659263174
        },
        {
            "uid": "1323056886107491328",
            "currency": "TUSDT",
            "cash": 1000.0,
            "withdrawableCash": 1000.0,
            "frozenCash": 0.0,
            "urPnl": 0.0,
            "cashAvailable": 1000.0
        },
        {
            "uid": "1323056886107491328",
            "currency": "BTC",
            "cash": 9.999288458956643,
            "withdrawableCash": 0.0,
            "frozenCash": 9.999288458956643,
            "urPnl": 2.573443933625344E-5,
            "cashAvailable": 9.999190074639152
        }
    ]
}

Query Account Settings

Limit:

Speed limit: 60 times/1min, Speed limit rule: apiKey

Request Url:

GET  /trade/queryAccountSettings

Parameters:

None

Response:

Example:

{
  "code": 0,
  "message": "OK",
  "result": [
    {
      "uid": "1323056886107491328",
      "currency": "ETH",
      "twoWayPosition": false,
      "individualPosition": true
    },
    {
      "uid": "1323056886107491328",
      "currency": "USDT",
      "twoWayPosition": true,
      "individualPosition": false
    },
    {
      "uid": "1323056886107491328",
      "currency": "TUSDT",
      "twoWayPosition": false,
      "individualPosition": true
    },
    {
      "uid": "1323056886107491328",
      "currency": "BTC",
      "twoWayPosition": true,
      "individualPosition": false
    }
  ]
}

Private Websocket Endpoints

Receiving data requires two steps:

  • Step 1: User login

  • Step 2:Subscription event

User Login

Parameters:

Example:

{
	"op": "login",
	"txId" :"TX20200317-133934-511-458",
    "apiKey": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
	"signature": "6532a891aa0b950bf28d82cf71bbce4a379029417d855de76e793654a1247e89",
	"expires": "1787218464317"
}

Response:

Example:

{
  "txId": "TX20200317-133934-511-458",
  "errCode": 0,
  "key": null
}

User Account Update

Parameters:

Example:

{
  "op": "subscribe",
  "apiKey": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
  "signature": "6942114e809638701c001f1f2f633fe92727e42b54376a7c7fd594fc170e5819",
  "expires": "1787218464317",
  "channel": "accountUpdate"
}

Response:

Example:

{
  "account": {
    "uid": "1323056886107491328",
    "currency": "USDT",
    "cash": 499.6878667490653,
    "withdrawableCash": 0.0,
    "frozenCash": 499.6878667490653,
    "urPnl": 0.03929670132261469,
    "cashAvailable": 494.72519861532174
  },
  "key": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
  "event": "accountUpdate"
}

User Position Update

Parameters:

Example:

{
  "op": "subscribe",
  "apiKey": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
  "signature": "6942114e809638701c001f1f2f633fe92727e42b54376a7c7fd594fc170e5819",
  "expires": "1787218464317",
  "channel": "positionUpdate"
}

Response:

Example:

{
  "position": {
    "uid": "1323056886107491328",
    "currency": "BTC",
    "symbol": "BTCUSDT",
    "side": "Short",
    "qty": 100.0,
    "individualPosition": false,
    "price": 25736.8,
    "closableQty": 100.0,
    "pnlRate": -1.1547384662514797,
    "value": 0.0037344734597817746,
    "positionLeverage": 30.0,
    "trailingStopPrice": 0.0,
    "stopLossPrice": 0.0,
    "stopWinType": null,
    "stopWinPrice": 0.0,
    "trailingStop": 0.0,
    "pnl": -4.389851219720317E-6,
    "urPnL": -1.5101346944019543E-4,
    "liquidationPrice": 0.0,
    "deposit": 1.2951623097406568E-4,
    "created": 1686049269000,
    "lastPrice": 26766.9
  },
  "key": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
  "event": "positionUpdate"
}

User Order Update

Parameters:

Example:

{
  "op": "subscribe",
  "apiKey": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
  "signature": "6942114e809638701c001f1f2f633fe92727e42b54376a7c7fd594fc170e5819",
  "expires": "1787218464317",
  "channel": "orderUpdate"
}

Response:

Example:

{
  "order": {
    "id": "O101-20230607-085005-846-2198",
    "clientOrderId": "213443",
    "uid": "1323056886107491328",
    "symbol": "BTCUSDT",
    "created": 1686127805000,
    "modified": 1686127805000,
    "side": "Buy",
    "type": "Market",
    "tif": "GOOD_TILL_CANCEL",
    "currency": "BTC",
    "price": 0.0,
    "qty": 100.0,
    "openPosition": false,
    "cumQty": 0.0,
    "avgPx": 0.0,
    "ordStatus": "NEW",
    "iceberg": false,
    "showQty": 0.0,
    "source": "Normal",
    "pnl": 0.0,
    "fee": 0.0,
    "triggerPrice": null,
    "triggerType": null,
    "stopLossPrice": null,
    "stopWinType": null,
    "stopWinPrice": null,
    "trailingStop": null
  },
  "key": "Ffs9IfPXEgeZa0aDebgkS4h1In73w2a0IyqYcfnVraGCcjLFKPR6bpGxw0iiMVzl",
  "event": "orderUpdate"
}

Code Description

Last updated