백테스팅 수정

This commit is contained in:
Macbook
2026-06-12 00:00:06 +09:00
parent eb6cf894da
commit d5338274d4
10 changed files with 151 additions and 72 deletions
+16 -1
View File
@@ -1,4 +1,5 @@
import type { ChartType, Timeframe } from '../types';
import type { BacktestResultRecord } from './backendApi';
import { formatUpbitKrwPrice } from './safeFormat';
export function toUpbitMarket(symbol: string): string {
@@ -19,12 +20,26 @@ const TIMEFRAME_KO: Record<Timeframe, string> = {
'1M': '1월',
};
/** 차트·목록용 시간봉 한글 라벨 */
/** 차트·목록용 한글 라벨 */
export function formatTimeframeKo(raw: string | undefined): string {
const tf = normalizeChartTimeframe(raw);
return TIMEFRAME_KO[tf] ?? tf;
}
/** 백테스트 결과 — 실제 실행 시간봉 (스냅샷 우선, 전략 DSL과 무관) */
export function resolveBacktestRecordExecTimeframe(record: BacktestResultRecord): string {
if (record.executionSnapshotJson) {
try {
const snap = JSON.parse(record.executionSnapshotJson) as { timeframe?: string };
const fromSnap = snap?.timeframe?.trim();
if (fromSnap) return fromSnap;
} catch { /* ignore */ }
}
const fromCol = record.timeframe?.trim();
if (fromCol && fromCol !== 'unknown') return fromCol;
return '1m';
}
const CHART_TYPE_KO: Record<ChartType, string> = {
candlestick: '캔들스틱',
bar: '바',