fix: 장후 15:35~19:30 실행시 정규장 마감스냅샷 및 텔레그램 발송 지원

This commit is contained in:
2026-11-17 17:54:53 +09:00
parent 33732e6b66
commit fed2746e4c
+24 -6
View File
@@ -114,23 +114,41 @@ object TradingReportManager : TradingReportService {
} }
} }
// 2. 정규장 마감 리포트 (15:35 ~ 15:45) // 2. 정규장 마감 리포트 (15:35 이후 ~ 19:30 이전, 당일 마감 미발송 시 자동 캡처)
val endKey = "${today}_END" val endKey = "${today}_END"
if (now.isAfter(LocalTime.of(15, 34)) && now.isBefore(LocalTime.of(15, 45))) { if (now.isAfter(LocalTime.of(15, 34)) && now.isBefore(LocalTime.of(19, 30))) {
if (!reportedSnapshotMap.containsKey(endKey)) { if (!reportedSnapshotMap.containsKey(endKey)) {
val alreadyExistsInDb = transaction(DatabaseFactory.reportDb) {
AssetSnapshotTable.select {
(AssetSnapshotTable.date eq today) and (AssetSnapshotTable.snapshotType eq SnapshotType.END.name)
}.count() > 0
}
if (!alreadyExistsInDb) {
reportedSnapshotMap[endKey] = true reportedSnapshotMap[endKey] = true
println("🏁 [Report] 15:35 정규장 마감 스냅샷 및 텔레그램 리포트 자동 실행") println("🏁 [Report] 정규장 마감 스냅샷 및 텔레그램 리포트 자동 실행 (시각: $now)")
recordAssetSnapshot(SnapshotType.END, balance, "정규장 마감 운용 스냅샷") recordAssetSnapshot(SnapshotType.END, balance, "정규장 마감 운용 스냅샷")
} else {
reportedSnapshotMap[endKey] = true
}
} }
} }
// 3. 애프터 마켓(시간외) 거래 종료 마감 결산 (19:30 ~ 19:45) // 3. 애프터 마켓(시간외) 거래 종료 마감 결산 (19:30 이후 ~ 당일 업무 종료)
val afterKey = "${today}_AFTER_CLOSE" val afterKey = "${today}_AFTER_CLOSE"
if (now.isAfter(LocalTime.of(19, 29)) && now.isBefore(LocalTime.of(19, 45))) { if (now.isAfter(LocalTime.of(19, 29))) {
if (!reportedSnapshotMap.containsKey(afterKey)) { if (!reportedSnapshotMap.containsKey(afterKey)) {
val alreadyExistsInDb = transaction(DatabaseFactory.reportDb) {
AssetSnapshotTable.select {
(AssetSnapshotTable.date eq today) and (AssetSnapshotTable.snapshotType eq SnapshotType.AFTER_CLOSE.name)
}.count() > 0
}
if (!alreadyExistsInDb) {
reportedSnapshotMap[afterKey] = true reportedSnapshotMap[afterKey] = true
println("🌙 [Report] 19:30 애프터마켓(시간외) 거래 종료 최종 스냅샷 및 텔레그램 리포트 자동 실행") println("🌙 [Report] 19:30 애프터마켓(시간외) 거래 종료 최종 스냅샷 및 텔레그램 리포트 자동 실행 (시각: $now)")
recordAssetSnapshot(SnapshotType.AFTER_CLOSE, balance, "애프터마켓 19:30 마감 최종 결산 스냅샷") recordAssetSnapshot(SnapshotType.AFTER_CLOSE, balance, "애프터마켓 19:30 마감 최종 결산 스냅샷")
} else {
reportedSnapshotMap[afterKey] = true
}
} }
} }
} }