매매실행 방식 설정 추가
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import type { BacktestSettingsDto } from './backendApi';
|
||||
|
||||
export type TradeExecutionMode = 'SCAN_SIGNALS' | 'BACKTEST_ENGINE';
|
||||
|
||||
export const TRADE_EXECUTION_MODE_OPTIONS: {
|
||||
value: TradeExecutionMode;
|
||||
label: string;
|
||||
desc: string;
|
||||
}[] = [
|
||||
{
|
||||
value: 'BACKTEST_ENGINE',
|
||||
label: '백테스트 엔진 (슬리피지·리스크 반영)',
|
||||
desc: '슬리피지, 손절/익절, 진입/청산가 기준. 실제 수익률 분석에 가깝습니다.',
|
||||
},
|
||||
{
|
||||
value: 'SCAN_SIGNALS',
|
||||
label: '조건 스캔 (봉 종가·DSL 충족)',
|
||||
desc: '차트 마커·조건 패널과 동일. 봉 종가 기준 이상적 체결.',
|
||||
},
|
||||
];
|
||||
|
||||
export function normalizeTradeExecutionMode(
|
||||
value?: string | null,
|
||||
): TradeExecutionMode {
|
||||
return value === 'SCAN_SIGNALS' ? 'SCAN_SIGNALS' : 'BACKTEST_ENGINE';
|
||||
}
|
||||
|
||||
export function isScanSignalsExecutionMode(
|
||||
settings?: Pick<BacktestSettingsDto, 'tradeExecutionMode'> | null,
|
||||
): boolean {
|
||||
return normalizeTradeExecutionMode(settings?.tradeExecutionMode) === 'SCAN_SIGNALS';
|
||||
}
|
||||
|
||||
export function tradeExecutionModeLabel(mode?: string | null): string {
|
||||
const normalized = normalizeTradeExecutionMode(mode);
|
||||
return TRADE_EXECUTION_MODE_OPTIONS.find(o => o.value === normalized)?.label
|
||||
?? TRADE_EXECUTION_MODE_OPTIONS[0].label;
|
||||
}
|
||||
Reference in New Issue
Block a user