From df124612ab00f2a280b9b312a5c983ab254fdc18 Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Fri, 13 Feb 2026 15:40:20 +0900 Subject: [PATCH] .... --- src/main/kotlin/model/AppConfig.kt | 2 +- src/main/kotlin/service/AutoTradingManager.kt | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/model/AppConfig.kt b/src/main/kotlin/model/AppConfig.kt index 285a0bf..d60a86c 100644 --- a/src/main/kotlin/model/AppConfig.kt +++ b/src/main/kotlin/model/AppConfig.kt @@ -7,7 +7,7 @@ const val minimumNetProfit = 0.8 const val buyWeight = 2.0 val MAX_BUDGET = 80000.0 val MAX_PRICE = 40000 -val MIN_PRICE = 1000 +val MIN_PRICE = 800 val MIN_PURCHASE_SCORE = 65.0 data class AppConfig( // [DB 저장 데이터] diff --git a/src/main/kotlin/service/AutoTradingManager.kt b/src/main/kotlin/service/AutoTradingManager.kt index fb550aa..81e9984 100644 --- a/src/main/kotlin/service/AutoTradingManager.kt +++ b/src/main/kotlin/service/AutoTradingManager.kt @@ -14,6 +14,7 @@ import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import kotlinx.coroutines.withTimeout import model.CandleData +import model.MAX_BUDGET import model.MAX_PRICE import model.MIN_PRICE import model.RankingStock @@ -109,6 +110,7 @@ object AutoTradingManager { if (reanalysisList.isNotEmpty()) { candidates.addAll(reanalysisList) } + reanalysisList.clear() remainingCandidates.addAll(candidates.filter { it.code !in myHoldings && it.code !in pendingStocks }.distinctBy { it.code }) } else { println("미확인 데이터 ${remainingCandidates.size}") @@ -134,7 +136,7 @@ object AutoTradingManager { iterator.remove() } println("남은 후보군 개수 : ${totalCount}") - delay(300) + delay(150) } println("⏱️ [Cycle End] ${LocalTime.now()}") @@ -166,6 +168,7 @@ object AutoTradingManager { withTimeout(120000L) { val corpInfo = DartCodeManager.getCorpCode(stock.code) if (corpInfo?.cName.isNullOrEmpty()) { + print("-> 기업명을 못찾아서 제외 | ") return@withTimeout } callback(TradingDecision().apply { @@ -175,10 +178,15 @@ object AutoTradingManager { }, false) val dailyData = tradeService.fetchPeriodChartData(stock.code, "D", true).getOrNull() ?: return@withTimeout - val today = dailyData.lastOrNull() ?: return@withTimeout + val today = dailyData.lastOrNull() ?: null + if (today == null) { + print("-> 금일 금액 조회 실패 | ") + return@withTimeout + } val currentPrice = today.stck_prpr.toDouble() - if (currentPrice > myCash || currentPrice > MAX_PRICE || currentPrice < MIN_PRICE) { + if (currentPrice > myCash || currentPrice > MAX_BUDGET || currentPrice > MAX_PRICE || currentPrice < MIN_PRICE) { + print("-> 가격 정책으로 제외 [1주:${currentPrice}, 자산:${myCash}, 최소 기준:${MIN_PRICE}, 최대 기준:${MAX_PRICE}] | ") return@withTimeout }