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
string
required
The trading pair symbol to subscribe to (e.g.,
BTC/USD, ETH/EUR).number
default:"1_000"
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.number
default:"100"
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.number
The minimum price increment allowed for the asset pair. This value is used to generate the valid groupingOptions.
number
default:"0"
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
number
Restricts the frequency of updates. If set, the orderbook will only emit the
DataUpdate event once every throttleMs milliseconds, discarding intermediate updates.number
Delays the update emission until the orderbook has been stable (received no new messages) for
debounceMs milliseconds.boolean
default:"false"
Enables verbose logging to the console. Useful for diagnosing connection issues or pipeline behavior.
History Management
boolean
default:"false"
When enabled, the orderbook maintains a ring buffer of previous snapshots.
number
The maximum number of historical snapshots to retain in memory. Oldest snapshots are discarded when the limit is reached.
Connection & Reconnection
object
Configuration for the automatic reconnection strategy.

