가상투자 로직 변경

This commit is contained in:
Macbook
2026-05-31 05:29:17 +09:00
parent 6da4821d9d
commit 85d7fea457
9 changed files with 39 additions and 182 deletions
+12 -10
View File
@@ -28,7 +28,7 @@ import {
} from './virtual/VirtualGridUnifiedHeader';
import type { VirtualCardDisplayMode } from './virtual/VirtualTargetCard';
import { useVirtualIndicatorSnapshots } from '../hooks/useVirtualIndicatorSnapshots';
import { useVirtualBackendTradeSignals } from '../hooks/useVirtualBackendTradeSignals';
import { PAPER_TRADES_CHANGED_EVENT } from '../utils/paperTradeEvents';
import { useVirtualTargetLiveStatus } from '../hooks/useVirtualTargetLiveStatus';
import type { ChartRealtimeSource } from '../hooks/useChartRealtimeData';
import {
@@ -195,15 +195,17 @@ const VirtualTradingPage: React.FC<Props> = ({
session.running,
);
useVirtualBackendTradeSignals({
enabled: paperTradingEnabled && paperAutoTradeEnabled,
session,
targets,
tickers,
paperAutoTradeBudgetPct,
positions: summary?.positions,
onFilled: () => void refreshPaperData({ focusHistory: true }),
});
/** 백엔드 자동 체결 후 UI 갱신(프론트는 주문 실행 안 함) */
useEffect(() => {
if (!session.running) return;
const onTradesChanged = () => { void refreshPaperData(); };
window.addEventListener(PAPER_TRADES_CHANGED_EVENT, onTradesChanged);
const pollId = window.setInterval(onTradesChanged, 20_000);
return () => {
window.removeEventListener(PAPER_TRADES_CHANGED_EVENT, onTradesChanged);
window.clearInterval(pollId);
};
}, [session.running, refreshPaperData]);
const mergedLiveStatus = useMemo(() => {
if (!session.running) return liveStatusByMarket;