...
This commit is contained in:
parent
9af9f46748
commit
ce63b5760a
@ -6,6 +6,7 @@ import Defines.BLACKLISTEDSTOCKCODES
|
||||
import Defines.EMBEDDING_PORT
|
||||
import Defines.LLM_PORT
|
||||
import TradingLogStore
|
||||
import TradingLogStore.noticeFilter
|
||||
import analyzer.AdvancedTradeAssistant
|
||||
import analyzer.TechnicalAnalyzer
|
||||
import androidx.compose.runtime.getValue
|
||||
@ -531,7 +532,31 @@ object AutoTradingManager {
|
||||
)
|
||||
}
|
||||
} 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.availOrderCount.toInt() > 0
|
||||
&& 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)) {
|
||||
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()
|
||||
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)
|
||||
|
||||
|
||||
@ -970,7 +995,10 @@ object AutoTradingManager {
|
||||
isExecuted = true
|
||||
}
|
||||
if (isExecuted) { executionCountMap[timeKey] = currentCount + 1 }
|
||||
if (now.hour >= 20) { executionCountMap.clear() }
|
||||
if (now.hour >= 20) {
|
||||
executionCountMap.clear()
|
||||
noticeFilter.clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -11378,5 +11378,21 @@
|
||||
{
|
||||
"code": "408470",
|
||||
"name": "한패스"
|
||||
},
|
||||
{
|
||||
"code": "403810",
|
||||
"name": "아이엘로보틱스"
|
||||
},
|
||||
{
|
||||
"code": "059180",
|
||||
"name": "엔더블유시"
|
||||
},
|
||||
{
|
||||
"code": "950250",
|
||||
"name": "테라뷰"
|
||||
},
|
||||
{
|
||||
"code": "288180",
|
||||
"name": "케이피항공산업"
|
||||
}
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user