This commit is contained in:
2026-02-12 13:11:07 +09:00
parent 4bf055fa68
commit da4ab01d5f
8 changed files with 31 additions and 28 deletions
@@ -42,7 +42,7 @@ object AutoTradingManager {
// 설정 상수
private const val MIN_RISE_RATE = 0.1
private const val MAX_RISE_RATE = 15.0
private const val MAX_RISE_RATE = 19.0
private const val CYCLE_TIMEOUT = 30 * 60 * 1000L // 한 사이클 최대 10분
private const val WATCHDOG_CHECK_INTERVAL = 30 * 1000L // 30초마다 생존 확인
private const val STUCK_THRESHOLD = 5 * 60 * 1000L // 5분간 반응 없으면 'Stuck'으로 판단
@@ -88,10 +88,10 @@ object AutoTradingManager {
// [프로세스 1] 장 마감 및 잔고 체크
val now = LocalTime.now(ZoneId.of("Asia/Seoul"))
//&& now.isBefore(LocalTime.of(15, 30))
// if (now.isAfter(LocalTime.of(15, 30)) ) {
// executeClosingLiquidation(tradeService)
// return@withTimeout
// }
if (now.isAfter(LocalTime.of(15, 0)) ) {
executeClosingLiquidation(tradeService)
return@withTimeout
}
val balance = tradeService.fetchIntegratedBalance().getOrNull()
val myCash = balance?.deposit?.replace(",", "")?.toLongOrNull() ?: 0L
@@ -137,10 +137,10 @@ object AutoTradingManager {
println("⏳ [Cycle Timeout] 사이클이 너무 길어져 초기화 후 재시작합니다.")
} catch (e: Exception) {
println("⚠️ [Loop Error] ${e.message}")
delay(10000)
delay(5000)
}
waitForNextCycle(3)
waitForNextCycle(1)
}
}
}