시간봉 알림 수정
This commit is contained in:
@@ -51,7 +51,9 @@ import { coerceFiniteNumber } from '../utils/safeFormat';
|
||||
import {
|
||||
syncVirtualTargetsToBackend,
|
||||
stopVirtualLiveOnBackend,
|
||||
warnStrategyTimeframeMismatch,
|
||||
} from '../utils/virtualLiveStrategySync';
|
||||
import { pinStrategyEvaluationTimeframes } from '../utils/strategyTimeframePin';
|
||||
import { persistVirtualTargetPinned } from '../utils/virtualTargetMutations';
|
||||
import { virtualTargetLimitMessage } from '../utils/virtualTargetLimits';
|
||||
import '../styles/virtualTradingDashboard.css';
|
||||
@@ -269,13 +271,16 @@ const VirtualTradingPage: React.FC<Props> = ({
|
||||
window.alert('투자전략을 선택하세요.');
|
||||
return;
|
||||
}
|
||||
const globalStrat = strategies.find(s => s.id === session.globalStrategyId);
|
||||
const ok = await warnStrategyTimeframeMismatch(globalStrat, session.globalStrategyId);
|
||||
if (!ok) return;
|
||||
try {
|
||||
await syncVirtualTargetsToBackend(targets, session, true);
|
||||
setSession(s => ({ ...s, running: true }));
|
||||
} catch {
|
||||
window.alert('가상투자 시작 설정 저장에 실패했습니다.');
|
||||
}
|
||||
}, [targets, session]);
|
||||
}, [targets, session, strategies]);
|
||||
|
||||
const handleStop = useCallback(async () => {
|
||||
try {
|
||||
@@ -298,24 +303,21 @@ const VirtualTradingPage: React.FC<Props> = ({
|
||||
t.market === market ? { ...t, strategyId } : t,
|
||||
));
|
||||
if (!session.running || !strategyId) return;
|
||||
const target = targets.find(t => t.market === market);
|
||||
const candleType = normalizeStartCandleType(
|
||||
resolveTargetCandleType(target ?? { candleType: undefined }, snapshots[market]?.timeframe),
|
||||
);
|
||||
try {
|
||||
await saveLiveStrategySettings({
|
||||
market,
|
||||
strategyId,
|
||||
candleType,
|
||||
isLiveCheck: true,
|
||||
executionType: session.executionType,
|
||||
positionMode: session.positionMode,
|
||||
skipWatchlistSync: true,
|
||||
skipGlobalTemplate: true,
|
||||
});
|
||||
await pinStrategyEvaluationTimeframes(market, strategyId);
|
||||
} catch {
|
||||
window.alert('종목 전략 변경 저장에 실패했습니다.');
|
||||
}
|
||||
}, [session, targets, snapshots]);
|
||||
}, [session, targets]);
|
||||
|
||||
const handleTargetCandleTypeChange = useCallback(async (market: string, candleType: string) => {
|
||||
const normalized = normalizeStartCandleType(candleType);
|
||||
@@ -330,15 +332,14 @@ const VirtualTradingPage: React.FC<Props> = ({
|
||||
await saveLiveStrategySettings({
|
||||
market,
|
||||
strategyId,
|
||||
candleType: normalized,
|
||||
isLiveCheck: true,
|
||||
executionType: session.executionType,
|
||||
positionMode: session.positionMode,
|
||||
skipWatchlistSync: true,
|
||||
skipGlobalTemplate: true,
|
||||
});
|
||||
await pinCandleWatch(market, normalized);
|
||||
if (normalized !== '1m') {
|
||||
await pinCandleWatch(market, '1m');
|
||||
if (strategyId) {
|
||||
await pinStrategyEvaluationTimeframes(market, strategyId);
|
||||
}
|
||||
} catch {
|
||||
window.alert('종목 평가 분봉 변경 저장에 실패했습니다.');
|
||||
|
||||
Reference in New Issue
Block a user