가상매매 목록 실시간 연결안됨 문제수정
This commit is contained in:
@@ -221,16 +221,17 @@ const VirtualTradingPage: React.FC<Props> = ({
|
||||
}, [session.running, refreshPaperData]);
|
||||
|
||||
const mergedLiveStatus = useMemo(() => {
|
||||
if (!session.running) return liveStatusByMarket;
|
||||
const merged = { ...liveStatusByMarket };
|
||||
const now = Date.now();
|
||||
/** 폴링 주기(3~5s) + 지연 여유 — 지표 스냅샷 갱신 시 STOMP 틱 없어도 실시간 표시 */
|
||||
const SNAP_LIVE_MS = 12_000;
|
||||
for (const [market, snap] of Object.entries(snapshots)) {
|
||||
if (snap?.updatedAt && now - snap.updatedAt < 8000) {
|
||||
if (snap?.updatedAt && now - snap.updatedAt < SNAP_LIVE_MS) {
|
||||
merged[market] = 'live';
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}, [liveStatusByMarket, snapshots, session.running]);
|
||||
}, [liveStatusByMarket, snapshots]);
|
||||
|
||||
const posQty = useMemo(() => {
|
||||
const p = summary?.positions?.find(x => x.symbol === selectedMarket);
|
||||
|
||||
Reference in New Issue
Block a user