obv 선 표시

This commit is contained in:
Macbook
2026-06-09 01:13:54 +09:00
parent 1f0671aa7a
commit 969b2fa6ad
7 changed files with 68 additions and 21 deletions
+7 -3
View File
@@ -7,7 +7,7 @@ import { parseStompJson } from '../utils/stompMessage';
import { subscribeStompTopic } from '../utils/stompChartBroker';
import { timeframeToCandleType } from '../utils/chartCandleType';
import { getCandleStart, TF_SECONDS } from '../utils/upbitApi';
import { DISPLAY_COUNT, WARMUP_COUNT } from './useUpbitData';
import { DISPLAY_COUNT, WARMUP_COUNT, OBV_DEEP_HISTORY } from './useUpbitData';
import type { WsStatus } from './useUpbitData';
import { API_BASE } from '../utils/backendApi';
import { fetchUpbitCandlesCached } from '../utils/requestCache';
@@ -53,6 +53,8 @@ interface Options {
onTickUpdate: (bar: OHLCVBar) => void;
onNewCandle: (bar: OHLCVBar) => void;
enabled?: boolean;
/** OBV 누적 정확도 — 더 많은 초기 봉 로드 */
deepObvHistory?: boolean;
}
interface Return {
@@ -177,7 +179,9 @@ export function useStompChartData(
const marketChanged = prevMarketRef.current !== '' && prevMarketRef.current !== market;
prevMarketRef.current = market;
const count = DISPLAY_COUNT + WARMUP_COUNT;
const count = opts.deepObvHistory
? OBV_DEEP_HISTORY
: DISPLAY_COUNT + WARMUP_COUNT;
loadInitialBars(market, timeframe, count, marketChanged)
.then(newBars => {
if (cancelled) return;
@@ -202,7 +206,7 @@ export function useStompChartData(
setIsLoading(false);
});
return () => { cancelled = true; };
}, [market, candleType, timeframe, opts.enabled]);
}, [market, candleType, timeframe, opts.enabled, opts.deepObvHistory]);
const syncBarsToReactIfNeeded = useCallback((marketId: string) => {
if (!bootstrapFromStompRef.current) return;