...
This commit is contained in:
parent
d0bdc57a1e
commit
9d43c04670
@ -261,6 +261,9 @@ class TradeConfig {
|
|||||||
var lowerAverageMaxRate : Double = 15.0
|
var lowerAverageMaxRate : Double = 15.0
|
||||||
var lowerAverageMinRate : Double = 25.0
|
var lowerAverageMinRate : Double = 25.0
|
||||||
var lowerAverageTargetCount : Int = 2
|
var lowerAverageTargetCount : Int = 2
|
||||||
|
var autoSellOrderMin : Double = -15.0
|
||||||
|
var autoSellOrderMax : Double = -29.0
|
||||||
|
var autoSellOrderAppend : Int = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,7 @@ object KisTradeService {
|
|||||||
} else 0.0
|
} else 0.0
|
||||||
|
|
||||||
// 3. 모델 생성
|
// 3. 모델 생성
|
||||||
|
if (combinedHoldings.isNotEmpty()) {
|
||||||
Result.success(UnifiedBalance(
|
Result.success(UnifiedBalance(
|
||||||
totalAsset = String.format("%,d", (domSummary?.tot_evlu_amt?.toLongOrNull() ?: 0L)),
|
totalAsset = String.format("%,d", (domSummary?.tot_evlu_amt?.toLongOrNull() ?: 0L)),
|
||||||
deposit = String.format("%,d", domSummary?.dnca_tot_amt?.toLongOrNull() ?: 0L),
|
deposit = String.format("%,d", domSummary?.dnca_tot_amt?.toLongOrNull() ?: 0L),
|
||||||
@ -130,7 +131,9 @@ object KisTradeService {
|
|||||||
totalProfitRate = String.format("%.2f%%", calculatedTotalRate), // 계산된 값 전달
|
totalProfitRate = String.format("%.2f%%", calculatedTotalRate), // 계산된 값 전달
|
||||||
holdings = combinedHoldings
|
holdings = combinedHoldings
|
||||||
))
|
))
|
||||||
|
} else {
|
||||||
|
Result.failure(Exception("combinedHoldings empty"))
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Result.failure(e)
|
Result.failure(e)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -568,11 +568,11 @@ object AutoTradingManager {
|
|||||||
if (KisSession.tradeConfig.autoSellOrder
|
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() <= -15.0
|
&& holding.profitRate.toDouble() <= KisSession.tradeConfig.autoSellOrderMin
|
||||||
&& holding.profitRate.toDouble() >= -29.0
|
&& holding.profitRate.toDouble() >= KisSession.tradeConfig.autoSellOrderMax
|
||||||
&& holding.avgPrice.toDouble() > holding.currentPrice.toDouble()) {
|
&& holding.avgPrice.toDouble() > holding.currentPrice.toDouble()) {
|
||||||
var targetPrice = holding.avgPrice.toDouble()
|
var targetPrice = holding.avgPrice.toDouble()
|
||||||
targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * 3.0)
|
targetPrice = MarketUtil.roundToTickSize(targetPrice + MarketUtil.getTickSize(targetPrice) * KisSession.tradeConfig.autoSellOrderAppend)
|
||||||
tradeService.postOrder(
|
tradeService.postOrder(
|
||||||
stockCode = holding.code,
|
stockCode = holding.code,
|
||||||
qty = holding.availOrderCount,
|
qty = holding.availOrderCount,
|
||||||
|
|||||||
@ -643,6 +643,44 @@ fun TradingDecisionLog() {
|
|||||||
helperText = "1만큼 사고 팜"
|
helperText = "1만큼 사고 팜"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
SettingSwitchField(
|
||||||
|
label = "아침 자동 매도 주문",
|
||||||
|
initialChecked = tradeConfig.autoSellOrder,
|
||||||
|
onCheckedChange = { tradeConfig.autoSellOrder = it
|
||||||
|
KisSession.saveTradeConfig() }
|
||||||
|
)
|
||||||
|
Row(horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||||
|
SettingInputField(
|
||||||
|
modifier = Modifier.weight(1.0f, true),
|
||||||
|
label = "자동 매도 기준 최저가",
|
||||||
|
initialValue = (tradeConfig.autoSellOrderMin).toString(),
|
||||||
|
onSave = {
|
||||||
|
tradeConfig.autoSellOrderMin = it.toDouble()
|
||||||
|
KisSession.saveTradeConfig()
|
||||||
|
},
|
||||||
|
helperText = "이것보다 작아야 주문"
|
||||||
|
)
|
||||||
|
SettingInputField(
|
||||||
|
modifier = Modifier.weight(1.0f, true),
|
||||||
|
label = "자동 매도 기준 최고가",
|
||||||
|
initialValue = (tradeConfig.autoSellOrderMax).toString(),
|
||||||
|
onSave = {
|
||||||
|
tradeConfig.autoSellOrderMax = it.toDouble()
|
||||||
|
KisSession.saveTradeConfig()
|
||||||
|
},
|
||||||
|
helperText = "이것보다 커야 주문"
|
||||||
|
)
|
||||||
|
SettingInputField(
|
||||||
|
modifier = Modifier.weight(1.0f, true),
|
||||||
|
label = "매입가 기준 호가위로 주문",
|
||||||
|
initialValue = (tradeConfig.autoSellOrderAppend).toString(),
|
||||||
|
onSave = {
|
||||||
|
tradeConfig.autoSellOrderAppend = it.toInt()
|
||||||
|
KisSession.saveTradeConfig()
|
||||||
|
},
|
||||||
|
helperText = "위의 수치 만큼 호가 위로 주문함."
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user