전략평가 오류 수정
This commit is contained in:
@@ -152,10 +152,14 @@ public class StrategyDslToTa4jAdapter {
|
||||
|
||||
BarSeries resolveSeries(String candleType) {
|
||||
String ct = LiveStrategyTimeframeService.normalize(candleType);
|
||||
// 백테스트용 사전 집계 시리즈 우선 검색
|
||||
// 백테스트·차트 scan — 사전 집계 시리즈 우선
|
||||
if (seriesOverrides != null && seriesOverrides.containsKey(ct)) {
|
||||
return seriesOverrides.get(ct);
|
||||
}
|
||||
// 차트봉 scan/eval — Ta4jStorage(실시간 1m 등)와 OHLCV 혼합 금지 (시그널 0·차트 불일치)
|
||||
if (seriesOverrides != null && !seriesOverrides.isEmpty()) {
|
||||
return primarySeries;
|
||||
}
|
||||
if (storage != null && market != null && !market.isBlank()
|
||||
&& storage.exists(market, ct)) {
|
||||
return storage.getOrCreate(market, ct);
|
||||
@@ -252,7 +256,7 @@ public class StrategyDslToTa4jAdapter {
|
||||
}
|
||||
|
||||
private Rule buildTimeframeRule(JsonNode node, RuleBuildContext ctx) {
|
||||
String ct = node.path("candleType").asText("1m");
|
||||
String ct = resolveTimeframeCandleType(node);
|
||||
BarSeries branchSeries = ctx.resolveSeries(ct);
|
||||
RuleBuildContext branchCtx = ctx.withPrimary(branchSeries);
|
||||
List<Rule> rules = childRules(node, branchCtx);
|
||||
@@ -263,6 +267,15 @@ public class StrategyDslToTa4jAdapter {
|
||||
ctx.useConfirmedOnly(), ctx.isBacktest());
|
||||
}
|
||||
|
||||
/** TIMEFRAME 노드 — candleTypes[0] 우선, 없으면 candleType (레거시 기본 1m) */
|
||||
private static String resolveTimeframeCandleType(JsonNode node) {
|
||||
JsonNode types = node.path("candleTypes");
|
||||
if (types.isArray() && !types.isEmpty()) {
|
||||
return LiveStrategyTimeframeService.normalize(types.get(0).asText("1m"));
|
||||
}
|
||||
return LiveStrategyTimeframeService.normalize(node.path("candleType").asText("1m"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 다른 시간봉 시리즈로 빌드된 Rule.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user