Orderbook Channels

Orderbook Diff

Topics: diff.XXX_YYY

Diff Fields

  • Type: The type of the message is set to "d," indicating that it's a market depth difference event.
  • Timestamp: The Unix timestamp of the market depth difference data.
  • Payload: The payload is an array containing market depth difference information.

Payload includes the following fields:

  • Symbol: The trading symbol associated with the market depth.
  • Asks: A two-dimensional array representing the updated ask side of the market depth. Each ask is an array with the price and quantity difference.
  • Bids: A two-dimensional array representing the updated bid side of the market depth. Each bid is an array with the price and quantity difference.

Diff Example

[
  "d",
  1694004500,
  "BTC_USDT",
  [
    [["101.00", "5.0"], ["102.00", "3.0"]],
    [["99.00", "2.0"], ["98.50", "1.0"]]
  ]
]
from alpcom_api import ws
await client.subscribe(ws.tps.diff_of('BTC_USDT'))

Market Depth

Topics: market_depth.XXX_YYY

Depth Fields

  • Type: The type of the message is set to "p," indicating that it's a market depth event.
  • Timestamp: The Unix timestamp of the market depth data.
  • Payload: Market depth object.

Market depth object includes the following fields:

  • Asks: A two-dimensional array representing the ask side of the market depth. Each ask is an array with the price and quantity.
  • Bids: A two-dimensional array representing the bid side of the market depth. Each bid is an array with the price and quantity.
  • Symbol: The trading symbol associated with the market depth.
  • TotalAsks: The total quantity of asks.
  • TotalBids: The total quantity of bids.

Depth Example

[
  "p",
  1694178331,
  {
    "Asks": [
      [
        "26100.11000000",
        "0.30200000"
      ],
      [
        "26149.68000000",
        "0.51800000"
      ]
    ],
    "Bids": [
      [
        "25768.09000000",
        "0.05900000"
      ],
      [
        "25748.38000000",
        "0.46300000"
      ]
    ],
    "Symbol": "BTC_USDT",
    "TotalAsks": "148953.50292677",
    "TotalBids": "148953.97125366"
  }
]
from alpcom_api import ws
await client.subscribe(ws.tps.depth_of('BTC_USDT'))