import { useMemo } from 'react'; import { computeDepthBandsFromDlobL2, type ComputedDlobDepthBandRow } from './dlobDerivedMetrics'; import { useDlobL2 } from './useDlobL2'; const COMPUTED_DLOB_LEVELS = 512; export type DlobDepthBandRow = ComputedDlobDepthBandRow; export function useDlobDepthBands( marketName: string ): { rows: DlobDepthBandRow[]; connected: boolean; error: string | null } { const { l2, connected, error } = useDlobL2(marketName, { levels: COMPUTED_DLOB_LEVELS, grouping: 'raw', }); const rows = useMemo(() => computeDepthBandsFromDlobL2(l2), [l2]); return { rows, connected, error }; }