Trading
Order Book
Classic bid/ask depth ladder with red/green rows, depth bars, and a spread row. Presentational only — feed itbids and asks arrays.
Preview
PriceAmountTotal
67236.10.33122255.149
67237.40.95063875.530
67239.01.780119685.420
67240.70.42028241.094
67242.33.100208451.130
1.6Spread0.002%
67234.50.45230389.994
67233.01.21081351.930
67231.80.0875849.167
67230.22.500168075.500
67228.90.64043026.496
Source
Copy this file to components/trading/order-book.tsx
tsx
'use client'
import * as React from 'react'
import { cn } from '@/lib/utils'
export interface OrderBookLevel {
price: number
amount: number
total?: number
}
export interface OrderBookProps {
bids: OrderBookLevel[]
asks: OrderBookLevel[]
priceDecimals?: number
amountDecimals?: number
className?: string
}
// Presentational depth view: asks on top, bids on bottom, spread row between.
// Depth bars are scaled to the largest total across both sides.Props
| Prop | Type |
|---|---|
| bids* | OrderBookLevel[] |
| asks* | OrderBookLevel[] |
| priceDecimals | number |
| amountDecimals | number |
| className | string |