...
This commit is contained in:
@@ -529,7 +529,7 @@ object AutoTradingManager {
|
||||
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))
|
||||
targetPrice = MarketUtil.roundToTickSize(targetPrice + (MarketUtil.getTickSize(targetPrice) * 3.0))
|
||||
|
||||
tradeService.postOrder(
|
||||
stockCode = holding.code,
|
||||
@@ -814,6 +814,21 @@ object AutoTradingManager {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun cancelAllPendingSellOrders(
|
||||
) {
|
||||
// 1. 미체결 내역 조회
|
||||
val unfilledResult = KisTradeService.fetchUnfilledOrders()
|
||||
unfilledResult.onSuccess { response ->
|
||||
response.filter { it.sll_buy_dvsn_cd == "01" }.forEach { order ->
|
||||
TradingLogStore.addNotice(order.prdt_name,order.pdno,"[주문 취소] 정규장 시작전 모든 매도 주문 취소")
|
||||
KisTradeService.cancelOrder(
|
||||
order.ord_no, // 원주문번호
|
||||
order.pdno
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 주문 시간 문자열을 Millis로 변환하는 유틸리티 (당일 주문 기준)
|
||||
fun parseOrderTime(ordTmd: String): Long {
|
||||
return try {
|
||||
@@ -908,8 +923,14 @@ object AutoTradingManager {
|
||||
} else {
|
||||
val now = LocalTime.now()
|
||||
val currentMinute = now.minute
|
||||
if (now.hour == 9 && currentMinute % 2 == 1
|
||||
) {
|
||||
if (now.hour == 8 && currentMinute < 50 && currentMinute > 45) {
|
||||
if (lastForceCheckMinute != currentMinute) {
|
||||
cancelAllPendingSellOrders()
|
||||
}
|
||||
} else if (now.hour == 8 && currentMinute > 55 && currentMinute > 50) {
|
||||
|
||||
} else if (now.hour == 9 && currentMinute % 2 == 1
|
||||
) {
|
||||
if (lastForceCheckMinute != currentMinute) {
|
||||
TradingLogStore.addAnalyzer(
|
||||
" - ",
|
||||
|
||||
Reference in New Issue
Block a user