Skip to content
Alchemy Logo

l4BookUpdates stream

This API is in private preview. Target September 2026; timing is subject to change.

l4BookUpdates delivers every individual order placed, resized, or removed, including its position in the price-level queue. This is ideal for market making, queue-position analysis, liquidity attribution, and reconstructing an order-level book.

For the corresponding gRPC update stream, see StreamL4BookUpdates.

{
  "method": "subscribe",
  "subscription": { "type": "l4BookUpdates", "coins": ["BTC", "ETH"] }
}

Use marketTypes instead of coins to subscribe to all markets of selected types:

{
  "method": "subscribe",
  "subscription": { "type": "l4BookUpdates", "marketTypes": ["spot"] }
}

ParameterTypeRequiredSourceDescription
coinsstring[]NoAlchemy extensionMarkets to subscribe to. Omit to subscribe to every market of the types in marketTypes, which defaults to perpetuals. The native API takes a single coin per subscription; the plural array is an Alchemy extension.
marketTypesstring[]NoAlchemy extensionRestricts delivery by market type. Accepted values: perp, spot, outcome, or *. Defaults to ["perp"]. Rejected if combined with coins.

The default never grows. New market types must be added to marketTypes explicitly, or pass ["*"] to opt in to future types automatically.

{
  "channel": "subscriptionResponse",
  "data": { "subscriptionId": "sub_01", "type": "l4BookUpdates" }
}

{
  "channel": "l4BookUpdates",
  "subscriptionId": "sub_01",
  "blockHeight": 123456,
  "blockTime": 1780000000000,
  "cursor": "<opaque cursor>",
  "data": {
    "height": 123456,
    "timestamp": 1780000000000,
    "isSnapshot": false,
    "diffs": [
      {
        "type": "new",
        "coin": "BTC",
        "oid": 12345,
        "user": "0x1111111111111111111111111111111111111111",
        "side": "B",
        "px": "100000.0",
        "sz": "0.10",
        "insertBefore": 12346
      }
    ]
  }
}

FieldTypeDescription
heightintegerBlock height.
timestampintegerBlock timestamp in milliseconds.
isSnapshotbooleantrue when the message contains a complete replacement snapshot; absent or false for an incremental update.
diffsarrayPer-order changes in this block.
diffs[].typestringnew, update, or remove.
diffs[].coinstringMarket symbol.
diffs[].oidintegerOrder ID, unique and stable for the life of the order.
diffs[].userstringAddress that placed the order.
diffs[].sidestringB for bid, A for ask.
diffs[].pxstringLimit price, as a decimal string.
diffs[].szstringInitial order size. Present on new only.
diffs[].origSzstringOrder size before an update. Present on update only.
diffs[].newSzstringOrder size after an update. Present on update only.
diffs[].insertBeforeintegerOptional, on new only. Queue placement — see below.

insertBefore places this order immediately ahead of the resting order with that ID at the same price level, reflecting HyperCore's priority placement rules. When absent, append the order to the tail of the queue. If the named order is no longer at that level, append to the tail.

  • update means the order's size changed, typically a partial fill; it carries origSz and newSz
  • remove is terminal — the order was filled or cancelled and carries no operation-specific payload
  • Grouping these orders by price produces the corresponding level-aggregated view — sum the sizes and count the orders at each price — so one subscription can serve both order-level and level-aggregated needs. This corresponds to an unaggregated l2Book; it does not reproduce a book requested with nSigFigs or mantissa applied.

The first message after subscribing carries a full order-book snapshot with isSnapshot: true, delivering every resting order as a new diff. Install it as local state, then apply later diffs. A later message with isSnapshot: true uses the same replacement mechanism for recovery.

For a snapshot shared by many consumers, or to let a slow client digest a large book while buffering live updates, use the REST snapshot read instead.

l2Bookl2BookDiffbbol4BookUpdates
DeliversComplete aggregated snapshotChanged aggregated levelsBest bid and ask onlyChanged individual orders
Client stateNone requiredMaintains a local bookNone requiredMaintains a local book
DetailAggregated levelsAggregated levelsTop of bookIndividual orders, with queue position
Use caseDisplays, periodic readsEfficient live bookPrice and spread trackingMarket making, queue analysis

{
  "method": "unsubscribe",
  "subscription": { "type": "l4BookUpdates", "coins": ["BTC", "ETH"] }
}

l4BookUpdates carries no per-market seq or prev_seq; gap detection is server-side, so there is no client sequence bookkeeping. See detecting gaps.

  • Persist cursor after applying a message.
  • On reconnect, supply cursor in the subscription object.
  • A message with isSnapshot: true replaces your local state. Any message without it is a diff that must chain onto your previous state.
  • If continuity is broken, a fresh message with isSnapshot: true is pushed to you. isSnapshot is the only continuity signal you need to handle — receiving it means discard local state and adopt the supplied snapshot.
Was this page helpful?