1분봉 오류 수정
This commit is contained in:
+20
-10
@@ -103,12 +103,21 @@ public class StrategyConditionTimeframeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* START/flow 에만 남은 stale 1m 제거 — DSL 조건에 명시된 분봉 기준.
|
||||
* START/flow 에만 남은 stale 1m 제거 — CONDITION 에 선언된 분봉 기준(기본값 1m 제외).
|
||||
*/
|
||||
private Set<String> sanitizeEvaluationTimeframes(Set<String> scope, GcStrategy strategy) {
|
||||
Set<String> explicit = collectExplicitFromStrategy(strategy);
|
||||
if (explicit.isEmpty()) return scope;
|
||||
if (!explicit.contains("1m") && scope.contains("1m")) {
|
||||
if (!scope.contains("1m") || scope.size() <= 1) return scope;
|
||||
|
||||
Set<String> conditionDeclared = collectConditionDeclaredFromStrategy(strategy);
|
||||
if (conditionDeclared.contains("1m") && conditionDeclared.size() > 1) {
|
||||
return scope;
|
||||
}
|
||||
if (!conditionDeclared.contains("1m")) {
|
||||
Set<String> filtered = new LinkedHashSet<>(scope);
|
||||
filtered.remove("1m");
|
||||
return filtered.isEmpty() ? scope : filtered;
|
||||
}
|
||||
if (conditionDeclared.equals(Set.of("1m"))) {
|
||||
Set<String> filtered = new LinkedHashSet<>(scope);
|
||||
filtered.remove("1m");
|
||||
return filtered.isEmpty() ? scope : filtered;
|
||||
@@ -116,19 +125,20 @@ public class StrategyConditionTimeframeService {
|
||||
return scope;
|
||||
}
|
||||
|
||||
private Set<String> collectExplicitFromStrategy(GcStrategy strategy) {
|
||||
private Set<String> collectConditionDeclaredFromStrategy(GcStrategy strategy) {
|
||||
Set<String> out = new LinkedHashSet<>();
|
||||
collectExplicitFromJson(strategy.getBuyConditionJson(), out);
|
||||
collectExplicitFromJson(strategy.getSellConditionJson(), out);
|
||||
collectConditionDeclaredFromJson(strategy.getBuyConditionJson(), out);
|
||||
collectConditionDeclaredFromJson(strategy.getSellConditionJson(), out);
|
||||
return out;
|
||||
}
|
||||
|
||||
private void collectExplicitFromJson(String json, Set<String> out) {
|
||||
private void collectConditionDeclaredFromJson(String json, Set<String> out) {
|
||||
if (json == null || json.isBlank()) return;
|
||||
try {
|
||||
out.addAll(StrategyDslTimeframeNormalizer.collectExplicitCandleTypes(objectMapper.readTree(json)));
|
||||
out.addAll(StrategyDslTimeframeNormalizer.collectConditionDeclaredCandleTypes(
|
||||
objectMapper.readTree(json)));
|
||||
} catch (Exception e) {
|
||||
log.warn("[StrategyTimeframes] explicit JSON 파싱 실패: {}", e.getMessage());
|
||||
log.warn("[StrategyTimeframes] condition-declared JSON 파싱 실패: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user