Skip to main content
This topic will notify whenever an order is opened, canceled or a trade happens for the given pair (BASE_QUOTE). Since it is a level 2 orderbook, the orders are going to be grouped by price. By default, the system notifies the topic every 30 seconds, even if a transaction has not taken place. Each side will contain up to 100 price levels.

Subscription Request

method
string
required
Subscribe method. Must be subscribe
topics
array
required
Array of topics to subscribe to. Format: orderbook/level_2@BASE_QUOTEExample: ["orderbook/level_2@ETH_BRL"]

Stream Response

id
integer
Each WebSocket message includes a sequential numeric id. Each topic has its own unique sequence, and for private topics, the sequence is unique to each topic and user. It’s important to note that some topics will send a “welcome message”, which will have an id value of -1. Additionally, this sequence may be reset between connections, so be sure to update this value locally whenever you reconnect.
topic
string
Topic name (format: orderbook/level_2@BASE_QUOTE)
timestamp
integer
Timestamp in milliseconds
body
object
Order book details object

Subscription Example

{
  "method": "subscribe",
  "topics": [
    "orderbook/level_2@ETH_BRL"
  ]
}

Stream Response Example

{
  "id": 3,
  "topic": "orderbook/level_2@ETH_BRL",
  "timestamp": 1672856653428,
  "body": {
    "pair": "ETH_BRL",
    "hash": "2254383345",
    "asks": [
      {
        "price": 20,
        "amount": 184.9
      },
      {
        "price": 25,
        "amount": 10
      }
    ],
    "bids": [
      {
        "price": 5,
        "amount": 400
      },
      {
        "price": 4,
        "amount": 20
      }
    ]
  }
}

Multiple Pairs Example

{
  "method": "subscribe",
  "topics": [
    "orderbook/level_2@ETH_BRL",
    "orderbook/level_2@BTC_BRL"
  ]
}

Update Frequency

  • Default: Every 30 seconds
  • On Change: Immediately when an order is opened, canceled, or a trade happens
  • Updates Include: Both sides of the order book (asks and bids)

Key Characteristics

  • Level 2: Orders aggregated by price level
  • Up to 100 Levels: Each side contains maximum 100 price levels
  • Hash Value: Used to verify order book integrity
  • Aggregated Volume: Total volume at each price level
  • Simplified View: Easier to work with than Level 3

Differences from Level 3

AspectLevel 2Level 3
GranularityAggregated by priceIndividual orders
Data SizeSmallerLarger
Price LevelsUp to 100Up to 100 orders
Use CaseCharts, general analysisDetailed analysis
PerformanceBetterMore detailed

Usage Notes

  • Price Levels: Orders at the same price are aggregated
  • Total Volume: The amount represents the total volume at that price level
  • Spread: The difference between lowest ask and highest bid is the bid-ask spread
  • Hash Verification: Use the hash to verify the order book hasn’t been corrupted
  • Real-time Updates: Receive immediate updates when orders change

Use Cases

  • Price Charts: Display real-time candlestick or depth charts
  • Spread Analysis: Monitor bid-ask spread for trading decisions
  • Market Overview: Get a clear view of market depth and liquidity
  • Trading Alerts: Set alerts based on price level volumes
  • Market Snapshots: Take periodic snapshots for analysis