...
This commit is contained in:
parent
9af9f46748
commit
ce63b5760a
@ -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,25 +532,21 @@ object AutoTradingManager {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (KisSession.config.stop_Loss
|
if (KisSession.tradeConfig.autoSellOrder
|
||||||
&& 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() <= -15.0
|
||||||
&& holding.profitRate.toDouble() >= KisSession.config.getValues(ConfigIndex.LOSS_MAXRATE)
|
&& holding.profitRate.toDouble() >= -29.0
|
||||||
&& holding.valuationProfitAmount.toDouble() >= KisSession.config.getValues(ConfigIndex.LOSS_MAX_MONEY)) {
|
&& holding.avgPrice.toDouble() > holding.currentPrice.toDouble()) {
|
||||||
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)}")
|
var targetPrice = holding.avgPrice.toDouble()
|
||||||
val profit = holding.profitRate.toDouble()
|
|
||||||
var targetPrice = if (KisSession.tradeConfig.autoSellOrder ) holding.avgPrice.toDouble() else holding.currentPrice.toDouble()
|
|
||||||
targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * 3.0)
|
targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * 3.0)
|
||||||
|
|
||||||
|
|
||||||
tradeService.postOrder(
|
tradeService.postOrder(
|
||||||
stockCode = holding.code,
|
stockCode = holding.code,
|
||||||
qty = holding.availOrderCount,
|
qty = holding.availOrderCount,
|
||||||
price = targetPrice.toInt().toString(),
|
price = targetPrice.toInt().toString(),
|
||||||
isBuy = false,
|
isBuy = false,
|
||||||
).onSuccess { newOrderNo ->
|
).onSuccess { newOrderNo ->
|
||||||
println("✅ [보유 주식 손절 처리] 수익률($profit%) -> ${holding.valuationProfitAmount} 손해 중이며 현제 손절 가이드에 적합함 시장가 매도.")
|
println("✅ [보유 주식 손절 처리] 매수가 기준 (${holding.avgPrice.toDouble()} 3호가 위[${targetPrice}] 매도 주문")
|
||||||
}.onFailure { err->
|
}.onFailure { err->
|
||||||
println("✅ [보유 주식 손절 처리] 실패 ${err.message}")
|
println("✅ [보유 주식 손절 처리] 실패 ${err.message}")
|
||||||
}
|
}
|
||||||
@ -557,9 +554,37 @@ object AutoTradingManager {
|
|||||||
TradingLogStore.addNotice(
|
TradingLogStore.addNotice(
|
||||||
"보유주식[${holding.name}]",
|
"보유주식[${holding.name}]",
|
||||||
holding.code,
|
holding.code,
|
||||||
"수익률($profit%) -> ${holding.valuationProfitAmount} 손해 중이며 현제 손절 가이드에 적합함 시장가 매도."
|
"매수가 기준 (${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)
|
||||||
|
&& holding.profitRate.toDouble() >= KisSession.config.getValues(ConfigIndex.LOSS_MAXRATE)
|
||||||
|
&& 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 = holding.currentPrice.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("✅ [보유 주식 손절 처리] 수익률($profit%) -> ${holding.valuationProfitAmount} 손해 중이며 현제 손절 가이드에 적합함 시장가 매도.")
|
||||||
|
}.onFailure { err->
|
||||||
|
println("✅ [보유 주식 손절 처리] 실패 ${err.message}")
|
||||||
|
}
|
||||||
|
|
||||||
|
TradingLogStore.addNotice(
|
||||||
|
"보유주식[${holding.name}]",
|
||||||
|
holding.code,
|
||||||
|
"수익률($profit%) -> ${holding.valuationProfitAmount} 손해 중이며 현제 손절 가이드에 적합함 시장가 매도."
|
||||||
|
)
|
||||||
|
}
|
||||||
analyzeDeepLossHoldingsAfterMarket(holding , true)
|
analyzeDeepLossHoldingsAfterMarket(holding , true)
|
||||||
}
|
}
|
||||||
delay(200) // API 호출 부하 방지
|
delay(200) // API 호출 부하 방지
|
||||||
@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11378,5 +11378,21 @@
|
|||||||
{
|
{
|
||||||
"code": "408470",
|
"code": "408470",
|
||||||
"name": "한패스"
|
"name": "한패스"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "403810",
|
||||||
|
"name": "아이엘로보틱스"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "059180",
|
||||||
|
"name": "엔더블유시"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "950250",
|
||||||
|
"name": "테라뷰"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "288180",
|
||||||
|
"name": "케이피항공산업"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Loading…
x
Reference in New Issue
Block a user