전략평가 화면 수정
This commit is contained in:
@@ -51,20 +51,25 @@ function walk(
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.type === 'AND' || node.type === 'OR') {
|
||||
node.children?.forEach(c => walk(c, timeframe, side, out, seen));
|
||||
return;
|
||||
}
|
||||
|
||||
// StrategyDslToTa4jAdapter 와 동일: type 미설정(구버전 DSL) 시 CONDITION 으로 처리
|
||||
if ((!node.type || node.type === 'CONDITION') && node.condition) {
|
||||
const c = node.condition;
|
||||
const rowTf = normalizeStartCandleType(c.leftCandleType ?? c.rightCandleType ?? timeframe);
|
||||
const key = `${side}:${rowTf}:${c.indicatorType}:${c.conditionType}:${c.targetValue ?? ''}:${c.leftField ?? ''}`;
|
||||
if (seen.has(key)) return;
|
||||
seen.add(key);
|
||||
const rowId = node.id ? `${node.id}-${side}` : `${side}:${rowTf}:${c.indicatorType}:${out.length}`;
|
||||
if (seen.has(rowId)) return;
|
||||
seen.add(rowId);
|
||||
|
||||
const condLabel = CONDITION_LABEL[c.conditionType] ?? c.conditionType;
|
||||
const target = coerceFiniteNumber(c.targetValue ?? c.compareValue ?? null);
|
||||
const plotKey = c.leftField && c.leftField !== 'none' ? c.leftField : c.indicatorType;
|
||||
|
||||
out.push({
|
||||
id: `${node.id}-${side}`,
|
||||
id: rowId,
|
||||
indicatorType: c.indicatorType,
|
||||
displayName: formatIndicatorDisplayLabel(c.indicatorType),
|
||||
conditionType: c.conditionType,
|
||||
@@ -80,6 +85,17 @@ function walk(
|
||||
node.children?.forEach(c => walk(c, timeframe, side, out, seen));
|
||||
}
|
||||
|
||||
/** 목록 표시용 — 동일 지표 복수 조건 구분 */
|
||||
export function formatVirtualConditionListLabel(
|
||||
row: Pick<VirtualConditionRow, 'displayName' | 'thresholdLabel' | 'conditionLabel' | 'timeframe'>,
|
||||
): string {
|
||||
const parts = [row.displayName];
|
||||
if (row.thresholdLabel) parts.push(row.thresholdLabel);
|
||||
else if (row.conditionLabel) parts.push(row.conditionLabel);
|
||||
if (row.timeframe && row.timeframe !== '1m') parts.push(row.timeframe);
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
export function extractVirtualConditions(strategy: StrategyDto | null | undefined): VirtualConditionRow[] {
|
||||
if (!strategy) return [];
|
||||
const out: VirtualConditionRow[] = [];
|
||||
|
||||
Reference in New Issue
Block a user