...
This commit is contained in:
parent
83d671bece
commit
d26eb34f1d
@ -398,6 +398,11 @@ object AutoTradingManager {
|
||||
// 1. 기존 Watchdog이 있다면 제거 후 새로 시작
|
||||
watchdogJob?.cancel()
|
||||
watchdogJob = scope.launch {
|
||||
val activeTrades = DatabaseFactory.findAllMonitoringTrades()
|
||||
var now = LocalTime.now(ZoneId.of("Asia/Seoul"))
|
||||
if (activeTrades.isNotEmpty() && KisSession.isAvailBuyTime(now) == false) {
|
||||
executeClosingLiquidation(activeTrades)
|
||||
}
|
||||
while (isActive) {
|
||||
delay(WATCHDOG_CHECK_INTERVAL)
|
||||
val now = System.currentTimeMillis()
|
||||
@ -770,7 +775,7 @@ object AutoTradingManager {
|
||||
withTimeout(CYCLE_TIMEOUT) {
|
||||
println("⏱️ [Cycle Start] ${LocalTime.now()}")
|
||||
val activeTrades = DatabaseFactory.findAllMonitoringTrades()
|
||||
if (now.isAfter(LocalTime.of(15, 30)) && activeTrades.isNotEmpty()) {
|
||||
if (now.isAfter(KisSession.endBuyTime()) && activeTrades.isNotEmpty()) {
|
||||
executeClosingLiquidation(activeTrades)
|
||||
} else {
|
||||
executeMarketLoop()
|
||||
@ -817,7 +822,7 @@ object AutoTradingManager {
|
||||
}
|
||||
}
|
||||
var loadedTops = mutableListOf<Pair<String, String>>()
|
||||
var defaultStockCount = 150
|
||||
var defaultStockCount = 100
|
||||
fun poll100Stocks(): List<Pair<String, String>> {
|
||||
loadedTops.shuffle()
|
||||
val count = minOf(loadedTops.size, defaultStockCount)
|
||||
@ -1073,6 +1078,9 @@ object AutoTradingManager {
|
||||
print("-> 기업명을 못찾아서 제외 | ")
|
||||
return@withTimeout
|
||||
}
|
||||
if(currentBalance?.getHoldings()?.any { it.code.equals(stock.code) && it.quantity.toInt() > 2} == true) {
|
||||
println("물타기 대상 분석")
|
||||
}
|
||||
callback(TradingDecision().apply {
|
||||
this.stockCode = stock.code
|
||||
this.confidence = -1.0
|
||||
@ -1183,7 +1191,7 @@ object AutoTradingManager {
|
||||
} catch (e: Exception) {
|
||||
println("⚠️ [마감 에러] ${trade.name}: ${e.message}")
|
||||
}
|
||||
delay(200)
|
||||
delay(5)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user