feat(runtime): dcy-014 trading_date KST 타임존 분리 + 일일 슬롯 preallocation (BAT-018)

데몬이 시스템 UTC 날짜로 슬롯을 1회만 preallocate 해 trading_date 가 KST 캘린더와
어긋나고 재시작 없이는 다음날 슬롯이 안 생기던 문제(issue #14) 정정.

거버넌스: 전부 change-req (신규 REQ 없음, dcy-014 OQ-3; 스케줄러는 REQ-030 패턴 준용).
- REQ-005: trading_date 를 설정 타임존(기본 Asia/Seoul) 기준 계산(timestamp 는 UTC
  유지). DailyPreallocationScheduler 신규 — TZ 일자당 1회 멱등 fire, 재시작 없이
  다음날 슬롯 자동 생성. setup() 배선 + trex-preallocation 스레드
- REQ-048: TOML trading_timezone/daily_preallocation_time 키 + from_config 전파
- REQ-009: runtime-flows/data-model 정합 + instance.example.toml

OQ-1 기본 00:00(TZ 자정, TOML 설정 가능) / OQ-2 매 캘린더일 생성(거래일 캘린더 후속).
멱등 preallocate 로 중복 tick·다중 인스턴스 중복 생성 0.

검증: 단위 302 passed/32 skipped, 인프라 게이트(PG+RabbitMQ) 334 passed, ruff clean.
신규 test_preallocation_scheduler(고정 clock) + test_instance_config 확장.
BAT-018 release-candidate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 15:39:04 +09:00
co-authored by Claude Opus 4.8
parent 4746f74aae
commit 0b7db66463
20 changed files with 818 additions and 15 deletions
@@ -146,3 +146,43 @@
- Existing Implementation Invalidated: no
- Status Recommendation: keep-current (Implemented)
- Follow-up Action: draft-release 로 BAT-013 배포 편성. token .env 제거는 배포 rollout.
### CHG-20260608-01
- Date: 2026-06-08
- Author: Justin Ko
#### Change Summary
- (change-req, dcy-014) per-instance TOML 설정에 `trading_timezone`(기본 `Asia/Seoul`)·`daily_preallocation_time`(기본 `00:00`) 키 추가. `DaemonInstanceConfig.from_toml` 파싱 + `from_config` → `DaemonConfig` 전파. 본 기능 운영 설정을 TOML 로 일원화(dcy-014 FR-4). BAT-018 재구현·재검증 완료 → Implemented 유지.
#### Intent
- 거래일 타임존·일일 트리거 시각을 신규 설정 표면 없이 기존 `--config` TOML 에 편입(운영자 명시 지정 가능).
#### Acceptance Criteria Delta
- Added:
- TOML optional 키 `trading_timezone`/`daily_preallocation_time`(부재 시 KST/00:00 기본). from_config 가 DaemonConfig 로 전파.
#### Impacted Area Delta
- Modules: `trex_core/runtime/config.py`(DaemonInstanceConfig/DaemonConfig/from_config)
- Docs: `config/instance.example.toml`
- Tests: tests/runtime/test_instance_config.py(기본값/전파)
#### Delivery Trace Delta
- Batches: BAT-018
- Releases: none
#### Revalidation Impact
- Reverification Needed: yes (BAT-018 에서 완료)
- Existing Implementation Invalidated: no (optional 키 추가, 기존 TOML 호환)
- Status Recommendation: Implemented (change-req → BAT-018 재검증)
- Follow-up Action: confirm-req-implemented(BAT-018).
#### Validation Plan
- BAT-018: from_toml 기본값(KST/00:00) + TOML 값 from_config 전파 단위.