Orders History
import { OrdersHistory } from '@hanzo/ui'
Default
Every order status rendered, with the status filter row above the list.
AllOpenFilledCancelledPending
AAPL6/3/2024, 7:22:00 AM
OpenSideBUY
Shares100
Price$175.50
Type:Limit
MSFT6/3/2024, 6:05:00 AM
FilledSideSELL
Shares25
Price$415.20
TSLA6/3/2024, 5:40:00 AM
PendingSideBUY
Shares10
PriceMarket
Type:Market
GOOG6/2/2024, 2:15:00 AM
CancelledSideSELL
Shares5
Price$140.10
export function Default() {return <OrdersHistory orders={orders} />}
Without filters
`showFilters={false}` drops the status filter row, leaving only the list.
AAPL6/3/2024, 7:22:00 AM
OpenSideBUY
Shares100
Price$175.50
Type:Limit
MSFT6/3/2024, 6:05:00 AM
FilledSideSELL
Shares25
Price$415.20
TSLA6/3/2024, 5:40:00 AM
PendingSideBUY
Shares10
PriceMarket
Type:Market
GOOG6/2/2024, 2:15:00 AM
CancelledSideSELL
Shares5
Price$140.10
export function WithoutFilters() {return <OrdersHistory orders={orders} showFilters={false} />}
Cancellable
A handler on an open order shows a Cancel Order button that removes it from the list.
AllOpenFilledCancelledPending
AAPL6/3/2024, 7:22:00 AM
OpenSideBUY
Shares100
Price$175.50
Type:Limit
MSFT6/3/2024, 6:05:00 AM
FilledSideSELL
Shares25
Price$415.20
TSLA6/3/2024, 5:40:00 AM
PendingSideBUY
Shares10
PriceMarket
Type:Market
GOOG6/2/2024, 2:15:00 AM
CancelledSideSELL
Shares5
Price$140.10
export function Cancellable() {return (<OrdersHistory orders={orders} onCancelOrder={(orderId) => console.log("cancel", orderId)} />)}
Empty
No orders yields a centered No orders yet message instead of a blank list.
AllOpenFilledCancelledPending
No orders yet
export function Empty() {return <OrdersHistory orders={[]} />}
Types
export type OrdersHistorySide = 'buy' | 'sell'
export type OrdersHistoryStatus = 'open' | 'filled' | 'cancelled' | 'pending'
export type OrdersHistoryOrderType = 'market' | 'limit'
export interface Order {id: stringsymbol: stringtype: OrdersHistorySideshares: numberprice: numberstatus: OrdersHistoryStatustimestamp: numberorderType?: OrdersHistoryOrderType}
export interface OrdersHistoryProps {orders: Order[]onCancelOrder?: (orderId: string) => voidonOrderClick?: (order: Order) => void/** Shows the status filter row above the list. Defaults to true. */showFilters?: boolean}
Exports
OrdersHistorytype Ordertype OrdersHistoryOrderTypetype OrdersHistoryPropstype OrdersHistorySidetype OrdersHistoryStatus