Trades

Request append param

name

type

required

detail

pair

String

period

String

1MIN,3MIN,5MIN,15MIN,30MIN,1HOUR,4HOUR,8HOUR,12HOUR,1DAY

{
  "pair": "ETH-USD",
  "period":"1MIN",
  "method": "SUBSCRIBE",
  "apiKey": "?",
    "signType": 2,
  "signature": "?",
  "event": "api_trade",
  "timestamp": 1657157345159
}

Receive data:

name

type

required

detail

data

Object[] Arrray list

trade info

event

String

api_trade

success

Boolean

true,false

data object:

name

type

required

detail

contractMatchPairId

long

ID

pair

String

price

BigDecimal

quantity

BigDecimal

amount

BigDecimal

isLong

Boolean

true/false

time

String

timestamp

Long

contractPairId

Long

pair ID

Example:

1 Get current timestamp(ms):

1725871110103

2 Sign the string format of the timestamp, result:

0x0ea7e63d06d57bcfe43e9f0348010253a9999b3c81081d82ef15f4c360ac4f61587dfb1b844589721fb11529a9ee5a146dfaf61bbffe00342d79d650845b7f661b

3 Assembling parameters, including basic parameters for subscription and custom additional parameters for the interface.

{
    "pair": "ETH-USD",
    "period": "1MIN",
    "method": "SUBSCRIBE",
    "event": "api_trade",
    "apiKey": "st_fq6cvRF4fr5tnKiZfrIntRnLfrwxcXjcfr1y8FR7",
    "signature": "0x0ea7e63d06d57bcfe43e9f0348010253a9999b3c81081d82ef15f4c360ac4f61587dfb1b844589721fb11529a9ee5a146dfaf61bbffe00342d79d650845b7f661b",
    "timestamp": 1725871110103,
    "signType": "2"
}

4 Returns after a successful subscription

{
    "event": "api_trade_res",
    "method": "SUBSCRIBE",
    "msg": "subscribe success: api_trade",
    "pair": "ETH-USD",
    "success": true
}

5 Server websocket push data.

{
    "data": [
        {
            "amount": 2576.22013,
            "contractMatchPairId": 19868095,
            "contractPairId": 1,
            "isLong": false,
            "pair": "ETH-USD",
            "price": 2318.83,
            "quantity": 1.111,
            "time": "08:38:27",
            "timestamp": 1725871107000
        },
        {
            "amount": 1054.89475,
            "contractMatchPairId": 19868087,
            "contractPairId": 1,
            "isLong": true,
            "pair": "ETH-USD",
            "price": 2318.45,
            "quantity": 0.455,
            "time": "08:38:17",
            "timestamp": 1725871097000
        }
    ],
    "event": "api_trade",
    "pair": "ETH-USD",
    "success": true
}

Last updated