Pacifica
  • Getting Started
    • Closed Alpha Guide
      • Link To Guide PDF
    • Closed Alpha Trading Competition
  • Trading on Pacifica
    • Overview
    • Contract Specifications
      • Oracle Price & Mark Price
      • Settlement Mechanism
    • Order Types
      • Market Order
      • Limit Order
      • Order Rules & Constraints
    • Margin & Leverage
    • Funding Rates
    • Liquidations
  • API Documentation
    • API
      • REST API
        • Markets
          • Get market info
          • Get prices
          • Get kline (candle) data
          • Get recent trades
        • Account
          • Get account info
          • Get account settings
          • Update leverage
          • Update margin mode
          • Get positions
          • Get trade history
          • Get funding history
          • Get account equity history
          • Create subaccount
          • Request withdrawal
        • Orders
          • Get open orders
          • Get order history
          • Get order history by ID
          • Create order
          • Create stop order
          • Create position TP/SL
          • Cancel order
          • Cancel all orders
          • Cancel stop order
          • Batch orders
      • Websocket
        • Subscriptions
          • Prices
          • Orderbook
          • Trades
          • Candle
          • Order updates
          • Account balance
          • Account margin
          • Account leverage
          • Account positions
          • Account orders
          • Account order updates
          • Account trades
        • Trading operations
          • Create order
          • Cancel order
          • Cancel all orders
      • Signing
      • Rate limits
    • Specification
  • Other
    • Audits
    • Brand Assets
    • Contact Us
    • Glossary of Terms
Powered by GitBook
On this page
  • Params
  • Stream
  1. API Documentation
  2. API
  3. Websocket
  4. Subscriptions

Orderbook

Streams book data for given symbol at a set aggregation level as they update

PreviousPricesNextTrades

Last updated 5 hours ago

Refer to for establishing the websocket connection.

Params

{
    "method": "subscribe",
    "params": {
        "source": "book",
        "symbol": "SOL",
        "agg_level": 1  // Aggregation level
    }
}

where agg_levelcan be one of 1, 2, 5, 10, 100, 1000.

Stream

{
  "channel": "book",
  "data": {
    "l": [
      [
        {
          "a": "37.86",
          "n": 4,
          "p": "157.47"
        },
        // ... other aggegated bid levels
      ],
      [
        {
          "a": "12.7",
          "n": 2,
          "p": "157.49"
        },
        {
          "a": "44.45",
          "n": 3,
          "p": "157.5"
        },
        // ... other aggregated ask levels
      ]
    ],
    "s": "SOL",
    "t": 1749051881187
  }
}
Field
Type
Description

'l'

array

[Bids, Asks]

'a'

decimal string

Total amount in aggregation level.

'n'

integer

Number of orders in aggregation level.

'p'

decimal string

  • In bids array, this is highest price in aggregation level.

  • In asks array, this is lowest price is aggregation level

's'

string

Symbol

't'

number

Timestamp in milliseconds

Websocket