Candle

🚧

This feature is currently available as a beta version.


🚧

Candles are only created when a trade occurs during the time frame.

  • For example, the first candle with candle_date_time of 2024-08-31T22:25:00 consists of trades between 2024-08-31T22:25:00 (inclusive) and 2024-08-31T22:25:01 (exclusive).
  • If there are no trades during the time frame, the 2024-08-31T22:25:00 candle is not created, and no data is sent to the websocket.

Request

Requests are JSON objects, and responses are also JSON objects. Requests are divided into ticket fields, type fields, and format fields. Multiple type fields can be specified in one request. Please refer to the Request method and format for the ticket and format fields.

📘

Request format

[{Ticket Field},{Type Field},....,{Type Field},{Format Field}][{Ticket Field},{Type Field},....,{Type Field},{Format Field}]

Type Field

In this field, you list the market data you want to receive.

The is_only_snapshot and is_only_realtime fields are optional. If omitted, both snapshot and real-time data will be received.

Field Name

Type

Description

Required

Default

type

String

Data type

- candle.1s: 1s candle

  • candle.1m: 1m candle
  • candle.3m: 3m candle
  • candle.5m: 5m candle
  • candle.10m: 10m candle
  • candle.15m: 15m candle
  • candle.30m: 30m candle
  • candle.60m: 60m candle
  • candle.240m: 240m candle

O

codes

List

Market code list
*Must be requested in capital letters.

O

is_only_snapshot

Boolean

Only provides snapshot data

X

false

is_only_realtime

Boolean

Only provides real-time data

X

false

Response

  • Data transmission interval: 1 second.
    • It will only be transmitted when the value changes compared to the previous candle due to trade execution.
    • 3-minute candle example) Assume the 12:00:00 3-minute candle already exists, and no trades have occurred between 12:03:00 and 12:04:00. If you send a candle.3m request at 12:04:00, the server returns the 12:00:00 3-minute candle as snapshot data. When the first trade happens at 12:04:05, the server immediately generates the 12:03:00 3-minute candle and sends that 12:03:00 3-minute candle data at 12:04:06 (the next 1 second interval)

🚧

The same candle_date_time data may be sent multiple times.

  • The data transmission interval is not perfectly guaranteed, and candle data for the same period may be sent multiple times.
  • The most recent data is always the latest update.

Field Name

Simplified Format (format: SIMPLE)

Description

Type

Value

type

ty

Type

String

- candle.1s: 1s candle

  • candle.1m: 1m candle
  • candle.3m: 3m candle
  • candle.5m: 5m candle
  • candle.10m: 10m candle
  • candle.15m: 15m candle
  • candle.30m: 30m candle
  • candle.60m: 60m candle
  • candle.240m: 240m candle

code

cd

Market code (ex. SDG-BTC)

String

candle_date_time_utc

cdttmu

Candle time (UTC)
format: yyyy-MM-dd'T'HH:mm:ss

String

opening_price

op

Open price

Double

high_price

hp

High price

Double

low_price

lp

Low price

Double

trade_price

tp

Close price

Double

candle_acc_trade_volume

catv

Accumulated trade price for the candle

Double

candle_acc_trade_price

catp

Accumulated trade quantity for the candle

Double

timestamp

tms

Timestamp (millisecond)

Long

stream_type

st

Stream Type

String

SNAPSHOT
REALTIME

Example

Request

[
  {
    "ticket": "test example"
  },
  {
    "type": "candle.1s",
    "codes": [
      "SGD-BTC",
      "SGD-ETH"
    ]
  },
  {
    "format": "DEFAULT"
  }
]

Response

{
  "type": "candle.1s",
  "code": "SGD-BTC",
  "candle_date_time_utc": "2025-01-02T04:41:51",
  "opening_price": 130155.0000000,
  "high_price": 130155.0000000,
  "low_price": 130155.0000000,
  "trade_price": 130155.0000000,
  "candle_acc_trade_volume": 0.00003473,
  "candle_acc_trade_price": 4.520283150000000,
  "timestamp": 1735792911165,
  "stream_type": "REALTIME"
}
{
  "type": "candle.1s",
  "code": "SGD-ETH",
  "candle_date_time_utc": "2025-01-02T04:42:59",
  "opening_price": 4654.0000000,
  "high_price": 4654.0000000,
  "low_price": 4654.0000000,
  "trade_price": 4654.0000000,
  "candle_acc_trade_volume": 0.00086015,
  "candle_acc_trade_price": 4.003138100000000,
  "timestamp": 1735792979607,
  "stream_type": "REALTIME"
}