This commit is contained in:
lunaticbum 2026-06-04 11:37:08 +09:00
parent 4a72a30ab6
commit 355db7fe20
2 changed files with 3 additions and 3 deletions

View File

@ -313,7 +313,7 @@ fun main() = application {
AutoTradingManager.isSystemCleanedUpToday = false
CoroutineScope(Dispatchers.Default).launch {
AutoTradingManager.startAutoDiscoveryLoop()
AutoTradingManager.startAutoDiscoveryLoop(true)
KisWebSocketManager.onExecutionReceived = AutoTradingManager.onExecutionReceived
KisWebSocketManager.connect()
}

View File

@ -403,7 +403,7 @@ object AutoTradingManager {
/**
* 자동 발굴 루프 시작 Watchdog 실행
*/
fun startAutoDiscoveryLoop() {
fun startAutoDiscoveryLoop(doStart : Boolean = false) {
if (isRunning()) return
// 1. 기존 Watchdog이 있다면 제거 후 새로 시작
@ -411,7 +411,7 @@ object AutoTradingManager {
watchdogJob = scope.launch {
val activeTrades = DatabaseFactory.findAllMonitoringTrades()
var now = LocalTime.now(ZoneId.of("Asia/Seoul"))
if (activeTrades.isNotEmpty()) {
if (doStart && activeTrades.isNotEmpty() && !KisSession.isAvailBuyTime(now)) {
executeClosingLiquidation(activeTrades)
}
while (isActive) {