Order book chart
The Pro order book chart - ten canvas variants of a live two-sided book with gradients, themes and the look pack.
This page covers the Pro order book chart: ten canvas variants, the component surface, the look pack and the core painter behind them.
It is part of the Pro edition: the engine is the same as in Standard, the widget is not.
The order book chart turns a two-sided book into one of ten canvas views. It is a Pro feature:
the painter lives in the core, the OrderbookChart component ships in @unifin/chart-react/pro, and
the whole surface is presentation only - the data comes from OrderbookModel, so the same widget
serves a live feed, a replay or a recorded session.
Try it live
- Best bid
- 12949.50
- Best ask
- 12950.50
- Spread
- 1.00
- Mid
- 12950.00
- Imbalance
- 0.05
- Bid / ask
- 20.2K / 18.1K
Rendered by `OrderbookChart` from `@unifin/chart-react/pro` - a Pro component over the public `paintOrderbookChart` of the core. The book is synthetic; every control drives the real props (variant, theme, look pack, aggregation step, book depth).
Every control drives the real props: the variant chips switch the painter, the palette and font feed the look pack, the aggregation step buckets the prices, the book depth caps the rows, and the theme button repaints through the shell tokens.
Ten variants
The ten variants share one normalised view (buildOrderbookView) and one price scale; only the body
of the picture changes. The first three match the familiar terminal readings, the next two are
liquidity-first views, and the S96 desk wave adds five more readings - the mirror ladder, the depth
bubbles, the ridgeline, the radial sonar and the walls.
| Variant | What it draws | Best for |
|---|---|---|
depth | Cumulative depth curves of both sides around the mid price, filled with a vertical gradient | Reading where the book walls are |
depthHistogram | Per-level columns diverging from the mid rule | Comparing one level against its neighbours |
ladder | The classic price ladder with depth shading, a spread band, side totals and a mini depth strip | Placing an order at a price |
heatmap | A price x time liquidity landscape with an intensity heat scale | Watching liquidity build and pull over time |
imbalance | A pressure board - a bid/ask share gauge over diverging price rows | Reading who owns the book |
mirror | The mirror ladder: cumulative staircase bars left of the bids and right of the asks around a central price column, with the spread band between the sides | Two-sided weight at a glance, mid anchored |
bubbles | Depth bubbles over a faint cumulative skirt; the radius follows the level size and the three heaviest levels carry their size | Spotting single heavy levels in a sparse book |
ridges | A liquidity ridgeline: one soft ridge per level, lower rows first, the heaviest level labelled | The shape of the whole ladder as a skyline |
radial | A radial depth sonar: two filled lobes sweeping a half-circle per side over guide rings, with the mid and the spread at the centre | A showcase reading of the two-sided weight |
walls | Glowing liquidity walls: one pillar per level standing on the base line, the three heaviest labelled with their size | Where the walls really are |
Gradient bodies degrade gracefully: a canvas without createLinearGradient keeps flat withAlpha
fills, the bubbles fall back to soft squares without arc, the radial lobes to flat fills without
createRadialGradient, so the widget stays legible on every backend.
Look pack and themes
The chart reads the same look pack as the price chart: the bar palette resolves bids and asks
(classic, neon, sunset, ice, mono), the reading font comes from the four-font set, and every
colour is derived from the active theme - no literal ever enters the painter, so a white-label shell
repaints through its --ud-* tokens.
Component
import { OrderbookChart } from '@unifin/chart-react/pro';
import { OrderbookModel } from '@unifin/chart-core';
const book = new OrderbookModel();
export function Book({ snapshot, look }) {
book.apply(snapshot);
return (
<OrderbookChart
depth={book.depth(12)}
variant="depth"
look={look}
step={0.5}
levels={12}
title="AAPL - NASDAQ"
locale="en"
height={360}
/>
);
}| Prop | Meaning |
|---|---|
depth | Two-sided depth, best first (OrderbookModel.depth(levels)); the only required prop |
variant | depth (default), depthHistogram, ladder, heatmap, imbalance, mirror, bubbles, ridges, radial, walls |
theme | A ChartTheme; defaults to the dark palette |
look | The look pack - bar palette, gradient bodies and the reading font |
levels | Rows kept per side (book depth), default 12 |
step | Price aggregation step; derived from the level gaps when omitted |
heatmap | A HeatmapGrid for the heatmap variant (from BookHeatmap.grid()) |
title | Instrument stamp of the header |
locale | Header and axis language |
height | Fixed pixel height of the canvas host |
The component exposes the book to assistive technology as a single role="img" with a label carrying
the variant, spread and imbalance. It is a pure presentation surface: it never mutates the model and
never places orders - use OrderbookLadder for clickable levels and order intents.
Core painter
paintOrderbookChart(ctx, input) and buildOrderbookView(input) are public in @unifin/chart-core
(also on the @unifin/chart-core/render subpath), so a host that draws its own canvas can reuse the
exact same geometry and palette:
import { buildOrderbookView, paintOrderbookChart, DARK_THEME } from '@unifin/chart-core';
const view = buildOrderbookView({ depth: book.depth(20), step: 0.5, levels: 20 });
paintOrderbookChart(ctx, { variant: 'imbalance', view, theme: DARK_THEME, width, height, locale: 'en' });The book cube in 3D
The depth history behind the heatmap also reads as a cube: every snapshot becomes a column, the price axis spans the levels and the level size sets the bar height, with the active snapshot in the accent tone. Drag, the wheel and the arrow keys steer the camera; the reset button and the two angle presets restore the canonical views, and the scene pauses while the section is out of view or the tab is hidden.

import { bookCubeFromHistory, paintBookCube, scene3dCamera } from '@unifin/chart-core/scene3d';
const cube = bookCubeFromHistory(history); // [{ time, levels: [{ price, bid, ask }] }]
paintBookCube(ctx, cube, { width, height, theme, camera: scene3dCamera() });Both are public entries of @unifin/chart-core; see the core API.
See also
- Pro edition - the entry point, the budgets and the other Pro surfaces.
- Terminal panels - the five panel bindings of the same wave.
- Features - the order flow area in the capability map.
- Analytic figures - the heatmap painter the depth landscape reuses.
- API overview - component props and core painter signatures.
Options desk
The full option chain as a formatted table and the gallery of every option strategy - payoff charts with gradient zones, risk summaries and the legs behind each combination.
Pro effects
What the Pro edition adds on screen - the order book, the terminal panels, the risk figures, the desk surfaces - and the look engine driven at desk strength with the volume effects, the gradients, the presets and the replay.
