백테스팅 워밍업데이터 적용
This commit is contained in:
@@ -15,14 +15,13 @@ import {
|
||||
runBacktest,
|
||||
loadBacktestSettings,
|
||||
loadIndicatorSettings,
|
||||
API_BASE,
|
||||
type BacktestResultRecord,
|
||||
type BacktestAnalysis,
|
||||
type BacktestSignal,
|
||||
type StrategyDto,
|
||||
} from '../utils/backendApi';
|
||||
import { timeframeToCandleType } from '../utils/chartCandleType';
|
||||
import type { Theme, Timeframe } from '../types';
|
||||
import { fetchBacktestCandleBundle } from '../utils/backtestWarmup';
|
||||
import { buildEquityFromSignals } from '../utils/backtestEquity';
|
||||
import {
|
||||
formatChartTypeKo,
|
||||
@@ -30,6 +29,7 @@ import {
|
||||
normalizeEpochSec,
|
||||
normalizeEpochSecOptional,
|
||||
resolveBacktestRecordExecTimeframe,
|
||||
resolveBacktestChartBarCount,
|
||||
toUpbitMarket,
|
||||
} from '../utils/backtestUiUtils';
|
||||
import BacktestExecutionList, { type ExecutionListTab } from './backtest/BacktestExecutionList';
|
||||
@@ -272,19 +272,18 @@ export function BacktestHistoryPage({ theme = 'dark' }: Props) {
|
||||
? resolveStrategyPrimaryTimeframe(strategy)
|
||||
: '1m';
|
||||
const execTimeframe = resolveBacktestExecTimeframe(runTimeframe, strategyTimeframe);
|
||||
const [settings, indicatorParams, barsRes] = await Promise.all([
|
||||
const [settings, indicatorParams] = await Promise.all([
|
||||
loadBacktestSettings(),
|
||||
loadIndicatorSettings(),
|
||||
fetch(`${API_BASE}/candles/history?${new URLSearchParams({
|
||||
market: runMarket,
|
||||
type: timeframeToCandleType(execTimeframe),
|
||||
count: '800',
|
||||
})}`),
|
||||
]);
|
||||
if (!barsRes.ok) throw new Error(`캔들 로딩 실패 (${barsRes.status})`);
|
||||
const bars = (await barsRes.json()) as Array<{
|
||||
time: number; open: number; high: number; low: number; close: number; volume: number;
|
||||
}>;
|
||||
const candleBundle = await fetchBacktestCandleBundle({
|
||||
market: runMarket,
|
||||
timeframe: execTimeframe as Timeframe,
|
||||
buyDsl: strategy?.buyCondition,
|
||||
sellDsl: strategy?.sellCondition,
|
||||
indicatorParams,
|
||||
});
|
||||
const { bars, evaluationBarCount } = candleBundle;
|
||||
if (bars.length < 5) {
|
||||
throw new Error('캔들 데이터가 부족합니다. 잠시 후 다시 시도하거나 타임프레임을 변경해 주세요.');
|
||||
}
|
||||
@@ -296,6 +295,7 @@ export function BacktestHistoryPage({ theme = 'dark' }: Props) {
|
||||
indicatorParams,
|
||||
symbol: runMarket,
|
||||
strategyName: strategy?.name,
|
||||
evaluationBarCount,
|
||||
});
|
||||
if (!result) throw new Error('백테스팅 실행에 실패했습니다.');
|
||||
const list = await loadBacktestResults();
|
||||
@@ -360,7 +360,7 @@ export function BacktestHistoryPage({ theme = 'dark' }: Props) {
|
||||
timeframe: resolveBacktestRecordExecTimeframe(selectedBacktest),
|
||||
toTimeSec: toSec,
|
||||
fromTimeSec: fromSec > 0 ? fromSec : undefined,
|
||||
barCount: selectedBacktest.barCount || 300,
|
||||
barCount: resolveBacktestChartBarCount(selectedBacktest),
|
||||
strategyId: selectedBacktest.strategyId,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user