From 33732e6b66cf8d1ec1d2947a97730f7ed0c4e1ea Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Tue, 17 Nov 2026 17:52:13 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=8B=B9=EC=9D=BC=20=EC=B5=9C=EC=B4=88?= =?UTF-8?q?=20=EC=9E=90=EC=82=B0=20=EC=8A=A4=EB=83=85=EC=83=B7=2008:50=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=20=EB=B0=8F=20=EC=9E=A5=EC=A4=91=20=EC=B2=AB?= =?UTF-8?q?=20=EC=8B=A4=ED=96=89=EC=8B=9C=20=EC=9E=90=EA=B0=80=20=EC=B9=98?= =?UTF-8?q?=EC=9C=A0=20=EC=9E=90=EB=8F=99=20=EC=BA=A1=EC=B2=98=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/report/TradingReportManager.kt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/report/TradingReportManager.kt b/src/main/kotlin/report/TradingReportManager.kt index 986c3a7..6e82d06 100644 --- a/src/main/kotlin/report/TradingReportManager.kt +++ b/src/main/kotlin/report/TradingReportManager.kt @@ -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 + } } }