This commit is contained in:
2026-06-01 17:55:10 +09:00
parent 510e19b2e8
commit 558a39e2d3
2 changed files with 31 additions and 8 deletions
@@ -818,10 +818,10 @@ object AutoTradingManager {
}
}
var loadedTops = mutableListOf<Pair<String, String>>()
var defaultStockCount = 200
fun poll100Stocks(): List<Pair<String, String>> {
loadedTops.shuffle()
val count = minOf(loadedTops.size, 200)
val count = minOf(loadedTops.size, defaultStockCount)
if (count == 0) return emptyList()
// 앞의 100개를 복사
@@ -911,7 +911,7 @@ object AutoTradingManager {
val pendingStocks = DatabaseFactory.findAllMonitoringTrades().map { it.code }
if (remainingCandidates.isEmpty()) {
if (loadedTops.size < 200) {
if (loadedTops.size < defaultStockCount) {
loadedTops.addAll(StockUniverseLoader.loadUniverse())
loadedTops.shuffle()
println("✅ 총 ${loadedTops.size}개의 종목이 로드되있음.")
@@ -941,16 +941,17 @@ object AutoTradingManager {
reanalysisList.clear()
if (KisSession.tradeConfig.lowerAveragePrice) {
currentBalance?.getHoldings()?.map {
if(!it.isTodayEntry &&
if(
it.quantity.toInt() > KisSession.tradeConfig.lowerAverageTargetCount &&
it.profitRate.toDouble() < (KisSession.tradeConfig.lowerAverageMaxRate * -1) &&
it.profitRate.toDouble() > (KisSession.tradeConfig.lowerAverageMinRate * -1) ) {
remainingCandidates.add(RankingStock(mksc_shrn_iscd = it.code, hts_kor_isnm = it.name))
it.profitRate.toDouble() > (KisSession.tradeConfig.lowerAverageMinRate * -1) )
{
candidates.add(RankingStock(mksc_shrn_iscd = it.code, hts_kor_isnm = it.name))
}
}
}
remainingCandidates.addAll(candidates.filter {
if (KisSession.tradeConfig.lowerAveragePrice) { true } else {it.code !in myHoldings} &&
(if (KisSession.tradeConfig.lowerAveragePrice) { true } else {it.code !in myHoldings}) &&
it.code !in pendingStocks &&
it.code !in executionCache.values.map { it.code } &&
it.code !in failList &&