추가수정

This commit is contained in:
Macbook
2026-06-09 13:35:42 +09:00
parent 7928b4ef46
commit c98d1a188f
4 changed files with 14 additions and 29 deletions
@@ -9,6 +9,8 @@ interface Options {
onNewCandle: (bar: OHLCVBar) => void;
enabled?: boolean;
deepObvHistory?: boolean;
/** 직접 지정할 페치 봉 수 — UPBIT_DIRECT 전용 (deepObvHistory·WARMUP_COUNT 무시) */
fetchCount?: number;
source?: ChartRealtimeSource;
}
@@ -29,6 +31,7 @@ export function useChartRealtimeData(
onNewCandle: opts.onNewCandle,
enabled: opts.enabled !== false && !useStomp,
deepObvHistory: opts.deepObvHistory,
fetchCount: opts.fetchCount,
});
return useStomp ? stomp : upbit;
}
+5 -4
View File
@@ -26,6 +26,8 @@ interface UpbitDataOptions {
enabled?: boolean;
/** OBV 등 누적 지표: 상장 이력에 가깝게 장기 캔들 로드 */
deepObvHistory?: boolean;
/** 직접 지정할 페치 봉 수 (deepObvHistory·WARMUP_COUNT 무시) */
fetchCount?: number;
}
interface UseUpbitDataReturn {
@@ -88,9 +90,8 @@ export function useUpbitData(
const marketChanged = prevMarketRef.current !== '' && prevMarketRef.current !== market;
prevMarketRef.current = market;
const fetchCount = opts.deepObvHistory
? OBV_DEEP_HISTORY
: DISPLAY_COUNT + WARMUP_COUNT;
const fetchCount = opts.fetchCount
?? (opts.deepObvHistory ? OBV_DEEP_HISTORY : DISPLAY_COUNT + WARMUP_COUNT);
fetchUpbitCandlesCached(market, timeframe, fetchCount, marketChanged)
.then(newBars => {
@@ -108,7 +109,7 @@ export function useUpbitData(
});
return () => { cancelled = true; };
}, [market, timeframe, opts.enabled, opts.deepObvHistory]);
}, [market, timeframe, opts.enabled, opts.deepObvHistory, opts.fetchCount]);
// ── 2. WebSocket: 실시간 체결 구독 ────────────────────────────────────
const handleMessage = useCallback((msg: UpbitMessage) => {