fix(trading): remove invalid candles from price change calc (#5983) (#5984)

This commit is contained in:
Matthew Russell 2024-03-13 13:34:22 +00:00 committed by GitHub
parent 424061d64c
commit 0f5b712034
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -18,8 +18,9 @@ export interface PriceChangeCellProps {
export const PriceChangeCell = memo(
forwardRef<HTMLSpanElement, PriceChangeCellProps>(
({ 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 (
<span
ref={ref}

View File

@ -32,7 +32,8 @@ export const Last24hPriceChange = ({
return nonIdeal;
}
const candles = oneDayCandles?.map((c) => c.close) || [];
const candles =
oneDayCandles.map((c) => c.close).filter((c) => c !== '') || [];
const change = priceChange(candles);
const changePercentage = priceChangePercentage(candles);