stochastic slow 중앙선 안나오는 문제 수정
This commit is contained in:
@@ -46,7 +46,6 @@ public class BarBuilder {
|
||||
private final TradeSignalService tradeSignalService;
|
||||
private final OrderExecutionQueue orderExecutionQueue;
|
||||
private final GcLiveStrategySettingsRepository liveSettingsRepo;
|
||||
private final LiveStrategyTimeframeService timeframeService;
|
||||
|
||||
/** 상위 집계 타임프레임 (분 단위 집계 주기: 3, 5, 15, 30, 60, 240, 1440) */
|
||||
private static final int[] UPPER_MINUTES = {3, 5, 15, 30, 60, 240, 1440};
|
||||
@@ -115,9 +114,8 @@ public class BarBuilder {
|
||||
ta4jStorage.addBar(market, "1m", bar);
|
||||
log.debug("[BarBuilder] 1m Bar 확정: {} @ {}", market, endTime);
|
||||
|
||||
String evalCandleType = timeframeService.resolveCandleTypeForMarket(market);
|
||||
BarSeries series1m = ta4jStorage.getOrCreate(market, "1m");
|
||||
if ("1m".equals(evalCandleType)) {
|
||||
if (shouldEvaluateOnClose(market, "1m")) {
|
||||
BarSeries series1m = ta4jStorage.getOrCreate(market, "1m");
|
||||
evaluateStrategyOnBarClose(market, "1m", series1m.getEndIndex(), bar);
|
||||
}
|
||||
|
||||
@@ -147,7 +145,7 @@ public class BarBuilder {
|
||||
Bar upperBar = buildTa4jBar(partial, Duration.ofMinutes(minutes), upperEnd);
|
||||
ta4jStorage.addBar(market, type, upperBar);
|
||||
BarSeries upperAfter = ta4jStorage.getOrCreate(market, type);
|
||||
if (type.equals(evalCandleType)) {
|
||||
if (shouldEvaluateOnClose(market, type)) {
|
||||
int maturedUpper = Math.max(upperAfter.getBeginIndex(), upperAfter.getEndIndex() - 1);
|
||||
Bar maturedUpperBar = upperAfter.getBar(maturedUpper);
|
||||
evaluateStrategyOnBarClose(market, type, maturedUpper, maturedUpperBar);
|
||||
@@ -157,6 +155,14 @@ public class BarBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/** 활성 실시간 전략 설정 중 해당 분봉(candleType)으로 평가하는 항목이 있는지 */
|
||||
private boolean shouldEvaluateOnClose(String market, String candleType) {
|
||||
String ct = LiveStrategyTimeframeService.normalize(candleType);
|
||||
return liveSettingsRepo.findActiveByMarket(market).stream()
|
||||
.anyMatch(s -> ct.equals(LiveStrategyTimeframeService.normalize(
|
||||
s.getCandleType() != null ? s.getCandleType() : "1m")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 봉 마감 시점 전략 평가 + 시그널 STOMP 발행(평가 분봉 채널) + DB/주문 큐 적재.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user