This commit is contained in:
2026-04-09 17:03:52 +09:00
parent dec19983af
commit 7d03cc78b1
5 changed files with 28 additions and 13 deletions
+15 -5
View File
@@ -359,8 +359,14 @@ object AutoTradingManager {
"거랙 차단 대상 : ${holding.currentPrice}[${holding.quantity}주] 보유, 수익률(${holding.profitRate.toDouble()})"
)
} else {
println("sellingAfterMarketOnePrice")
if (holding != null && holding.quantity.toInt() > 0 && holding.availOrderCount.toInt() > 0 && holding.profitRate.toDouble() > KisSession.config.SELL_PROFIT) {
val targetProfitLimit = if (holding.isTodayEntry) {
// 당일 매수 종목: 짧은 익절 (예: 1.0% 이상이면 즉시 매도)
KisSession.config.getValues(ConfigIndex.PROFIT_INDEX)+ KisSession.config.getValues(ConfigIndex.TAX_INDEX)
} else {
// 오래 보유한 종목: 기존 설정값 준수 (예: 3.0% 등)
KisSession.config.SELL_PROFIT
}
if (holding != null && holding.quantity.toInt() > 0 && holding.availOrderCount.toInt() > 0 && holding.profitRate.toDouble() > targetProfitLimit) {
var targetPrice = holding.currentPrice.toDouble()
TradingLogStore.addAfterMarketLog(
holding.name,
@@ -376,7 +382,7 @@ object AutoTradingManager {
orderDivision = if (marketCode.equals("Y")) "07" else "",
marketCode = if (marketCode.equals("Y")) "KRX" else "NXT"
).onSuccess { newOrderNo ->
println("✅ [주문 완료] ${holding.name}: $newOrderNo")
println("✅ [${if(marketCode.equals("Y"))"시간외 단일가" else "대체거래소"} 주문 완료] ${holding.name}: $newOrderNo")
TradingLogStore.addSellLog(
"${holding.name}[${holding.code}]",
targetPrice.toString(),
@@ -760,7 +766,7 @@ object AutoTradingManager {
lastForceCheckMinute = currentMinute // 실행 완료 기록
}
}
else if((now.hour == 8 || now.hour == 16 || now.hour == 17) && (currentMinute % 10 == 3)) {
else if((now.hour == 8 || now.hour == 16 || now.hour == 17) && (currentMinute % 10 == 1) || (currentMinute % 10 == 6)) {
if (lastForceCheckMinute != currentMinute) {
TradingLogStore.addAnalyzer(
" - ",
@@ -768,7 +774,11 @@ object AutoTradingManager {
"⏰ [강제 스케줄 실행] 오후 ${now.hour}${currentMinute}분 - 보유주식 시간외 단일가 또는 대체마켓 체크를 시작합니다.",
true
)
listOf<String>("Y","X").forEach { code ->
var list = mutableListOf<String>("x")
if (now.hour != 8) {
list.add("y")
}
list.forEach { code ->
KisTradeService.fetchIntegratedBalance(code).getOrNull()?.let {
sellingAfterMarketOnePrice(KisTradeService, it, code)
}