> 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 5

GET /ws/v5/public

Reference: https://okx-demo.ferndocs.com/ws/web-socket-api/books-5/books-5

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: Books 5
  version: subpackage_books5.books5
channels:
  /ws/v5/public:
    publish:
      operationId: subpackage_books5.books5-publish
      summary: Server message
      message:
        name: subscribe
        payload:
          $ref: '#/components/schemas/books5_Books5Push'
    subscribe:
      operationId: subpackage_books5.books5-subscribe
      summary: Client message
      message:
        name: publish
        payload:
          $ref: '#/components/schemas/books5_Books5Request'
servers:
  Production:
    url: wss://ws.okx.com:8443/
    protocol: wss
    x-default: true
components:
  schemas:
    books5_Books5Arg:
      type: object
      properties:
        channel:
          type: string
          description: Channel name.
        instId:
          type: string
          description: Subscription filter, echoed back.
      required:
        - channel
      title: Books5Arg
    books5_Books5Data:
      type: object
      properties:
        asks:
          type: array
          items:
            description: Any type
          description: >-
            Top 5 ask levels, sorted by price ascending. Each level is a string
            array [price, size, liquidatedOrders, orderCount].
        bids:
          type: array
          items:
            description: Any type
          description: >-
            Top 5 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 pushed snapshot.
      description: One books5 data element.
      title: Books5Data
    books5_Books5Push:
      type: object
      properties:
        arg:
          $ref: '#/components/schemas/books5_Books5Arg'
          description: Subscribed channel, echoed back.
        data:
          type: array
          items:
            $ref: '#/components/schemas/books5_Books5Data'
          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: >-
        Top 5 depth levels of an instrument's order book. Pushes a full snapshot
        every 100 ms whenever the top 5 levels change; no incremental updates or
        checksum reconciliation are required.
      title: Books5Push
    books5_Books5SubArg:
      type: object
      properties:
        channel:
          type: string
          description: Channel name.
        instId:
          type: string
          description: Instrument ID, e.g. BTC-USDT.
      required:
        - channel
      title: Books5SubArg
    books5_Books5Request:
      type: object
      properties:
        op:
          type: string
          description: Operation. `subscribe` or `unsubscribe`.
        args:
          type: array
          items:
            $ref: '#/components/schemas/books5_Books5SubArg'
          description: Channels to subscribe to.
      required:
        - op
        - args
      description: Subscribe to the books5 channel.
      title: Books5Request

```