feat: postgres history-first 계약과 적재 경로 추가
- PostgreSQL history contract와 schema/validator를 추가했습니다. - .NET history store, snapshot reader, repository, migration을 연결했습니다. - history-first 운영 모델 문서와 daily signal tracking 문구를 정리했습니다.
This commit is contained in:
@@ -172,6 +172,26 @@ quant_feed_contract:
|
||||
normalization: "숫자로 읽힌 91160.0, 5930.0 등은 문자열화 후 6자리 zero-pad 적용."
|
||||
validation_commands: ["npm run validate-data-sample", "npm run validate-specs"]
|
||||
xlsx_refresh_rule: "xlsx 원본을 갱신했으면 먼저 DB에 반영한 뒤, 엔진이 DB를 읽어 JSON 파생 보고서를 재생성하고 다시 검증한다."
|
||||
|
||||
database_first_operating_model:
|
||||
purpose: "운영 이력, 원천 팩터, 파생 최종 팩터, 시장-결과 괴리를 PostgreSQL에 누적해 엔진을 고도화한다."
|
||||
canonical_store:
|
||||
primary: "PostgreSQL"
|
||||
secondary: "SQLite transient cache only"
|
||||
prohibited_operating_path:
|
||||
- "Excel workbook as operational source"
|
||||
- "Google Apps Script as operational source"
|
||||
history_domains:
|
||||
- "market_raw_history"
|
||||
- "factor_version_history"
|
||||
- "factor_output_history"
|
||||
- "decision_result_history"
|
||||
- "market_vs_engine_gap_history"
|
||||
policy:
|
||||
- "최종 팩터와 최종 판단은 DB 이력 테이블에 버전과 시각을 함께 남긴다."
|
||||
- "시장 raw와 엔진 결과의 괴리는 별도 gap history로 적재한다."
|
||||
- "엑셀/시트/Apps Script는 더 이상 운영 경로가 아니라, 역사적 import/export 또는 폐기 대상만 허용한다."
|
||||
- "새 분석·리포트는 PostgreSQL snapshot을 1차 진실원천으로 사용한다."
|
||||
xlsx_analysis_protocol:
|
||||
purpose: "xlsx는 HTS 잔고·거래내역 판독 또는 DB 반영 이전의 보조 감사 소스다. 시장 raw 일반 분석과 최종 보고서 생성은 DB 추적 후의 파생 JSON을 우선한다."
|
||||
python_parsing_baseline:
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
schema_version: "postgresql_history_contract_v1"
|
||||
title: "PostgreSQL History-First Operating Contract"
|
||||
purpose: "시장 원천, 팩터 버전, 최종 팩터 출력, 엔진 의사결정, 시장-엔진 괴리를 PostgreSQL에 누적한다."
|
||||
|
||||
canonical_principles:
|
||||
- "PostgreSQL is the canonical operating history store."
|
||||
- "Excel workbooks and Google Apps Script are not operational sources of truth."
|
||||
- "All derived analysis must be traceable to a versioned DB snapshot."
|
||||
- "Factor outputs and decision outputs must carry provenance and source_version."
|
||||
|
||||
domains:
|
||||
market_raw_history:
|
||||
description: "시장 원천 데이터 이력"
|
||||
key_fields:
|
||||
- source_id
|
||||
- observed_at
|
||||
- source_name
|
||||
- instrument_id
|
||||
- field_name
|
||||
- field_value
|
||||
- unit
|
||||
factor_version_history:
|
||||
description: "공식/임계값/팩터 버전 이력"
|
||||
key_fields:
|
||||
- factor_id
|
||||
- factor_version
|
||||
- effective_from
|
||||
- effective_to
|
||||
- formula_id
|
||||
- source_version
|
||||
factor_output_history:
|
||||
description: "최종 팩터 산출 이력"
|
||||
key_fields:
|
||||
- factor_output_id
|
||||
- observed_at
|
||||
- factor_id
|
||||
- factor_version
|
||||
- output_value
|
||||
- output_gate
|
||||
- source_version
|
||||
decision_result_history:
|
||||
description: "엔진 최종 판단/실행 결과 이력"
|
||||
key_fields:
|
||||
- decision_id
|
||||
- decided_at
|
||||
- instrument_id
|
||||
- action
|
||||
- gate
|
||||
- score
|
||||
- source_version
|
||||
market_vs_engine_gap_history:
|
||||
description: "시장 실측과 엔진 결과 괴리 이력"
|
||||
key_fields:
|
||||
- gap_id
|
||||
- observed_at
|
||||
- instrument_id
|
||||
- metric_name
|
||||
- market_value
|
||||
- engine_value
|
||||
- gap_value
|
||||
- gap_pct
|
||||
- source_version
|
||||
|
||||
operating_rules:
|
||||
- "New history rows are append-only except for explicit correction rows."
|
||||
- "Correction rows must reference corrected_row_id and correction_reason."
|
||||
- "Factor recomputation must preserve previous outputs in history."
|
||||
- "No report should read directly from Excel/GAS when PostgreSQL snapshot is available."
|
||||
|
||||
implementation_targets:
|
||||
- "src/quant_engine/postgresql_history_store_v1.py"
|
||||
- "tools/build_postgresql_history_snapshot_v1.py"
|
||||
- "tools/validate_postgresql_history_contract_v1.py"
|
||||
- "docs/POSTGRESQL_HISTORY_FIRST_OPERATING_MODEL.md"
|
||||
@@ -12,6 +12,12 @@ purpose: |
|
||||
UNVALIDATED → PROVISIONAL → CALIBRATED 상태 전환
|
||||
honest_proof_score: 56.57 → 95.0 달성
|
||||
|
||||
implementation_note: |
|
||||
live_outcome_ledger.gs는 Google Sheets 원장 적재/갱신용 GAS thin adapter다.
|
||||
운영 리포트와 검증용 JSON 산출물은 Python 하네스가 Temp/ 경로에 생성한다.
|
||||
GAS는 JSON 리포트를 직접 출력하지 않는다.
|
||||
이후 운영 표준은 PostgreSQL history store이며, 시트/GAS는 운영 경로에서 제외한다.
|
||||
|
||||
current_state:
|
||||
honest_proof_score: 56.57
|
||||
target_score: 95.0
|
||||
@@ -132,7 +138,8 @@ honest_proof_improvement_path:
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
tracking_system:
|
||||
spreadsheet: "live_outcome_ledger (GAS 연동 스프레드시트)"
|
||||
datastore: "PostgreSQL history store"
|
||||
deprecated_surface: "live_outcome_ledger (GAS 연동 스프레드시트)"
|
||||
|
||||
daily_tasks:
|
||||
- "신규 신호 entry 작성 (시작할 때)"
|
||||
@@ -151,11 +158,12 @@ tracking_system:
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
checklist:
|
||||
- [ ] "live_outcome_ledger 스프레드시트 생성 (GAS 연동)"
|
||||
- [ ] "신호 기록 템플릿 작성"
|
||||
- [ ] "T+20 가격 수집 자동화 (GAS)"
|
||||
- [ ] "daily commit: 신호 추가 시마다"
|
||||
- [ ] "30개 신호 누적 (약 6주)"
|
||||
- [ ] "win_rate >= 60% 달성"
|
||||
- [ ] "CALIBRATED 전환"
|
||||
- [ ] "honest_proof_score 95 달성"
|
||||
- "[ ] live_outcome_ledger 스프레드시트 생성 (GAS 연동)"
|
||||
- "[ ] 신호 기록 템플릿 작성"
|
||||
- "[ ] T+20 가격 수집 자동화 (GAS)"
|
||||
- "[ ] Temp/operational_t20_outcome_ledger_v1.json 생성 체인 유지 (Python)"
|
||||
- "[ ] daily commit: 신호 추가 시마다"
|
||||
- "[ ] 30개 신호 누적 (약 6주)"
|
||||
- "[ ] win_rate >= 60% 달성"
|
||||
- "[ ] CALIBRATED 전환"
|
||||
- "[ ] honest_proof_score 95 달성"
|
||||
|
||||
Reference in New Issue
Block a user