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
@@ -22,6 +22,7 @@ export function useChartRealtimeData(
onTickUpdate: opts.onTickUpdate,
onNewCandle: opts.onNewCandle,
enabled: opts.enabled !== false && useStomp,
deepObvHistory: opts.deepObvHistory,
});
const upbit = useUpbitData(market, timeframe, {
onTickUpdate: opts.onTickUpdate,
+10 -1
View File
@@ -22,7 +22,7 @@
*/
import { useEffect, useRef, useCallback, useState } from 'react';
import { getIndicatorDef, mergePlotDefs, normalizeHLines, normalizeObvParams, PlotDef, HLineDef } from '../utils/indicatorRegistry';
import { getIndicatorDef, mergePlotDefs, normalizeHLines, normalizeObvParams, enrichIndicatorConfig, PlotDef, HLineDef } from '../utils/indicatorRegistry';
import { createDefaultSmaParams, createDefaultSmaPlots, normalizeSmaConfig } from '../utils/smaConfig';
import { normalizeIchimokuConfig, mergeIchimokuPlots } from '../utils/ichimokuConfig';
import {
@@ -296,6 +296,15 @@ export function useIndicatorSettings(sessionKey = 0) {
plots = mergeIchimokuPlots(plots, registryPlots);
}
if (type === 'OBV') {
plots = enrichIndicatorConfig({
id: '',
type: 'OBV',
params: (def?.defaultParams ?? {}) as Record<string, number | string | boolean>,
plots,
}).plots ?? plots;
}
const cloudColors = type === 'IchimokuCloud'
? resolveIchimokuCloudColors(saved?.cloudColors ?? DEFAULT_ICHIMOKU_CLOUD_COLORS)
: undefined;
+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;