...
This commit is contained in:
parent
4a72a30ab6
commit
355db7fe20
@ -313,7 +313,7 @@ fun main() = application {
|
|||||||
AutoTradingManager.isSystemCleanedUpToday = false
|
AutoTradingManager.isSystemCleanedUpToday = false
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Default).launch {
|
CoroutineScope(Dispatchers.Default).launch {
|
||||||
AutoTradingManager.startAutoDiscoveryLoop()
|
AutoTradingManager.startAutoDiscoveryLoop(true)
|
||||||
KisWebSocketManager.onExecutionReceived = AutoTradingManager.onExecutionReceived
|
KisWebSocketManager.onExecutionReceived = AutoTradingManager.onExecutionReceived
|
||||||
KisWebSocketManager.connect()
|
KisWebSocketManager.connect()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -403,7 +403,7 @@ object AutoTradingManager {
|
|||||||
/**
|
/**
|
||||||
* 자동 발굴 루프 시작 및 Watchdog 실행
|
* 자동 발굴 루프 시작 및 Watchdog 실행
|
||||||
*/
|
*/
|
||||||
fun startAutoDiscoveryLoop() {
|
fun startAutoDiscoveryLoop(doStart : Boolean = false) {
|
||||||
if (isRunning()) return
|
if (isRunning()) return
|
||||||
|
|
||||||
// 1. 기존 Watchdog이 있다면 제거 후 새로 시작
|
// 1. 기존 Watchdog이 있다면 제거 후 새로 시작
|
||||||
@ -411,7 +411,7 @@ object AutoTradingManager {
|
|||||||
watchdogJob = scope.launch {
|
watchdogJob = scope.launch {
|
||||||
val activeTrades = DatabaseFactory.findAllMonitoringTrades()
|
val activeTrades = DatabaseFactory.findAllMonitoringTrades()
|
||||||
var now = LocalTime.now(ZoneId.of("Asia/Seoul"))
|
var now = LocalTime.now(ZoneId.of("Asia/Seoul"))
|
||||||
if (activeTrades.isNotEmpty()) {
|
if (doStart && activeTrades.isNotEmpty() && !KisSession.isAvailBuyTime(now)) {
|
||||||
executeClosingLiquidation(activeTrades)
|
executeClosingLiquidation(activeTrades)
|
||||||
}
|
}
|
||||||
while (isActive) {
|
while (isActive) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user