> This page is for WebSocket.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://okx-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server.

# Books L 2 Tbt

GET /ws/v5/public

Reference: https://okx-demo.ferndocs.com/ws/web-socket-api/books-l-2-tbt/books-l-2-tbt

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: Books L 2 Tbt
  version: subpackage_books-l2-tbt.books-l2-tbt
channels:
  /ws/v5/public:
    publish:
      operationId: subpackage_books-l2-tbt.books-l2-tbt-publish
      summary: Server message
      message:
        name: subscribe
        payload:
          $ref: '#/components/schemas/booksL2Tbt_BooksL2TbtPush'
    subscribe:
      operationId: subpackage_books-l2-tbt.books-l2-tbt-subscribe
      summary: Client message
      message:
        name: publish
        payload:
          $ref: '#/components/schemas/booksL2Tbt_BooksL2TbtRequest'
servers:
  Production:
    url: wss://ws.okx.com:8443/
    protocol: wss
    x-default: true
components:
  schemas:
    booksL2Tbt_BooksL2TbtArg:
      type: object
      properties:
        channel:
          type: string
          description: Channel name.
      required:
        - channel
      title: BooksL2TbtArg
    booksL2Tbt_BooksL2TbtData:
      type: object
      properties:
        asks:
          type: array
          items:
            description: Any type
          description: >-
            Ask levels, sorted by price ascending. Each level is a string array
            [price, size, liquidatedOrders, orderCount].
        bids:
          type: array
          items:
            description: Any type
          description: >-
            Bid levels, sorted by price descending. Each level is a string array
            [price, size, liquidatedOrders, orderCount].
        ts:
          type: string
          description: Timestamp of book generation, Unix milliseconds.
        checksum:
          type: string
          description: >-
            CRC32 checksum of the top 25 levels, used to verify local book
            integrity.
      description: One books-l2-tbt data element.
      title: BooksL2TbtData
    booksL2Tbt_BooksL2TbtPush:
      type: object
      properties:
        arg:
          $ref: '#/components/schemas/booksL2Tbt_BooksL2TbtArg'
          description: Subscribed channel, echoed back.
        data:
          type: array
          items:
            $ref: '#/components/schemas/booksL2Tbt_BooksL2TbtData'
          description: >-
            Subscribed data, pushed on update. For candlesticks each element is
            a string array [ts, o, h, l, c, ...].
        event:
          type: string
          description: >-
            On subscription acknowledgments and errors: `subscribe`,
            `unsubscribe`, or `error`.
        id:
          type: string
          description: Request ID, echoed on acknowledgments and errors.
        code:
          type: string
          description: Error code (error events only).
        msg:
          type: string
          description: Error message (error events only).
        connId:
          type: string
          description: WebSocket connection ID.
      description: >-
        Level-2 tick-by-tick order book with 400 depth levels. Sends a full
        snapshot on first push, then incremental updates every 10 ms on every
        book change. Requires VIP4 (or above) authentication; reconcile using
        the checksum.
      title: BooksL2TbtPush
    booksL2Tbt_BooksL2TbtSubArg:
      type: object
      properties:
        channel:
          type: string
          description: Channel name.
        instId:
          type: string
          description: Instrument ID, e.g. BTC-USDT.
      required:
        - channel
      title: BooksL2TbtSubArg
    booksL2Tbt_BooksL2TbtRequest:
      type: object
      properties:
        op:
          type: string
          description: Operation. `subscribe` or `unsubscribe`.
        args:
          type: array
          items:
            $ref: '#/components/schemas/booksL2Tbt_BooksL2TbtSubArg'
          description: Channels to subscribe to.
      required:
        - op
        - args
      description: Subscribe to the books-l2-tbt channel.
      title: BooksL2TbtRequest

```