This document provides example request and subscription payloads for receiving order book 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
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 |
---|---|---|---|---|
type | ty | Data Types | String | trade |
code | cd | Trading pair code | String | SGD-BTC |
opening_price | op | Opening price | Double | |
high_price | hp | High price | Double | |
low_price | lp | Low price | Double | |
trade_price | tp | Current trade price | Double | |
prev_closing_price | pcp | Previous day closing price | Double | |
change | c | Direction of price change compared to previous day closing price | String | RISE : UpEVEN : UnchangedFALL : Down |
change_price | cp | Absolute value of price change compared to previous day | Double | |
signed_change_price | scp | Signed value of price change compared to previous day | Double | |
change_rate | cr | Absolute rate of change compared to previous day | Double | |
signed_change_rate | scr | Signed rate of change compared to previous day | Double | |
trade_volume | tv | Most recent trade volume | Double | |
acc_trade_volume | atv | Accumulated trade volume (UTC 0 기준) | Double | |
acc_trade_volume_24h | atv24h | 24-hour accumulated trade volume | Double | |
acc_trade_price | atp | Accumulated trade amount (UTC 0 기준) | Double | |
acc_trade_price_24h | atp24h | 24-hour accumulated trade amount | Double | |
trade_date | tdt | Most recent trade date (UTC) | String | yyyyMMdd |
trade_time | ttm | Most recent trade time (UTC) | String | HHmmss |
trade_timestamp | ttms | Trade timestamp (milliseconds) | Long | |
ask_bid | ab | Buy/Sell distinction | String | ASK : SellBID : Buy |
acc_ask_volume | aav | Accumulated sell volume | Double | |
acc_bid_volume | abv | Accumulated buy volume | Double | |
highest_52_week_price | h52wp | 52-week highest price | Double | |
highest_52_week_date | h52wdt | 52-week highest price date | String | yyyy-MM-dd |
lowest_52_week_price | l52wp | 52-week lowest price | Double | |
lowest_52_week_date | l52wdt | 52-week lowest price date | String | yyyy-MM-dd |
trade_status | ts | Trading status. Deprecated; recommended to ignore. | String | |
market_state | ms | Market trading status | String | PREVIEW : Deposit supportedACTIVE : Trading availableDELISTED : Trading ended |
market_state_for_ios | msfi | Market trading status. Deprecated; recommended to ignore. | String | |
is_trading_suspended | its | Trading suspension status. Deprecated; recommended to ignore. | Boolean | |
delisting_date | dd | Market delisting date | Date | |
market_warning | mw | Market warning status | String | NONE : NoneCAUTION : Investment caution |
timestamp | tms | Timestamp (milliseconds) | Long | |
stream_type | st | Stream type | String | SNAPSHOT : SnapshotREALTIME : Real-time |
stream_type | st | Stream type | String | SNAPSHOT : SnapshotREALTIME : 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"
}
]