Candlestick Subscription

Learn how to subscribe to real-time candlestick (OHLCV) data via WebSocket.

Overview

This page provides detailed documentation on how to subscribe to real-time candlestick (OHLCV) data using the WebSocket API. This WebSocket connection delivers continuous, live datafeeds for candlestick data across multiple markets such as stocks, cryptocurrencies, forex, and futures.

Request Frequency

For a single WebSocket connection, all requests (subscribe, unsubscribe, heartbeat) are limited to 60 times per minute. If the request frequency limit is exceeded, the connection will be automatically closed. If disconnections occur too frequently, and the system deems them to be malicious requests, the API key will be banned. Please be mindful of the calling logic during usage.

Error Code Explanation

Please refer to the WebSocket error code documentation for further details.

Subscription Address

Please refer to the WebSocket subscription addresses.

Request Quantity

Different subscription plans allow varying numbers of products per WebSocket subscription. Please refer to the WebSocket restrictions documentation for specific details.

Request (Protocol Number: 10006)

Parameter
Type
Required
Description
Example

code

Integer

Yes

Request protocol number

10006

trace

String

Yes

Traceable ID (random string)

423afec425004bd8a5e02e1ba5f9b2b0

data

JSON

Yes

Subscription data

arr

Array

Yes

Multiple subscription entities

type

Integer

Yes

The type of candlestick interval. Options: 1 = 1 minute 2 = 5 minutes 3 = 15 minutes 4 = 30 minutes 5 = 1 hour 6 = 2 hours 7 = 4 hours 8 = 1 day 9 = 1 week 10 = 1 month 11 = 1 quarter 12 = 1 year

1

codes

String

Yes

Product symbols (comma-separated for multiple)

BTCUSDT

Response (Protocol Number: 10007)

{
    "code": 10007,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0",
    "msg": "ok"
}
Parameter
Type
Required
Description
Example Value

code

Integer

Yes

Response protocol number

10007

trace

String

Yes

Trace ID (same as in request)

423afec425004bd8a5e02e1ba5f9b2b0

msg

String

Yes

Response message

ok

Push (Protocol Number: 10008)

{
    "code": 10008,
    "data": {
        "c": "103478.27",
        "h": "103478.27",
        "l": "103478.26",
        "o": "103478.26",
        "pca": "0.00",
        "pfr": "0.00%",
        "s": "BTCUSDT",
        "t": 1747550640,
        "ty": 1,
        "v": "0.34716",
        "vw": "35923.5149678"
    }
}
Parameter
Type
Required
Description
Example Value

code

Integer

Yes

Candlestick push protocol number

10008

data

JSON

Yes

Kline push entity

s

String

Yes

Symbol name

BTCUSDT

c

String

Yes

Closing price

103478.27

h

String

Yes

Highest price

103478.27

l

String

Yes

Lowest price

103478.26

o

String

Yes

Opening price

103478.26

pca

String

Yes

Price change amount

0.00

pfr

String

Yes

Price change percentage

0.00%

t

Long

Yes

Kline timestamp (in seconds)

1747550640

ty

Integer

Yes

Kline type (refer to request parameter)

1

v

String

Yes

Trade volume

0.34716

vw

String

Yes

Trade value

35923.5149678

Last updated