@wick/order-book

Order Book

A headless bid/ask ladder with cumulative depth visualization. Feed it a { bids, asks } snapshot and it renders. Style it however you want with CSS parts and custom properties.

Live demo

hover trade → highlight book level

Both components are subscribed to the same synthetic feed. Open the market pulse below and try Flash Crash.

Install

npm install @wick/order-book

Usage

import '@wick/order-book';

const el = document.querySelector('wick-order-book');
el.data = {
  bids: [{ price: 67000, size: 1.2 }, /* ... */],
  asks: [{ price: 67010, size: 0.8 }, /* ... */],
};

// In HTML:
// <wick-order-book depth="15" size="md" show-depth></wick-order-book>

Properties

PropTypeDefaultDescription
dataOrderBookData{ bids: [], asks: [] }Order book snapshot with bid and ask levels.
depthnumber15Maximum number of levels to display per side.
priceFormatPriceFormatOptions{}Price formatting (precision, locale, symbol).
sizePrecisionnumber4Decimal precision for size values.
showTotalbooleanfalseShow cumulative total column.
showDepthbooleanfalseRender cumulative depth bars behind rows.
groupingnumberundefinedGroup levels by price bucket (e.g. 0.5).
size"sm" | "md" | "lg""md"Preset row height and font size.

Events

EventDetailDescription
wick-order-book-level-click{ side, price, size }Fired when the user clicks a bid or ask level row.

CSS parts

PartDescription
containerOuter wrapper element
headerColumn headers row
bidsBid side container
asksAsk side container
rowEach level row (also bid-row / ask-row variants)
pricePrice cell
sizeSize cell
spreadSpread indicator between bids and asks

CSS custom properties

VariableDefaultDescription
--wick-ob-bid-colorinheritColor of bid prices
--wick-ob-ask-colorinheritColor of ask prices
--wick-ob-bid-depth-colorrgba(34,197,94,0.12)Cumulative depth bar color on bids
--wick-ob-ask-depth-colorrgba(239,68,68,0.12)Cumulative depth bar color on asks
--wick-ob-row-hoverrgba(255,255,255,0.04)Row hover background
--wick-ob-font-size13pxFont size for rows
--wick-ob-row-height24pxRow height