This commit is contained in:
2026-06-02 10:43:37 +09:00
parent 558a39e2d3
commit d0bdc57a1e
2 changed files with 12 additions and 6 deletions
@@ -836,7 +836,9 @@ object AutoTradingManager {
suspend fun checkBalance(isMorning: Boolean = true) {
if (isMorning) {
currentBalance = KisTradeService.fetchIntegratedBalance().getOrNull()
KisTradeService.fetchIntegratedBalance().getOrNull()?.let {
currentBalance = it
}
if (KisSession.config.take_profit) currentBalance?.let { resumePendingSellOrders(KisTradeService, it) }
if (KisSession.tradeConfig.auto_cancel_pending_buy) { checkAndCancelPendingBuyOrders() }
} else {
@@ -906,7 +908,7 @@ object AutoTradingManager {
suspend fun executeMarketLoop() {
checkBalance()
val myCash = currentBalance?.deposit?.replace(",", "")?.toLongOrNull() ?: 0L
val myCash = currentBalance?.deposit?.replace(",", "")?.toLongOrNull() ?: KisSession.config.getValues(ConfigIndex.MAX_PRICE_INDEX).toLong()
val myHoldings = currentBalance?.getHoldings()?.filter { !it.isTodayEntry }?.map { it.code }?.toSet() ?: emptySet()
val pendingStocks = DatabaseFactory.findAllMonitoringTrades().map { it.code }
@@ -1086,7 +1088,7 @@ object AutoTradingManager {
}
val currentPrice = today.stck_prpr.toDouble()
if (currentPrice > myCash || currentPrice > maxBudget || currentPrice > maxPrice || currentPrice < minPrice) {
if ((myCash > 10L && currentPrice > myCash) || currentPrice > maxBudget || currentPrice > maxPrice || currentPrice < minPrice) {
print("-> 가격 정책으로 제외 [1주:${currentPrice}, 자산:${myCash}, 최소 기준:${minPrice}, 최대 기준:${maxPrice}] | ")
return@withTimeout
}