From e28a2d2b14a7fd87a1fdafc73fdd458f1f06be7d Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Fri, 3 Apr 2026 18:09:14 +0900 Subject: [PATCH] ... --- src/main/kotlin/service/AutoTradingManager.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/service/AutoTradingManager.kt b/src/main/kotlin/service/AutoTradingManager.kt index 60eae83..fe43005 100644 --- a/src/main/kotlin/service/AutoTradingManager.kt +++ b/src/main/kotlin/service/AutoTradingManager.kt @@ -41,6 +41,7 @@ import network.RagService import network.StockUniverseLoader import org.jetbrains.skia.ImageFilter import util.MarketUtil +import java.time.LocalDate import java.time.LocalDateTime import java.time.LocalTime import java.time.ZoneId @@ -82,14 +83,21 @@ object AutoTradingManager { fun startBackgroundScheduler() { scope.launch { while (isActive) { + val seoulZone = ZoneId.of("Asia/Seoul") val now = LocalTime.now(ZoneId.of("Asia/Seoul")) - if (now.isAfter(H08M30) && now.isBefore(H18) && !shouldShowFullWindow) { + val nowDate = LocalDate.now(seoulZone) + var checkTime = 60_000 * 3L + val isTradingDay = nowDate.dayOfWeek.value in 1..5 + if (isTradingDay && now.isAfter(H08M30) && now.isBefore(H18) && !shouldShowFullWindow) { shouldShowFullWindow = true SystemSleepPreventer.wakeDisplay() } else if (now.isAfter(LocalTime.of(23, 50)) && now.isBefore(LocalTime.of(8, 0))) { SystemSleepPreventer.sleepDisplay() } - delay(60_000 * 3) // 1분마다 체크 + if (!isTradingDay) { + checkTime = 60_000 * 30L + } + delay(checkTime) // 1분마다 체크 } } }