This commit is contained in:
Macbook
2026-06-18 00:56:50 +09:00
parent e5b5af093e
commit ac55748aec
7 changed files with 254 additions and 7 deletions
@@ -203,6 +203,42 @@ public class LiveConditionStatusService {
return bestIdx;
}
/** scan 0건 시 DSL 임계값 요약 로그 */
private static String summarizeBuyCondition(JsonNode buyDsl) {
if (buyDsl == null || buyDsl.isNull()) return "null";
JsonNode cond = findFirstCondition(buyDsl);
if (cond == null) return "no-condition";
String rf = cond.path("rightField").asText("");
boolean override = cond.path("thresholdOverride").asBoolean(false);
double target = cond.path("targetValue").asDouble(Double.NaN);
Double resolved = IndicatorHlineResolver.resolveThresholdField(cond, rf,
cond.path("indicatorType").asText(""), Map.of());
return String.format("right=%s override=%s target=%s resolved=%s type=%s left=%s",
rf, override, Double.isNaN(target) ? "-" : target,
resolved != null ? resolved : "-",
cond.path("conditionType").asText(""),
cond.path("leftField").asText(""));
}
private static JsonNode findFirstCondition(JsonNode node) {
if (node == null || node.isNull()) return null;
if (node.has("condition")) {
JsonNode c = node.get("condition");
if (c != null && c.has("indicatorType")) return c;
}
if (node.has("indicatorType")) return node;
JsonNode children = node.get("children");
if (children != null && children.isArray()) {
for (JsonNode ch : children) {
JsonNode found = findFirstCondition(ch);
if (found != null) return found;
}
}
JsonNode child = node.get("child");
if (child != null) return findFirstCondition(child);
return null;
}
/** Ta4j Bar → 차트용 봉 시작 시각(초) — BacktestingService.barStartEpoch 와 동일 */
private static long barOpenEpochSec(BarSeries series, int index) {
var bar = series.getBar(index);
@@ -781,9 +817,9 @@ public class LiveConditionStatusService {
}
}
if (signals.isEmpty()) {
log.info("[LiveCondition:scan] 0 signals market={} strategy={} tf={} bars={} eval={}..{}",
log.info("[LiveCondition:scan] 0 signals market={} strategy={} tf={} bars={} eval={}..{} cond={}",
market, strategyId, primaryTf, primarySeries.getBarCount(), startIdx,
primarySeries.getEndIndex());
primarySeries.getEndIndex(), summarizeBuyCondition(buyDsl));
} else {
log.debug("[LiveCondition:scan] market={} strategy={} tf={} buy={} sell={}",
market, strategyId, primaryTf, buyHits, sellHits);