Skip to main content
This hook requires the OrderbookProvider or AssetPairsProvider to be present in your component tree to provide the underlying AssetPairs instance.

Import

Usage


Parameters

AssetPairsData
Initial data to hydrate the state immediately. Useful for SSR or restoring data from a persistent cache.

Return Type

State

SymbolOption[]
The list of available trading pairs, filtered by topN (liquidity) and sorted alphabetically by label.
Map<string, SymbolOption>
A lookup map for O(1) access to symbol data.
boolean
true whenever a fetch request is in flight.
boolean
true once the first successful fetch has completed.
Error | null
Contains the error object if the last fetch attempt failed.
number
default:100
The current number of high-liquidity pairs being tracked.

Actions

() => Promise<AssetPairsData>
Manually triggers a new fetch request from the Kraken API.
(search: string) => SymbolOption | undefined
Case-insensitive search. Matches against wsname (BTC/USD), altname (XBTUSD), displayLabel, and internal Kraken keys.
(n: number) => void
Updates the liquidity filter. Note: If the state is already loaded, changing this value triggers an automatic re-fetch.
() => void
Wipes the current local state and resets status to idle.

Examples

Use findSymbol for efficient lookups across multiple identifier types.

Dynamic Liquidity Filtering

Change the number of tracked pairs on the fly using the setTopN action.

SSR Hydration

If you are using Next.js or another SSR framework, you can pass data from the server to prevent layout shifts.

AssetPairs Core

Explore the underlying class logic and event emitters.

useOrderbookConfig

Use symbols from this hook to open a WebSocket orderbook feed.

useOrderbookPlayback

Use historical orderbook data to travel in time.

Kraken API

Explore the GetAssetInfo endpoint in the Kraken API docs.