...
This commit is contained in:
@@ -365,7 +365,7 @@ object AutoTradingManager {
|
||||
runDiscoveryLoop(globalCallback)
|
||||
}
|
||||
|
||||
suspend fun sellingAfterMarketOnePrice(tradeService: KisTradeService,balance : UnifiedBalance) {
|
||||
suspend fun sellingAfterMarketOnePrice(tradeService: KisTradeService,balance : UnifiedBalance,marketCode : String = "Y") {
|
||||
println("sellingAfterMarketOnePrice")
|
||||
balance.holdings.forEach { holding ->
|
||||
if (BLACKLISTEDSTOCKCODES.contains(holding.code)){
|
||||
@@ -377,7 +377,7 @@ object AutoTradingManager {
|
||||
)
|
||||
} else {
|
||||
println("${holding.name} - 매수 : ${holding.avgPrice} - 현재 : ${holding.currentPrice} , 주문 가능 : ${holding.availOrderCount}, 수익율 : ${holding.profitRate}")
|
||||
if (holding != null && holding.quantity.toInt() > 0 && holding.availOrderCount.toInt() > 0 && holding.profitRate.toDouble() > 0.5) {
|
||||
if (holding != null && holding.quantity.toInt() > 0 && holding.availOrderCount.toInt() > 0 && holding.profitRate.toDouble() > KisSession.config.SELL_PROFIT) {
|
||||
println("${holding.name} - 매수 : ${holding.avgPrice} - 현재 : ${holding.currentPrice} ")
|
||||
var targetPrice = holding.currentPrice.toDouble()
|
||||
targetPrice = MarketUtil.roundToTickSize(targetPrice)
|
||||
@@ -386,7 +386,8 @@ object AutoTradingManager {
|
||||
qty = holding.availOrderCount,
|
||||
price = targetPrice.toInt().toString(),
|
||||
isBuy = false,
|
||||
"34"
|
||||
orderDivision = if (marketCode.equals("Y")) "07" else "",
|
||||
marketCode = if (marketCode.equals("Y")) "KRX" else "SOR"
|
||||
).onSuccess { newOrderNo ->
|
||||
println("✅ [재주문 완료] ${holding.name}: $newOrderNo")
|
||||
TradingLogStore.addSellLog(
|
||||
@@ -612,13 +613,20 @@ object AutoTradingManager {
|
||||
}
|
||||
|
||||
suspend fun checkBalance(isMorning: Boolean = true) : UnifiedBalance? {
|
||||
val balance = KisTradeService.fetchIntegratedBalance().getOrNull()
|
||||
var balance : UnifiedBalance? = null
|
||||
if (isMorning) {
|
||||
balance = KisTradeService.fetchIntegratedBalance().getOrNull()
|
||||
if (AUTOSELL) balance?.let { resumePendingSellOrders(KisTradeService, it) }
|
||||
return balance
|
||||
} else {
|
||||
balance?.let { sellingAfterMarketOnePrice(KisTradeService, it) }
|
||||
// listOf<String>("Y","X").forEach { code ->
|
||||
// KisTradeService.fetchIntegratedBalance(code).getOrNull()?.let {
|
||||
// sellingAfterMarketOnePrice(KisTradeService, it, code)
|
||||
// }
|
||||
// delay(1000)
|
||||
// }
|
||||
}
|
||||
return balance
|
||||
return null
|
||||
}
|
||||
|
||||
suspend fun executeMarketLoop() {
|
||||
@@ -702,7 +710,7 @@ object AutoTradingManager {
|
||||
lastForceCheckMinute = currentMinute // 실행 완료 기록
|
||||
}
|
||||
}
|
||||
else if((now.hour == 16 || now.hour == 17) && (currentMinute == 5 || currentMinute == 55)) {
|
||||
else if((now.hour == 16 || now.hour == 17) && (currentMinute == 31 || currentMinute == 36)) {
|
||||
if (lastForceCheckMinute != currentMinute) {
|
||||
TradingLogStore.addAnalyzer(
|
||||
" - ",
|
||||
|
||||
Reference in New Issue
Block a user