From 0f5b7120349836cce6d6ff11f21d2c173126a7e9 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Wed, 13 Mar 2024 13:34:22 +0000 Subject: [PATCH] fix(trading): remove invalid candles from price change calc (#5983) (#5984) --- libs/datagrid/src/lib/cells/price-change-cell.tsx | 5 +++-- .../last-24h-price-change/last-24h-price-change.tsx | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/datagrid/src/lib/cells/price-change-cell.tsx b/libs/datagrid/src/lib/cells/price-change-cell.tsx index 592f452dd..d0a07e3ff 100644 --- a/libs/datagrid/src/lib/cells/price-change-cell.tsx +++ b/libs/datagrid/src/lib/cells/price-change-cell.tsx @@ -18,8 +18,9 @@ export interface PriceChangeCellProps { export const PriceChangeCell = memo( forwardRef( ({ candles, decimalPlaces }: PriceChangeCellProps, ref) => { - const change = priceChange(candles); - const changePercentage = priceChangePercentage(candles); + const validCandles = candles.filter((c) => c !== ''); + const change = priceChange(validCandles); + const changePercentage = priceChangePercentage(validCandles); return ( c.close) || []; + const candles = + oneDayCandles.map((c) => c.close).filter((c) => c !== '') || []; const change = priceChange(candles); const changePercentage = priceChangePercentage(candles);