Subscriptions

Snapshots and subscriptions to access data

Data that frequently changes, such as instruments in a market, the orderbook, ticker price feeds, and others are served as GraphQL Subscriptions (e.g. over WebSockets) instead of as Queries.

The best way to query this data is to subscribe to the subscription and update your client view of the data as it comes.

Two primary types of messages are sent over subscriptions: SNAPSHOTS and UPDATES. The latest snapshot should always be sent immediately when a subscription is established, and then periodically every 10 seconds to 10 minutes, depending on the subscription. UPDATES contain only a subset of data within the subscription. For subscriptions that serve arrays, UPDATES always pass array items that should replace items with corresponding IDs in the array.

Hook makes a best effort to order subscriptions and updates sequentially; however, there are edge cases with the transport in which messages may arrive out of order. The periodic snapshots solve this.

Because most data are served over subscriptions, they do not consume most rate limits. Rate limits are assessed on connections. The exception is that only two orderbooks may simultaneously be watched via a single API key.

Last updated