....
This commit is contained in:
parent
904e3011c9
commit
df124612ab
@ -7,7 +7,7 @@ const val minimumNetProfit = 0.8
|
|||||||
const val buyWeight = 2.0
|
const val buyWeight = 2.0
|
||||||
val MAX_BUDGET = 80000.0
|
val MAX_BUDGET = 80000.0
|
||||||
val MAX_PRICE = 40000
|
val MAX_PRICE = 40000
|
||||||
val MIN_PRICE = 1000
|
val MIN_PRICE = 800
|
||||||
val MIN_PURCHASE_SCORE = 65.0
|
val MIN_PURCHASE_SCORE = 65.0
|
||||||
data class AppConfig(
|
data class AppConfig(
|
||||||
// [DB 저장 데이터]
|
// [DB 저장 데이터]
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import kotlinx.coroutines.isActive
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withTimeout
|
import kotlinx.coroutines.withTimeout
|
||||||
import model.CandleData
|
import model.CandleData
|
||||||
|
import model.MAX_BUDGET
|
||||||
import model.MAX_PRICE
|
import model.MAX_PRICE
|
||||||
import model.MIN_PRICE
|
import model.MIN_PRICE
|
||||||
import model.RankingStock
|
import model.RankingStock
|
||||||
@ -109,6 +110,7 @@ object AutoTradingManager {
|
|||||||
if (reanalysisList.isNotEmpty()) {
|
if (reanalysisList.isNotEmpty()) {
|
||||||
candidates.addAll(reanalysisList)
|
candidates.addAll(reanalysisList)
|
||||||
}
|
}
|
||||||
|
reanalysisList.clear()
|
||||||
remainingCandidates.addAll(candidates.filter { it.code !in myHoldings && it.code !in pendingStocks }.distinctBy { it.code })
|
remainingCandidates.addAll(candidates.filter { it.code !in myHoldings && it.code !in pendingStocks }.distinctBy { it.code })
|
||||||
} else {
|
} else {
|
||||||
println("미확인 데이터 ${remainingCandidates.size}")
|
println("미확인 데이터 ${remainingCandidates.size}")
|
||||||
@ -134,7 +136,7 @@ object AutoTradingManager {
|
|||||||
iterator.remove()
|
iterator.remove()
|
||||||
}
|
}
|
||||||
println("남은 후보군 개수 : ${totalCount}")
|
println("남은 후보군 개수 : ${totalCount}")
|
||||||
delay(300)
|
delay(150)
|
||||||
}
|
}
|
||||||
|
|
||||||
println("⏱️ [Cycle End] ${LocalTime.now()}")
|
println("⏱️ [Cycle End] ${LocalTime.now()}")
|
||||||
@ -166,6 +168,7 @@ object AutoTradingManager {
|
|||||||
withTimeout(120000L) {
|
withTimeout(120000L) {
|
||||||
val corpInfo = DartCodeManager.getCorpCode(stock.code)
|
val corpInfo = DartCodeManager.getCorpCode(stock.code)
|
||||||
if (corpInfo?.cName.isNullOrEmpty()) {
|
if (corpInfo?.cName.isNullOrEmpty()) {
|
||||||
|
print("-> 기업명을 못찾아서 제외 | ")
|
||||||
return@withTimeout
|
return@withTimeout
|
||||||
}
|
}
|
||||||
callback(TradingDecision().apply {
|
callback(TradingDecision().apply {
|
||||||
@ -175,10 +178,15 @@ object AutoTradingManager {
|
|||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
val dailyData = tradeService.fetchPeriodChartData(stock.code, "D", true).getOrNull() ?: return@withTimeout
|
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()
|
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
|
return@withTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user