실시간 차트 갱신오류 수정

This commit is contained in:
Macbook
2026-06-12 22:26:31 +09:00
parent 65fe1404b8
commit 9e4d24ee2a
4 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -1014,7 +1014,7 @@ const ChartSlot = forwardRef<ChartSlotHandle, ChartSlotProps>(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);
+2
View File
@@ -994,6 +994,8 @@ const TradingChart: React.FC<TradingChartProps> = ({
}
const m = managerRef.current;
if (m?.hasMainSeries()) {
// 지표 일부만 로드된 경우에도 메인 캔들은 준비됨 — 실시간 틱 허용
onCandlesReady?.();
const expected = countExpectedVisibleIndicators(indicatorsRef.current);
const loaded = m.getLoadedIndicatorCount();
if (expected === 0 || loaded >= expected) {
+8 -3
View File
@@ -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;