This commit is contained in:
2026-05-20 17:18:15 +09:00
parent ce63b5760a
commit e94869b9e7
3 changed files with 42 additions and 24 deletions
+12 -7
View File
@@ -347,7 +347,7 @@ object AutoTradingManager {
TradingReportManager.updateExecution(orderNo, actualSellPrice, actualSellQty)
println("🎊 [매칭 성공] 매도 완료: ${dbItem.name} | 매도가: ${actualSellPrice.toInt()}")
TradingLogStore.addSellLog(dbItem.name,actualSellPrice.toString(),"SELL","매도 완료")
myOredsAndBalanceCodes.remove(dbItem.code)
TradingReportManager.closePositionCycle(dbItem.code) // 사이클 종료 알림
@@ -532,6 +532,8 @@ object AutoTradingManager {
)
}
} else {
var errMsg = ""
var isSuccess = false
if (KisSession.tradeConfig.autoSellOrder
&& holding != null && holding.quantity.toInt() > 0
&& holding.availOrderCount.toInt() > 0
@@ -546,15 +548,17 @@ object AutoTradingManager {
price = targetPrice.toInt().toString(),
isBuy = false,
).onSuccess { newOrderNo ->
println("✅ [보유 주식 손절 처리] 매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문")
println("✅ [보유 주식 손절 처리] ${holding.name} 매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문")
isSuccess = true
}.onFailure { err->
println("✅ [보유 주식 손절 처리] 실패 ${err.message}")
println("✅ [보유 주식 손절 처리] ${holding.name} 실패 ${targetPrice} ${err.message}")
errMsg = err.message.toString()
}
TradingLogStore.addNotice(
"보유주식[${holding.name}]",
holding.code,
"매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문"
"매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문 ${if (isSuccess) "성공" else "실패[${errMsg}]"}"
)
} else if (KisSession.config.stop_Loss
&& holding != null && holding.quantity.toInt() > 0
@@ -785,7 +789,8 @@ object AutoTradingManager {
var loadedTops = mutableListOf<Pair<String, String>>()
fun poll100Stocks(): List<Pair<String, String>> {
val count = minOf(loadedTops.size, 150)
loadedTops.shuffle()
val count = minOf(loadedTops.size, 200)
if (count == 0) return emptyList()
// 앞의 100개를 복사
@@ -881,7 +886,7 @@ object AutoTradingManager {
}
if (remainingCandidates.isEmpty()) {
if (loadedTops.size < 100) {
if (loadedTops.size < 200) {
loadedTops.addAll(StockUniverseLoader.loadUniverse())
loadedTops.shuffle()
println("✅ 총 ${loadedTops.size}개의 종목이 로드되있음.")
@@ -966,7 +971,7 @@ object AutoTradingManager {
}
}
isExecuted = true
} else if (now.hour == 9) {
} else if (now.hour == 9 && now.minute % KisSession.tradeConfig.excuteMinCheck == 0) {
TradingLogStore.addAnalyzer(
" - ",
" - ",