전략평가 메뉴 추가

This commit is contained in:
Macbook
2026-06-12 14:39:17 +09:00
parent cb1bde2563
commit ae9266bd28
23 changed files with 1977 additions and 19 deletions
@@ -0,0 +1,37 @@
/**
* 전략 평가 — 전략에 포함된 지표 파라미터 맵
*/
import type { StrategyDto } from './backendApi';
import { collectStrategyRegistryTypes } from './strategyToChartIndicators';
export type EvalIndicatorParams = Record<string, Record<string, number | string | boolean>>;
export function buildEvalParamsFromStrategy(
strategy: StrategyDto | null | undefined,
getParams: (type: string) => Record<string, number | string | boolean>,
): EvalIndicatorParams {
const types = collectStrategyRegistryTypes(strategy);
const out: EvalIndicatorParams = {};
for (const type of types) {
out[type] = { ...getParams(type) };
}
return out;
}
export function mergeEvalGetParams(
baseGetParams: (type: string, defaults?: Record<string, number | string | boolean>) => Record<string, number | string | boolean>,
applied: EvalIndicatorParams | null | undefined,
) {
return (type: string, defaults?: Record<string, number | string | boolean>) => {
const base = baseGetParams(type, defaults);
const override = applied?.[type];
return override ? { ...base, ...override } : base;
};
}
export function hasEvalParamsDiff(
draft: EvalIndicatorParams,
applied: EvalIndicatorParams | null | undefined,
): boolean {
return JSON.stringify(draft) !== JSON.stringify(applied ?? {});
}