실시간 차트 갱신오류 수정
This commit is contained in:
@@ -752,7 +752,7 @@ function ChartWorkspaceViewInner(props: ChartWorkspaceViewProps) {
|
|||||||
if (last && pending.time === last.time) mgr.updateBar(pending);
|
if (last && pending.time === last.time) mgr.updateBar(pending);
|
||||||
else if (!last || pending.time > last.time) void mgr.appendBar(pending);
|
else if (!last || pending.time > last.time) void mgr.appendBar(pending);
|
||||||
else mgr.updateBar({ ...pending, time: last.time });
|
else mgr.updateBar({ ...pending, time: last.time });
|
||||||
} else {
|
} else if (chartLiveReadyRef.current) {
|
||||||
pendingRealtimeBarRef.current = null;
|
pendingRealtimeBarRef.current = null;
|
||||||
}
|
}
|
||||||
mgr.setCandleAreaPriceLabelsEnabled(chartCandleAreaPriceLabels);
|
mgr.setCandleAreaPriceLabelsEnabled(chartCandleAreaPriceLabels);
|
||||||
|
|||||||
@@ -1014,7 +1014,7 @@ const ChartSlot = forwardRef<ChartSlotHandle, ChartSlotProps>(function ChartSlot
|
|||||||
if (last && pending.time === last.time) mgr.updateBar(pending);
|
if (last && pending.time === last.time) mgr.updateBar(pending);
|
||||||
else if (!last || pending.time > last.time) void mgr.appendBar(pending);
|
else if (!last || pending.time > last.time) void mgr.appendBar(pending);
|
||||||
else mgr.updateBar({ ...pending, time: last.time });
|
else mgr.updateBar({ ...pending, time: last.time });
|
||||||
} else {
|
} else if (chartLiveReadyRef.current) {
|
||||||
pendingRealtimeBarRef.current = null;
|
pendingRealtimeBarRef.current = null;
|
||||||
}
|
}
|
||||||
mgr.setCandleAreaPriceLabelsEnabled(chartCandleAreaPriceLabels);
|
mgr.setCandleAreaPriceLabelsEnabled(chartCandleAreaPriceLabels);
|
||||||
|
|||||||
@@ -994,6 +994,8 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
|||||||
}
|
}
|
||||||
const m = managerRef.current;
|
const m = managerRef.current;
|
||||||
if (m?.hasMainSeries()) {
|
if (m?.hasMainSeries()) {
|
||||||
|
// 지표 일부만 로드된 경우에도 메인 캔들은 준비됨 — 실시간 틱 허용
|
||||||
|
onCandlesReady?.();
|
||||||
const expected = countExpectedVisibleIndicators(indicatorsRef.current);
|
const expected = countExpectedVisibleIndicators(indicatorsRef.current);
|
||||||
const loaded = m.getLoadedIndicatorCount();
|
const loaded = m.getLoadedIndicatorCount();
|
||||||
if (expected === 0 || loaded >= expected) {
|
if (expected === 0 || loaded >= expected) {
|
||||||
|
|||||||
@@ -17,10 +17,15 @@ export function resolveChartLiveQuote(
|
|||||||
lastBar: OHLCVBar | null,
|
lastBar: OHLCVBar | null,
|
||||||
bars: OHLCVBar[],
|
bars: OHLCVBar[],
|
||||||
): ChartLiveQuote {
|
): ChartLiveQuote {
|
||||||
|
// 실시간 차트: STOMP/WS로 갱신되는 최신 봉 종가 우선 (티커 REST 초기값에 고정되지 않도록)
|
||||||
|
const barPrice = lastBar?.close;
|
||||||
|
const tickerPrice = ticker?.tradePrice;
|
||||||
const price =
|
const price =
|
||||||
ticker?.tradePrice != null && Number.isFinite(ticker.tradePrice)
|
barPrice != null && Number.isFinite(barPrice)
|
||||||
? ticker.tradePrice
|
? barPrice
|
||||||
: lastBar?.close ?? null;
|
: tickerPrice != null && Number.isFinite(tickerPrice)
|
||||||
|
? tickerPrice
|
||||||
|
: null;
|
||||||
|
|
||||||
if (ticker?.changeRate != null && Number.isFinite(ticker.changeRate)) {
|
if (ticker?.changeRate != null && Number.isFinite(ticker.changeRate)) {
|
||||||
const changePct = ticker.changeRate * 100;
|
const changePct = ticker.changeRate * 100;
|
||||||
|
|||||||
Reference in New Issue
Block a user