Trades

This document provides example request and subscription payloads for receiving trade data via WebSocket.

Request Message Format

To request trade data, after establishing the WebSocket connection, you must create a JSON object with the structure below and include it as a Data Type Object in the request message. For the full WebSocket data request message specification including Ticket and Format fields, please refer to the WebSocket Usage Guide document.

Field Name Type Description Required Default Value
type String trade Required
codes List:String List of trading pairs to receive.
Must be requested in uppercase.
Required
is_only_snapshot Boolean Provide snapshot trade data only Optional false
is_only_realtime Boolean Provide real-time trade data only Optional false
Check the proper endpoint based on your region.
The examples in this page is written using Singapore fiat code(SGD). Set the quote currency to match your region. The base_url differs by country/region. Make sure to specify the correct region value for your environment.

Quotation
- Singapore (sg): wss://sg-api.upbit.com/websocket/v1
- Indonesia (id): wss://id-api.upbit.com/websocket/v1
- Thailand (th): wss://th-api.upbit.com/websocket/v1

Exchange
- Singapore (sg): wss://sg-api.upbit.com/websocket/v1/private
- Indonesia (id): wss://id-api.upbit.com/websocket/v1/private
- Thailand (th): wss://th-api.upbit.com/websocket/v1/private

Examples

[
  {
    "ticket": "test"
  },
  {
    "type": "trade",
    "codes": ["SGD-BTC","SGD-ETH"]
  },
  {
    "format": "DEFAULT"
  }
]
[
  {
    "ticket": "test"
  },
  {
    "type": "trade",
    "codes": ["SGD-BTC","SGD-ETH"]
  },
  {
    "format": "SIMPLE_LIST"
  }
]

Subscription Data Specification

The current price snapshot or real-time stream data is returned as follows.

Field Name Abbreviation Description Type Example Value
typetyData TypesStringtrade
codecdTrading pair codeStringSGD-BTC
trade_pricetpCurrent trade priceDouble
trade_volumetvMost recent trade volumeDouble
ask_bid ab Buy/Sell distinction String ASK : Sell
BID : Buy
prev_closing_pricepcpPrevious day closing priceDouble
change c Direction of price change compared to previous day closing price String RISE : Rise
EVEN : Even
FALL : Fall
change_pricecpAbsolute price change compared to previous dayDouble
trade_datetdTrade date (UTC)Stringyyyy-MM-dd
trade_timettmTrade time (UTC)StringHH:mm:ss
trade_timestampttmsTrade timestamp (ms)Long
timestamptmsTimestamp (ms)Long
sequential_idsidTrade number (unique)Long
best_ask_pricebapBest ask priceDouble
best_ask_sizebasBest ask sizeDouble
best_bid_pricebbpBest bid priceDouble
best_bid_sizebbsBest bid sizeDouble
stream_type st Stream type String SNAPSHOT : Snapshot
REALTIME : Real-time

Examples

{
  "type": "trade",
  "code": "SGD-BTC",
  "timestamp": 1696585056910,
  "trade_date": "2023-10-06",
  "trade_time": "09:37:36",
  "trade_timestamp": 1696585056846,
  "trade_price": 37625,
  "trade_volume": 8.428e-05,
  "ask_bid": "ASK",
  "prev_closing_price": 37296,
  "change": "RISE",
  "change_price": 329,
  "sequential_id": 1696585056846000,
  "best_ask_price": 32293000,
  "best_ask_size": 0.04414411,
  "best_bid_price": 32291000,
  "best_bid_size": 0.01202163,
  "stream_type": "SNAPSHOT"
}
...
{
  "type": "trade",
  "code": "SGD-ETH",
  "timestamp": 1696585254027,
  "trade_date": "2023-10-06",
  "trade_time": "09:40:53",
  "trade_timestamp": 1696585253974,
  "trade_price": 2224,
  "trade_volume": 0.00210894,
  "ask_bid": "ASK",
  "prev_closing_price": 2192,
  "change": "RISE",
  "change_price": 32,
  "sequential_id": 1696585253974000,
  "best_ask_price": 32293000,
  "best_ask_size": 0.04414411,
  "best_bid_price": 32291000,
  "best_bid_size": 0.01202163,
  "stream_type": "REALTIME"
}
[
  {
    "ty": "trade",
    "cd": "SGD-BTC",
    "tms": 1749471055123,
    "td": "2025-06-09",
    "ttm": "12:10:55",
    "ttms": 1749471055055,
    "tp": 138423.0,
    "tv": 1.67e-05,
    "ab": "ASK",
    "pcp": 136158.0,
    "c": "RISE",
    "cp": 2265.0,
    "sid": 1749471055055000,
    "bap": 138770,
    "bas": 0.17,
    "bbp": 138423,
    "bbs": 0.1699833,
    "st": "SNAPSHOT"
  },
  {
    "ty": "trade",
    "cd": "SGD-ETH",
    "tms": 1749470929025,
...
    "st": "SNAPSHOT"
  }
]