diff --git a/frontend/src/chart/ChartWorkspaceView.tsx b/frontend/src/chart/ChartWorkspaceView.tsx index 1b4dc3c..a050fea 100644 --- a/frontend/src/chart/ChartWorkspaceView.tsx +++ b/frontend/src/chart/ChartWorkspaceView.tsx @@ -752,7 +752,7 @@ function ChartWorkspaceViewInner(props: ChartWorkspaceViewProps) { if (last && pending.time === last.time) mgr.updateBar(pending); else if (!last || pending.time > last.time) void mgr.appendBar(pending); else mgr.updateBar({ ...pending, time: last.time }); - } else { + } else if (chartLiveReadyRef.current) { pendingRealtimeBarRef.current = null; } mgr.setCandleAreaPriceLabelsEnabled(chartCandleAreaPriceLabels); diff --git a/frontend/src/components/ChartSlot.tsx b/frontend/src/components/ChartSlot.tsx index 61fe242..07a9f16 100644 --- a/frontend/src/components/ChartSlot.tsx +++ b/frontend/src/components/ChartSlot.tsx @@ -1014,7 +1014,7 @@ const ChartSlot = forwardRef(function ChartSlot if (last && pending.time === last.time) mgr.updateBar(pending); else if (!last || pending.time > last.time) void mgr.appendBar(pending); else mgr.updateBar({ ...pending, time: last.time }); - } else { + } else if (chartLiveReadyRef.current) { pendingRealtimeBarRef.current = null; } mgr.setCandleAreaPriceLabelsEnabled(chartCandleAreaPriceLabels); diff --git a/frontend/src/components/TradingChart.tsx b/frontend/src/components/TradingChart.tsx index a0055f4..fb1c71d 100644 --- a/frontend/src/components/TradingChart.tsx +++ b/frontend/src/components/TradingChart.tsx @@ -994,6 +994,8 @@ const TradingChart: React.FC = ({ } const m = managerRef.current; if (m?.hasMainSeries()) { + // 지표 일부만 로드된 경우에도 메인 캔들은 준비됨 — 실시간 틱 허용 + onCandlesReady?.(); const expected = countExpectedVisibleIndicators(indicatorsRef.current); const loaded = m.getLoadedIndicatorCount(); if (expected === 0 || loaded >= expected) { diff --git a/frontend/src/utils/chartLiveQuote.ts b/frontend/src/utils/chartLiveQuote.ts index 6f3f922..85c104c 100644 --- a/frontend/src/utils/chartLiveQuote.ts +++ b/frontend/src/utils/chartLiveQuote.ts @@ -17,10 +17,15 @@ export function resolveChartLiveQuote( lastBar: OHLCVBar | null, bars: OHLCVBar[], ): ChartLiveQuote { + // 실시간 차트: STOMP/WS로 갱신되는 최신 봉 종가 우선 (티커 REST 초기값에 고정되지 않도록) + const barPrice = lastBar?.close; + const tickerPrice = ticker?.tradePrice; const price = - ticker?.tradePrice != null && Number.isFinite(ticker.tradePrice) - ? ticker.tradePrice - : lastBar?.close ?? null; + barPrice != null && Number.isFinite(barPrice) + ? barPrice + : tickerPrice != null && Number.isFinite(tickerPrice) + ? tickerPrice + : null; if (ticker?.changeRate != null && Number.isFinite(ticker.changeRate)) { const changePct = ticker.changeRate * 100;