....
This commit is contained in:
@@ -42,7 +42,7 @@ object AutoTradingManager {
|
||||
|
||||
// 설정 상수
|
||||
private const val MIN_RISE_RATE = 0.1
|
||||
private const val MAX_RISE_RATE = 15.0
|
||||
private const val MAX_RISE_RATE = 19.0
|
||||
private const val CYCLE_TIMEOUT = 30 * 60 * 1000L // 한 사이클 최대 10분
|
||||
private const val WATCHDOG_CHECK_INTERVAL = 30 * 1000L // 30초마다 생존 확인
|
||||
private const val STUCK_THRESHOLD = 5 * 60 * 1000L // 5분간 반응 없으면 'Stuck'으로 판단
|
||||
@@ -88,10 +88,10 @@ object AutoTradingManager {
|
||||
// [프로세스 1] 장 마감 및 잔고 체크
|
||||
val now = LocalTime.now(ZoneId.of("Asia/Seoul"))
|
||||
//&& now.isBefore(LocalTime.of(15, 30))
|
||||
// if (now.isAfter(LocalTime.of(15, 30)) ) {
|
||||
// executeClosingLiquidation(tradeService)
|
||||
// return@withTimeout
|
||||
// }
|
||||
if (now.isAfter(LocalTime.of(15, 0)) ) {
|
||||
executeClosingLiquidation(tradeService)
|
||||
return@withTimeout
|
||||
}
|
||||
|
||||
val balance = tradeService.fetchIntegratedBalance().getOrNull()
|
||||
val myCash = balance?.deposit?.replace(",", "")?.toLongOrNull() ?: 0L
|
||||
@@ -137,10 +137,10 @@ object AutoTradingManager {
|
||||
println("⏳ [Cycle Timeout] 사이클이 너무 길어져 초기화 후 재시작합니다.")
|
||||
} catch (e: Exception) {
|
||||
println("⚠️ [Loop Error] ${e.message}")
|
||||
delay(10000)
|
||||
delay(5000)
|
||||
}
|
||||
|
||||
waitForNextCycle(3)
|
||||
waitForNextCycle(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ object DynamicNewsScraper {
|
||||
|
||||
failCountMap[domain] = (failCountMap[domain] ?: 0) + 1
|
||||
// 불필요한 스택트레이스 출력을 줄이기 위해 메시지만 출력
|
||||
println("❌ [Playwright] 실패 (${url.take(30)}...): ${e.localizedMessage}")
|
||||
// println("❌ [Playwright] 실패 (${url.take(30)}...): ${e.localizedMessage}")
|
||||
""
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ object SafeScraper {
|
||||
suspend fun scrapeParallel(corpInfo: CorpInfo, urls: List<NewsItem>) = coroutineScope {
|
||||
urls.forEach { item -> // map + awaitAll 대신 순차 처리가 현재 상황에선 더 안정적입니다.
|
||||
if (UrlCacheManager.isAlreadyProcessed(item.originallink)) {
|
||||
println("✅ [학습완료 데이터 스킵] ${item.originallink}")
|
||||
// println("✅ [학습완료 데이터 스킵] ${item.originallink}")
|
||||
return@forEach
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ object SafeScraper {
|
||||
try {
|
||||
withTimeout(25000L) { // 타임아웃 약간 증가
|
||||
val content = DynamicNewsScraper.fetchFullContent(item.originallink)
|
||||
if (content.isNotBlank()) {
|
||||
if (content.isNotBlank() && content.length > 100) {
|
||||
RagService.ingestWithChunking(
|
||||
text = content,
|
||||
newsLink = item.originallink,
|
||||
@@ -272,7 +272,7 @@ object SafeScraper {
|
||||
corpCode = corpInfo.cCode,
|
||||
stcokName = corpInfo.stockName
|
||||
)
|
||||
println("✅ [학습완료] ${item.originallink}")
|
||||
// println("✅ [학습완료] ${item.originallink}")
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user