Files
QuantEngineByItz/spec/54_temporal_data_integrity.yaml
T
kjh2064 ee3e799de1 feat: 리밸런싱 엔진 V1 + GAS 버그 수정 (2026-06-13)
주요 변경:
- tools/build_rebalance_engine_v1.py: REBALANCE_ENGINE_V1 신규
  * account_snapshot 직접 합산(_build_snap_position_map) → 소수주 분리 행 병합
  * 레짐 소스 macro.REGIME_PRELIM 최우선 (GAS 와 동일)
- src/gas_adapter_parts/gdf_06_rebalance.gs: runRebalanceSheet_() 신규
  * Logger.log / getSpreadsheet_() 로 run_all 연동 수정
- src/gas_adapter_parts/gdc_01_fetch_fundamentals.gs
  * _mergePositionRecord_(): 소수주 중복 행 합산 신규
  * parseInt → parseFloat (qty, availQty)
- src/gas_adapter_parts/gdf_01_price_metrics.gs
  * 미보유 종목 SELL_READY → WATCH_EXIT_SIGNAL
- spec/41_release_dag.yaml: build_rebalance_sheet 노드 추가 (step_count 63)
- spec/51_formula_lifecycle_registry.yaml: REBALANCE_ENGINE_V1 등록

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 13:20:14 +09:00

60 lines
1.9 KiB
YAML

schema_version: temporal_data_integrity.v1
contract_id: H003_ANTI_BACKFILL_LOOKAHEAD
harness_file: tools/validate_no_lookahead_bias_v1.py
authority: spec/54_temporal_data_integrity.yaml
created_at: '2026-06-10T23:29:00+09:00'
purpose: >
백필 데이터와 실시간 데이터의 timestamp/freshness 혼입을 차단한다.
feature_timestamp가 decision_timestamp를 초과하는 lookahead는 즉시 차단한다.
definitions:
lookahead_bias: >
feature 계산에 사용된 데이터의 as_of_date가
해당 결정이 내려진 decision_timestamp보다 미래인 경우
backfill_contamination: >
과거 결정 평가 시 그 시점에 없던 데이터가 소급 적용된 경우
inputs:
- field: computed_harness_v1.json
source: Temp/computed_harness_v1.json
required: true
- field: GatherTradingData.json
source: GatherTradingData.json
required: true
output_fields:
- name: lookahead_violation_count
type: int
description: feature_timestamp > decision_timestamp 건수
- name: backfilled_after_decision_count
type: int
description: 결정 이후 소급 backfill된 데이터 건수
- name: freshness_violation_tickers
type: list[str]
description: freshness 위반 종목 목록
- name: gate
type: str
enum: [PASS, FAIL]
acceptance_criteria:
- feature_timestamp_lte_decision_timestamp: true
- backfilled_after_decision_count: 0
hard_gates:
- gate_id: NO_LOOKAHEAD
condition: lookahead_violation_count == 0
on_fail: BLOCK_RELEASE
- gate_id: NO_BACKFILL_CONTAMINATION
condition: backfilled_after_decision_count == 0
on_fail: BLOCK_RELEASE
data_freshness_sla:
price_data_max_age_hours: 1
fundamental_data_max_age_days: 30
macro_data_max_age_hours: 24
owner: data_engineer
lifecycle_state: active
retirement_condition: >
실시간 스트리밍 파이프라인으로 전환 시 해당 파이프라인 계약으로 교체한다.