가상투자 메뉴 기능 구현

This commit is contained in:
Macbook
2026-05-25 06:41:45 +09:00
parent 0cfe7fc84c
commit 8b373b11e3
33 changed files with 3897 additions and 99 deletions
@@ -147,9 +147,36 @@ public class DynamicSubscriptionManager {
}
}
/**
* live-conditions API 등 — 최소 봉 수 확보까지 동기 warm-up (종목별 독립).
*/
public void ensureBarsReadySync(String market, String candleType, int minBars) {
upbitWsClient.addMarket(market);
if (ta4jStorage.getBarCount(market, candleType) >= minBars) {
return;
}
String key = market + ":" + candleType;
if (warmingUp.putIfAbsent(key, Boolean.TRUE) == null) {
try {
warmUp(market, candleType);
} finally {
warmingUp.remove(key);
}
} else {
// 다른 스레드 warm-up 중 — 짧게 대기 후 재확인
for (int i = 0; i < 30 && ta4jStorage.getBarCount(market, candleType) < minBars; i++) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
break;
}
}
}
}
/**
* 실시간 전략 체크 등 STOMP 클라이언트 없이도 백엔드가 틱·캔들을 수집하도록 마켓을 고정 구독한다.
* (관심종목 모니터링 — 프론트가 해당 토픽을 구독하면 평가·시그널 발행이 연결됨)
*/
public void ensureMarketPinned(String market, String candleType) {
String key = market + ":" + candleType;