This commit is contained in:
lunaticbum 2026-05-19 13:33:59 +09:00
parent 9af9f46748
commit ce63b5760a
2 changed files with 57 additions and 13 deletions

View File

@ -6,6 +6,7 @@ import Defines.BLACKLISTEDSTOCKCODES
import Defines.EMBEDDING_PORT import Defines.EMBEDDING_PORT
import Defines.LLM_PORT import Defines.LLM_PORT
import TradingLogStore import TradingLogStore
import TradingLogStore.noticeFilter
import analyzer.AdvancedTradeAssistant import analyzer.AdvancedTradeAssistant
import analyzer.TechnicalAnalyzer import analyzer.TechnicalAnalyzer
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@ -531,7 +532,31 @@ object AutoTradingManager {
) )
} }
} else { } else {
if (KisSession.config.stop_Loss if (KisSession.tradeConfig.autoSellOrder
&& holding != null && holding.quantity.toInt() > 0
&& holding.availOrderCount.toInt() > 0
&& holding.profitRate.toDouble() <= -15.0
&& holding.profitRate.toDouble() >= -29.0
&& holding.avgPrice.toDouble() > holding.currentPrice.toDouble()) {
var targetPrice = holding.avgPrice.toDouble()
targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * 3.0)
tradeService.postOrder(
stockCode = holding.code,
qty = holding.availOrderCount,
price = targetPrice.toInt().toString(),
isBuy = false,
).onSuccess { newOrderNo ->
println("✅ [보유 주식 손절 처리] 매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문")
}.onFailure { err->
println("✅ [보유 주식 손절 처리] 실패 ${err.message}")
}
TradingLogStore.addNotice(
"보유주식[${holding.name}]",
holding.code,
"매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문"
)
} else if (KisSession.config.stop_Loss
&& holding != null && holding.quantity.toInt() > 0 && holding != null && holding.quantity.toInt() > 0
&& holding.availOrderCount.toInt() > 0 && holding.availOrderCount.toInt() > 0
&& holding.profitRate.toDouble() <= KisSession.config.getValues(ConfigIndex.LOSS_MINRATE) && holding.profitRate.toDouble() <= KisSession.config.getValues(ConfigIndex.LOSS_MINRATE)
@ -539,7 +564,7 @@ object AutoTradingManager {
&& holding.valuationProfitAmount.toDouble() >= KisSession.config.getValues(ConfigIndex.LOSS_MAX_MONEY)) { && holding.valuationProfitAmount.toDouble() >= KisSession.config.getValues(ConfigIndex.LOSS_MAX_MONEY)) {
println("${holding.name} ${holding.profitRate.toDouble()} ${holding.valuationProfitAmount.toDouble()} ${KisSession.config.getValues(ConfigIndex.LOSS_MAX_MONEY)} , ${KisSession.config.getValues(ConfigIndex.LOSS_MINRATE)} , ${KisSession.config.getValues(ConfigIndex.STOP_LOSS)}") println("${holding.name} ${holding.profitRate.toDouble()} ${holding.valuationProfitAmount.toDouble()} ${KisSession.config.getValues(ConfigIndex.LOSS_MAX_MONEY)} , ${KisSession.config.getValues(ConfigIndex.LOSS_MINRATE)} , ${KisSession.config.getValues(ConfigIndex.STOP_LOSS)}")
val profit = holding.profitRate.toDouble() val profit = holding.profitRate.toDouble()
var targetPrice = if (KisSession.tradeConfig.autoSellOrder ) holding.avgPrice.toDouble() else holding.currentPrice.toDouble() var targetPrice = holding.currentPrice.toDouble()
targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * 3.0) targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * 3.0)
@ -970,7 +995,10 @@ object AutoTradingManager {
isExecuted = true isExecuted = true
} }
if (isExecuted) { executionCountMap[timeKey] = currentCount + 1 } if (isExecuted) { executionCountMap[timeKey] = currentCount + 1 }
if (now.hour >= 20) { executionCountMap.clear() } if (now.hour >= 20) {
executionCountMap.clear()
noticeFilter.clear()
}
} }

View File

@ -11378,5 +11378,21 @@
{ {
"code": "408470", "code": "408470",
"name": "한패스" "name": "한패스"
},
{
"code": "403810",
"name": "아이엘로보틱스"
},
{
"code": "059180",
"name": "엔더블유시"
},
{
"code": "950250",
"name": "테라뷰"
},
{
"code": "288180",
"name": "케이피항공산업"
} }
] ]