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