가상투자 설정 수정

This commit is contained in:
Macbook
2026-05-25 22:30:54 +09:00
parent cae1c3a624
commit 1e950c7db4
24 changed files with 1015 additions and 362 deletions
@@ -117,7 +117,9 @@ public class LiveStrategySettingsService {
public LiveStrategySettingsDto save(Long userId, String deviceId,
LiveStrategySettingsDto dto) {
persistGlobalTemplate(userId, deviceId, dto);
if (!Boolean.TRUE.equals(dto.getSkipGlobalTemplate())) {
persistGlobalTemplate(userId, deviceId, dto);
}
if (dto.getMarket() != null && !dto.getMarket().isBlank()) {
enrichStrategyTimeframes(dto);
@@ -129,7 +131,9 @@ public class LiveStrategySettingsService {
}
}
syncAllWatchlistMarkets(userId, deviceId, dto);
if (!Boolean.TRUE.equals(dto.getSkipWatchlistSync())) {
syncAllWatchlistMarkets(userId, deviceId, dto);
}
String market = dto.getMarket() != null ? dto.getMarket() : "KRW-BTC";
log.info("[LiveStrategySettings] global saved + watchlist sync, template market={}", market);
GcAppSettings app = appSettingsService.getEntity(userId, deviceId);
@@ -5,6 +5,7 @@ import com.goldenchart.entity.GcAppSettings;
import com.goldenchart.entity.GcPaperAccount;
import com.goldenchart.entity.GcPaperPosition;
import com.goldenchart.entity.GcPaperTrade;
import com.goldenchart.repository.GcLiveStrategySettingsRepository;
import com.goldenchart.repository.GcPaperAccountRepository;
import com.goldenchart.repository.GcPaperPositionRepository;
import com.goldenchart.repository.GcPaperTradeRepository;
@@ -36,6 +37,7 @@ public class PaperTradingService {
private final GcPaperPositionRepository positionRepo;
private final GcPaperTradeRepository tradeRepo;
private final AppSettingsService appSettingsService;
private final GcLiveStrategySettingsRepository liveSettingsRepo;
// ── 조회 ─────────────────────────────────────────────────────────────────
@@ -150,7 +152,9 @@ public class PaperTradingService {
GcAppSettings app = appSettingsService.getEntity(userId, deviceId);
if (!Boolean.TRUE.equals(app.getPaperTradingEnabled())) return;
if (!Boolean.TRUE.equals(app.getPaperAutoTradeEnabled())) return;
if (!Boolean.TRUE.equals(app.getLiveStrategyCheck())) return;
boolean marketActive = liveSettingsRepo.findActiveByMarket(market).stream()
.anyMatch(s -> Boolean.TRUE.equals(s.getIsLiveCheck()));
if (!Boolean.TRUE.equals(app.getLiveStrategyCheck()) && !marketActive) return;
try {
GcPaperAccount account = getOrCreateAccount(userId, deviceId, app);