Orderbook class accepts a configuration object during instantiation. While symbol is the only required parameter, you can fine-tune the pipeline, history, and connection settings to match your specific requirements.
Usage
Core Settings
The trading pair symbol to subscribe to (e.g.,
BTC/USD, ETH/EUR).The subscription depth requested from the Kraken WebSocket.Allowed values:
10, 25, 100, 500, 1000.A higher depth increases network traffic. Choose the lowest value that satisfies your
limit requirement.The maximum number of price levels (asks/bids) kept in the local memory and exposed in snapshots.If
limit is lower than depth, the orderbook will crop the data client-side.The minimum price increment allowed for the asset pair. This value is used to generate the valid groupingOptions.
Combines price levels into groups of this size. Useful for visualizing the book or reducing noise.
When the
tickSize or symbol changes, the orderbook automatically resets spreadGrouping to match the tickSize to ensure the most granular view by default.Pipeline & Performance
Restricts the frequency of updates. If set, the orderbook will only emit the
DataUpdate event once every throttleMs milliseconds, discarding intermediate updates.Delays the update emission until the orderbook has been stable (received no new messages) for
debounceMs milliseconds.Enables verbose logging to the console. Useful for diagnosing connection issues or pipeline behavior.
History Management
When enabled, the orderbook maintains a ring buffer of previous snapshots.
The maximum number of historical snapshots to retain in memory. Oldest snapshots are discarded when the limit is reached.
Connection & Reconnection
Configuration for the automatic reconnection strategy.

