This hook relies on
useOrderbookHistory. Ensure that historyEnabled is set to true in your orderbook configuration, otherwise there will be no frames to play back.Import
Usage
Parameters
This hook does not accept any parameters. It automatically consumes orderbook history data.Return Type
State
The orderbook snapshot at the current playback position. Use this to drive your UI instead of
useOrderbookData when in replay mode.Returns
true if the playback is currently tracking the latest incoming snapshots from the live stream.Indicates if the automatic playback progression is currently halted.
The current frame index in the history buffer.
The total number of snapshots available for playback.
The difference in milliseconds between the current playback frame and the actual current time.
Metadata about the upcoming transition, including
duration between frames, progress (0 to 1), and remaining time.Actions
Toggles between play and pause. Pausing automatically disables live tracking.
Seeks to a specific frame in the history buffer.
Steps one frame backward in time.
Steps one frame forward in time.
Resume live tracking, jump to the most recent snapshot, and set
isPaused to false.Key Concepts
Virtual Time & Interpolation
Unlike a simple loop,useOrderbookPlayback uses requestAnimationFrame and a internal virtualTime state. It calculates the actual time difference between recorded snapshots to ensure that the playback speed matches the real-world frequency of the market updates.

