전략 시간봉 오류 수정

This commit is contained in:
Macbook
2026-05-27 15:49:56 +09:00
parent 63693d47c0
commit e86142dad5
5 changed files with 139 additions and 11 deletions
@@ -100,9 +100,35 @@ public class StrategyTriggerBranchEvaluator {
}
}
JsonNode wrapped = findTimeframeWrapper(node);
if (wrapped != null) {
String ct = LiveStrategyTimeframeService.normalize(wrapped.path("candleType").asText("1m"));
JsonNode sub = firstChild(wrapped);
return new BranchScope("SINGLE", List.of(new BranchDef(ct, sub != null && !sub.isNull() ? sub : node)));
}
return new BranchScope("SINGLE", List.of(new BranchDef("1m", node)));
}
/** 레거시 DSL — 루트가 TIMEFRAME이 아닐 때 하위 TIMEFRAME 래퍼 탐색 */
private static JsonNode findTimeframeWrapper(JsonNode node) {
if (node == null || node.isNull()) return null;
if ("TIMEFRAME".equals(node.path("type").asText(""))) return node;
JsonNode children = node.path("children");
if (children.isArray()) {
for (JsonNode child : children) {
JsonNode found = findTimeframeWrapper(child);
if (found != null) return found;
}
}
JsonNode child = node.path("child");
if (!child.isMissingNode() && !child.isNull()) {
return findTimeframeWrapper(child);
}
return null;
}
private static JsonNode firstChild(JsonNode timeframeNode) {
JsonNode children = timeframeNode.path("children");
if (children.isArray() && !children.isEmpty()) return children.get(0);