Skip to content
Calm motion: animations on this site only fade, with no movement

Order book ​

The bids and asks of a market, with depth bars and the spread

Shows the open orders of a market on a trading screen. A bid is an offer to buy, and an ask is an offer to sell. For the history of the price, use the candlestick.

Basic
Ask / BidPriceSizeTotal
Ask1,844.003.318.1
Ask1,843.256.214.8
Ask1,842.001.58.6
Ask1,841.5047.1
Ask1,840.752.23.1
Ask1,840.250.90.9
Spread 0.75 (0.041%)
Bid1,839.501.21.2
Bid1,839.003.44.6
Bid1,838.250.85.4
Bid1,837.505.110.5
Bid1,836.002.613.1
Bid1,835.757.320.4
  • bids and asks are lists of levels. Each level has a price and a size. The order of the lists does not matter.
  • The asks are on top and the bids are below. The best price of each side is next to the spread line in the middle.
  • Each row shows the price, the size, and the running total from the best price. A bar behind the row grows with the total, so the depth of the market shows at a glance.
  • The spread line shows the gap between the best ask and the best bid, and that gap as a percent of the middle price.
  • depth sets the rows on each side (default 8). precision sets the decimals of the price (default 2), and locale sets the format.
  • The book is a table, and the first cell of each row says "Ask" or "Bid". The color only repeats the side. Change the words with labels or a label pack: title, price, size, total, ask, bid, and spread (a function).

The bookSides function sorts and totals the levels. It is exported for your own views.

Usage ​

ts
import { BlessOrderBook } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
bids*BlessBookLevel[]—
asks*BlessBookLevel[]—
depthnumber8rows on each side
precisionnumber2decimals of the price
localestring"en"
labelsPartial<{ title: string; price: string; size: string; total: string; ask: string; bid: string; spread: (value: string, percent: string) => string; }>—

Released under the MIT License. Character names and artwork belong to their owners.