Order Book
This component is responsible for displaying the order book for a given symbol.
Features
The OrderBook component is commonly used in conjuction with the useOrderBookStream
hook and offers the following features:
- Display of asks/bids/middlePrice/lastPrice data.
- Support for depth merging.
- Automatic adaptation to changes in height.
Usage
APIs
level
- Type:
number
- Required: false
Specifies the number of levels of data to be displayed.
cellHeight
- Type:
number
- Required: false
The height of each row, used to calculate the displayed number of rows.
base
- Type:
API.SymbolExt
- Required: true
Base symbol information, can be obtained through the useSymbolsInfo
hook.
quote
- Type:
API.SymbolExt
- Required: true
Quote symbol information, can be obtained through the useSymbolsInfo
hook.
onItemClick
- Type:
(item: OrderBookItem) => void
- Required: false
Triggered when a user clicks on a row, returning the data of the clicked row. Through this method, you can implement the functionality to populate the order entry form with the data from the clicked row.
The following parameters/functions are recommended to be obtained through the
useOrderEntry
hook.
asks
- Type:
OrderBookItem[]
- Required: true
bids
- Type:
OrderBookItem[]
- Required: true
markPrice
- Type:
number
- Required: true
lastPrice
- Type:
number
- Required: true
depth
- Type:
number
- Required: true
The current depth supported by the trading pair
activeDepth
- Type:
number
- Required: true
The current depth selected by the user
isLoading
- Type:
boolean
- Required: true
Indicates whether data is currently being loaded
onDepthChange
- Type:
(depth: number) => void
- Required: false
Triggered when a user selects an item in the depth list, the parameter is the depth selected by the user.