This commit is contained in:
2026-08-03 16:17:53 +09:00
parent acd26abe1e
commit 3fdb298caa
2 changed files with 7 additions and 4 deletions
+2 -2
View File
@@ -128,9 +128,9 @@ data class RankingStock(
val mrkt_div_cls_code : String = "J", val mrkt_div_cls_code : String = "J",
) { ) {
val name : String val name : String
get() = listOf(hts_kor_isnm , hts_kor_alph_nm , mkrtc_objt_iscd).firstOrNull { it.isNotBlank() } ?: "" get() = listOf(hts_kor_isnm , hts_kor_alph_nm).firstOrNull { it.isNotBlank() } ?: ""
val code : String val code : String
get() = listOf(mksc_shrn_iscd , mkrtc_objt_iscd , stck_shrn_iscd , hts_kor_isnm).firstOrNull { it.isNotBlank() } ?: "" get() = listOf(mksc_shrn_iscd , mkrtc_objt_iscd , stck_shrn_iscd).firstOrNull { it.isNotBlank() } ?: ""
} }
@Serializable @Serializable
data class OverseasRankingResponse( data class OverseasRankingResponse(
@@ -1146,14 +1146,17 @@ object AutoTradingManager {
val dailyData = val dailyData =
tradeService.fetchPeriodChartData(stock.code, "D", true).getOrNull() ?: return@withTimeout tradeService.fetchPeriodChartData(stock.code, "D", true).getOrNull() ?: return@withTimeout
val today = dailyData.lastOrNull() ?: null val today = dailyData.lastOrNull() ?: null
var rate = today?.getFluctuationRate() ?: 0.0
val isOk = ((rate < KisSession.tradeConfig.plusFilter) && (rate > (abs(KisSession.tradeConfig.minusFilter) * -1)))
println("${stock.name}[${stock.code}] 변동률 : ${rate} , 거래 기준 : ${isOk}")
if (today == null) { if (today == null) {
failList.add(stock.code) failList.add(stock.code)
print("-> 금일 금액 조회 실패 | ") print("-> 금일 금액 조회 실패 | ${isOk}")
return@withTimeout return@withTimeout
} }
val currentPrice = today.stck_prpr.toDouble() val currentPrice = today.stck_prpr.toDouble()
if ((myCash > 10L && currentPrice > myCash) || currentPrice > maxBudget || currentPrice > maxPrice || currentPrice < minPrice) { if (!isOk || (myCash > 10L && currentPrice > myCash) || currentPrice > maxBudget || currentPrice > maxPrice || currentPrice < minPrice) {
print("-> [${stock.name}] 가격 정책으로 제외 [1주:${currentPrice}, 자산:${myCash}, 최소 기준:${minPrice}, 최대 기준:${maxPrice}] | ") print("-> [${stock.name}] 가격 정책으로 제외 [1주:${currentPrice}, 자산:${myCash}, 최소 기준:${minPrice}, 최대 기준:${maxPrice}] | ")
return@withTimeout return@withTimeout
} }