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}]

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
typeStringData 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
codesListMarket code list
*Must be requested in capital letters.
O
is_only_snapshotBooleanOnly provides snapshot dataXfalse
is_only_realtimeBooleanOnly provides real-time dataXfalse

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
TypeValue
typetyTypeStringorderbook
codecdMarket code (ex. SDG-BTC)String
candle_date_time_utccdttmuCandle time (UTC)
format: yyyy-MM-dd'T'HH:mm:ss
String
opening_priceopOpen priceDouble
high_pricehpHigh priceDouble
low_pricelpLow priceDouble
trade_pricetpClose priceDouble
candle_acc_trade_volumecatvAccumulated trade price for the candleDouble
candle_acc_trade_pricecatpAccumulated trade quantity for the candleDouble
timestamptmsTimestamp (millisecond)Long
stream_typestStream TypeStringSNAPSHOT
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"
}