Skip to main content

Spot WebSocket API

Connection Details

  • Endpoint: wss://api.big.one/ws/v2
  • Protocols: json (default) or proto (Google Protocol Buffers).

Protocol Selection

We support two protocols for data transmission:

  1. JSON: Human-readable, easy to debug. Default behavior.
  2. Proto (Protobuf): Binary format, smaller payload, lower latency. Recommended for high-frequency trading.
    • To use Proto, set the HTTP Header Sec-WebSocket-Protocol: proto during the handshake.
    • View Proto Definitions

KeepAlive (Heartbeat)

To prevent the connection from being closed by intermediate network nodes (like load balancers), clients should send a Ping frame or a custom Heartbeat message regularly.

Authentication

Authentication is required for Private Channels (e.g., User Orders, User Accounts).

How to Authenticate

Send an authenticateCustomerRequest immediately after connecting.

Request

{
"requestId": "1",
"authenticateCustomerRequest": {
"token": "Bearer {YOUR_JWT_TOKEN}"
}
}

You can generate the JWT Token using your API Key and Secret. See Authentication Guide for details.

Parameters

FieldTypeDescriptionRequired
tokenstringBearer {YOUR_JWT_TOKEN}No (if defined in object)

Request & Response Format

All WebSocket messages follow a standard JSON structure (unless using Proto).

Request Structure

Every request must include a requestId to track the response.

{
"requestId": "unique_id_123",
"subscribeRequestName": { ...params }
}

Response Structure

Responses include the requestId from the original request.

Success

Subscribing usually results in an immediate Snapshot followed by Updates.

Error

{
"requestId": "1",
"error": {
"code": 45000,
"message": "Error description"
}
}

Error Codes

CodeTypeDescription
45000System ErrorInternal gRPC or system error.
45001Auth ErrorLogin status invalid or token expired.
OtherGeneralDefault error.

Public Channels

Market Depth (Order Book)

Subscribe to real-time order book changes.

Subscribe

{
"requestId": "1",
"subscribeMarketDepthRequest": {
"market": "BTC-USDT"
}
}

Parameters

FieldTypeDescriptionRequired
marketstringMarket symbol (e.g., BTC-USDT)Yes

Unsubscribe

{
"requestId": "1",
"unsubscribeMarketDepthRequest": {
"market": "BTC-USDT"
}
}

Data Format

  • Snapshot: Full order book (bids and asks).
  • Update: Incremental changes.

Note: changeId and prevId are sequential. changeId of the current message should equal prevId of the next message. Use this to detect missing packets.

Market Depth Models

Depth (Snapshot/Update)

FieldTypeDescription
marketstringMarket symbol (e.g., BTC-USDT)
bids[PriceLevel]List of bid orders (Buy side)
asks[PriceLevel]List of ask orders (Sell side)
changeIdstringSequence ID of this update
prevIdstringSequence ID of the previous update

PriceLevel

FieldTypeDescription
pricestringPrice level
amountstringTotal quantity at this price
orderCountintegerNumber of individual orders at this price

Market Candles (K-Line)

Subscribe to OHLCV (Open, High, Low, Close, Volume) data updates.

Subscribe

{
"requestId": "2",
"subscribeMarketCandlesRequest": {
"market": "BTC-USDT",
"period": "MIN5",
"limit": "20"
}
}

Parameters

FieldTypeDescriptionRequired
marketstringMarket symbolYes
periodstringTime period (e.g., MIN5)Yes
limitintegerNumber of candles (default 20)No

Supported Periods: MIN1, MIN5, MIN15, MIN30, HOUR1, HOUR3, HOUR4, HOUR6, HOUR12, DAY1, WEEK1.

Unsubscribe

{
"requestId": "2",
"unsubscribeMarketCandlesRequest": {
"market": "BTC-USDT",
"period": "MIN5"
}
}

Candle Model

FieldTypeDescription
marketstringMarket symbol
timestringCandle open time (UTC ISO8601)
openstringOpening price
highstringHighest price
lowstringLowest price
closestringClosing price
volumestringVolume during this period
periodstringTime period identifier (e.g., MIN5)

Market Ticker

Subscribe to 24-hour rolling ticker data.

Subscribe

{
"requestId": "3",
"subscribeMarketsTickerRequest": {
"markets": ["BTC-USDT", "ETH-USDT"]
}
}

Parameters

FieldTypeDescriptionRequired
marketsarrayList of market symbols (e.g., ["BTC-USDT"])Yes

Unsubscribe

{
"requestId": "3",
"unsubscribeMarketsTickerRequest": {
"markets": ["BTC-USDT", "ETH-USDT"]
}
}

Ticker Model

FieldTypeDescription
marketstringMarket symbol
openstringPrice 24 hours ago
highstringHighest price in last 24h
lowstringLowest price in last 24h
closestringLast traded price
volumestringTrading volume in last 24h
bidPriceLevelBest bid price and quantity
askPriceLevelBest ask price and quantity

Market Trades

Subscribe to real-time trade execution history.

Subscribe

{
"requestId": "4",
"subscribeMarketTradesRequest": {
"market": "BTC-USDT",
"limit": 20
}
}

Parameters

FieldTypeDescriptionRequired
marketstringMarket symbolYes
limitintegerNumber of trades (default 20)No

Unsubscribe

{
"requestId": "4",
"unsubscribeMarketTradesRequest": {
"market": "BTC-USDT"
}
}

Trade Model

FieldTypeDescription
idstringUnique trade ID
marketstringMarket symbol
pricestringExecution price
amountstringExecution amount
takerSidestringSide of the taker (ASK or BID)
createdAtstringExecution time (UTC ISO8601)

Note: In public trade streams, makerOrder and takerOrder fields are always null.

Private Channels (Auth Required)

User Account

Subscribe to balance changes for your account.

Subscribe

{
"requestId": "5",
"subscribeViewerAccountsRequest": {}
}

Unsubscribe

{
"requestId": "5",
"unsubscribeViewerAccountsRequest": {}
}

Account Model

FieldTypeDescription
assetstringAsset symbol (e.g., BTC)
balancestringAvailable balance
lockedBalancestringFrozen/Locked balance (in orders)

User Orders

Subscribe to order status updates (e.g., FILLED, CANCELLED).

Subscribe (Specific Market)

{
"requestId": "6",
"subscribeViewerOrdersRequest": {
"market": "BTC-USDT"
}
}

Parameters

FieldTypeDescriptionRequired
marketstringMarket symbolYes

Unsubscribe

{
"requestId": "6",
"unsubscribeViewerOrdersRequest": {
"market": "BTC-USDT"
}
}

Subscribe (All Markets)

{
"requestId": "7",
"subscribeAllViewerOrdersRequest": {}
}

Note: subscribeAllViewerOrdersRequest only pushes updates (no initial snapshot).

Unsubscribe

{
"requestId": "7",
"unsubscribeAllViewerOrdersRequest": {}
}

Order Model

FieldTypeDescription
idstringUnique order ID
marketstringMarket symbol
pricestringOrder price
amountstringOrder original amount
filledAmountstringAmount filled so far
avgDealPricestringAverage execution price
sidestringASK or BID
statestringPENDING, FILLED, CANCELLED
createdAtstringOrder creation time
updatedAtstringLast update time