fix: 당일 최초 자산 스냅샷 08:50 기본 및 장중 첫 실행시 자가 치유 자동 캡처 적용
This commit is contained in:
@@ -95,13 +95,22 @@ object TradingReportManager : TradingReportService {
|
||||
val now = MarketScheduleManager.now()
|
||||
val today = LocalDate.now(MarketScheduleManager.seoulZone).toString()
|
||||
|
||||
// 1. 장 시작 전 기초 자산 스냅샷 (08:50 ~ 08:55)
|
||||
// 1. 장 시작 전 기초 자산 스냅샷 (08:50 ~ 08:55 기본, 장중 첫 실행 시 자동 캡처)
|
||||
val startKey = "${today}_START"
|
||||
if (now.isAfter(LocalTime.of(8, 49)) && now.isBefore(LocalTime.of(8, 56))) {
|
||||
if (now.isAfter(LocalTime.of(8, 49)) && now.isBefore(LocalTime.of(15, 30))) {
|
||||
if (!reportedSnapshotMap.containsKey(startKey)) {
|
||||
reportedSnapshotMap[startKey] = true
|
||||
println("🌅 [Report] 08:50 장 시작 전 기초 자산 스냅샷 및 텔레그램 리포트 자동 실행")
|
||||
recordAssetSnapshot(SnapshotType.START, balance, "장 시작 전 기초 자산 스냅샷")
|
||||
val alreadyExistsInDb = transaction(DatabaseFactory.reportDb) {
|
||||
AssetSnapshotTable.select {
|
||||
(AssetSnapshotTable.date eq today) and (AssetSnapshotTable.snapshotType eq SnapshotType.START.name)
|
||||
}.count() > 0
|
||||
}
|
||||
if (!alreadyExistsInDb) {
|
||||
reportedSnapshotMap[startKey] = true
|
||||
println("🌅 [Report] 당일 최초 기초 자산 스냅샷 및 텔레그램 리포트 자동 실행 (시각: $now)")
|
||||
recordAssetSnapshot(SnapshotType.START, balance, "당일 기초 자산 스냅샷")
|
||||
} else {
|
||||
reportedSnapshotMap[startKey] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user