From 6ac977d483022de6906e1e916187eb552b037ee4 Mon Sep 17 00:00:00 2001 From: moo-onthelawn <70078372+moo-onthelawn@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:01:38 -0700 Subject: [PATCH] fix(ohlc): update to use orderbook vals if trades <= 10 (#937) --- src/lib/tradingView/utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/tradingView/utils.ts b/src/lib/tradingView/utils.ts index 7ceaf9375..4a06606fc 100644 --- a/src/lib/tradingView/utils.ts +++ b/src/lib/tradingView/utils.ts @@ -8,6 +8,8 @@ import { Themes } from '@/styles/themes'; import { AppTheme, type AppColorMode } from '@/state/configs'; +const MIN_NUM_TRADES_FOR_ORDERBOOK_PRICES = 10; + const getOhlcValues = ({ orderbookCandlesToggleOn, trades, @@ -29,7 +31,7 @@ const getOhlcValues = ({ }) => { const useOrderbookCandles = orderbookCandlesToggleOn && - trades === 0 && + trades <= MIN_NUM_TRADES_FOR_ORDERBOOK_PRICES && orderbookOpen !== undefined && orderbookClose !== undefined;