...
This commit is contained in:
parent
6f98b0fde4
commit
619407966e
@ -528,15 +528,20 @@ 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 = holding.currentPrice.toDouble()
|
||||||
|
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 = "0",
|
price = targetPrice.toInt().toString(),
|
||||||
isBuy = false,
|
isBuy = false,
|
||||||
).onSuccess { newOrderNo ->
|
).onSuccess { newOrderNo ->
|
||||||
println("✅ [보유 주식 손절 처리] 수익률($profit%) -> ${holding.valuationProfitAmount} 손해 중이며 현제 손절 가이드에 적합함 시장가 매도.")
|
println("✅ [보유 주식 손절 처리] 수익률($profit%) -> ${holding.valuationProfitAmount} 손해 중이며 현제 손절 가이드에 적합함 시장가 매도.")
|
||||||
}.onFailure {
|
}.onFailure { err->
|
||||||
|
println("✅ [보유 주식 손절 처리] 실패 ${err.message}")
|
||||||
}
|
}
|
||||||
|
|
||||||
TradingLogStore.addNotice(
|
TradingLogStore.addNotice(
|
||||||
"보유주식[${holding.name}]",
|
"보유주식[${holding.name}]",
|
||||||
holding.code,
|
holding.code,
|
||||||
@ -767,9 +772,7 @@ object AutoTradingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (KisSession.config.take_profit) currentBalance?.let { resumePendingSellOrders(KisTradeService, it) }
|
if (KisSession.config.take_profit) currentBalance?.let { resumePendingSellOrders(KisTradeService, it) }
|
||||||
if (KisSession.tradeConfig.auto_cancel_pending_buy) {
|
if (KisSession.tradeConfig.auto_cancel_pending_buy) { checkAndCancelPendingBuyOrders() }
|
||||||
checkAndCancelPendingBuyOrders()
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user