백테스팅 워밍업데이터 적용
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { ChartType, Timeframe } from '../types';
|
||||
import type { BacktestResultRecord } from './backendApi';
|
||||
import { formatUpbitKrwPrice } from './safeFormat';
|
||||
import { INDICATOR_WARMUP } from './upbitApi';
|
||||
|
||||
export function toUpbitMarket(symbol: string): string {
|
||||
return symbol.startsWith('KRW-') ? symbol : `KRW-${symbol}`;
|
||||
@@ -40,6 +41,21 @@ export function resolveBacktestRecordExecTimeframe(record: BacktestResultRecord)
|
||||
return '1m';
|
||||
}
|
||||
|
||||
/** 백테스트 결과 차트 로드 봉 수 — 평가 구간 + 지표 워밍업 (차트 SMA와 백테스트 엔진 정렬) */
|
||||
export function resolveBacktestChartBarCount(record: BacktestResultRecord): number {
|
||||
const evalCount = record.barCount > 0 ? record.barCount : 200;
|
||||
let warmup = INDICATOR_WARMUP;
|
||||
if (record.executionSnapshotJson) {
|
||||
try {
|
||||
const snap = JSON.parse(record.executionSnapshotJson) as { warmupBarCount?: number };
|
||||
if (typeof snap.warmupBarCount === 'number' && snap.warmupBarCount > 0) {
|
||||
warmup = snap.warmupBarCount;
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
return evalCount + warmup;
|
||||
}
|
||||
|
||||
const CHART_TYPE_KO: Record<ChartType, string> = {
|
||||
candlestick: '캔들스틱',
|
||||
bar: '바',
|
||||
|
||||
Reference in New Issue
Block a user