WBS-9: Phase 9 모든 항목 준비 완료 — 7개 도구 & 문서 완성
WBS-9.1: F14 마이그레이션 완결 ✅ - late_chase_risk_score, late_chase_gate 포트 완료 - Parity 테스트 36개 PASS (17+19 테스트) - docs/WBS_9_1_F14_MIGRATION_COMPLETE_2026_06_22.md WBS-9.2: snapshot_admin 성능 최적화 - tools/benchmark_snapshot_admin_performance_v1.py - 단일/동시 테이블 성능 측정 - P99 < 2초 검증, 자동 리포트 생성 WBS-9.3: 데이터 품질 강화 ✅ 80% 완료 - spec/12_field_dictionary.yaml: NULL 정책 추가 - auto_fill_atr20_v1.py: ATR20 자동 계산 - auto_fill_rsi14_v1.py: RSI14 자동 계산 - auto_fill_velocity_v1.py: velocity 자동 계산 - auto_fill_stop_price_v1.py: 손절가 자동 계산 - CI 게이트 3개 (NULL_CHECK, FILLABLE, ESTIMATION_BLOCK) WBS-9.4: 장애 대응 플레이북 ✅ - docs/WBS_9_4_INCIDENT_RESPONSE_PLAYBOOK_2026_06_22.md - 5가지 시나리오 (KIS, Cloudflare, GAS, Admin, Data) - RTO/RPO 명시, 모의 훈련 일정 WBS-9.5: 섹터 플로우 신호 신뢰도 - tools/measure_sector_flow_reliability_v1.py - Hit Rate, Correlation, Reliability Score 측정 - HIGH/MEDIUM/LOW/INSUFFICIENT 판정 - WBS-8.5 완료(섹터 플로우 30일) 후 실행 WBS-9.6: LLM 레이더 문서 최적화 전략 - docs/WBS_9_6_LLM_RADAR_OPTIMIZATION_STRATEGY_2026_06_22.md - 5-Phase 구현 계획 (신뢰도/순서/의존성/용어/오류검증) - 목표: 독해 오류율 50% 이상 감소 WBS-9.7: 자동 백업 & 복구 - tools/backup_recovery_manager_v1.py - 일일 증분/주간 전체 백업 - 자동 정리(30일), 무결성 검증 - 복구 < 1시간, 99% 성공률 목표 WBS-9 최종 요약: - docs/WBS_9_FINAL_SUMMARY_2026_06_22.md - 7개 항목 모두 준비 완료 - 2026-08-01 공식 시작 - 14-21일 병렬 진행으로 완료 가능 파일 추가: - src/quant_engine/auto_fill_atr20_v1.py - src/quant_engine/auto_fill_rsi14_v1.py - src/quant_engine/auto_fill_velocity_v1.py - src/quant_engine/auto_fill_stop_price_v1.py - tools/measure_sector_flow_reliability_v1.py - tools/backup_recovery_manager_v1.py - docs/WBS_9_FINAL_SUMMARY_2026_06_22.md Next: WBS-8.1 (T+20 ledger 30건, ~2026-07-15) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
WBS-9.3: RSI14 자동 충전 절차
|
||||
|
||||
조건: rsi_14 IS NULL AND close_price IS NOT NULL
|
||||
"""
|
||||
|
||||
def calculate_rsi14(closes: list[float], period: int = 14) -> float:
|
||||
"""
|
||||
Calculate RSI (Relative Strength Index) for 14 days.
|
||||
|
||||
입력: close 가격 리스트 (최소 14일)
|
||||
출력: RSI14 (0-100)
|
||||
"""
|
||||
if len(closes) < period:
|
||||
return None
|
||||
|
||||
# 가격 변화 계산
|
||||
deltas = [closes[i] - closes[i - 1] for i in range(1, len(closes))]
|
||||
|
||||
# Gains/Losses 분리
|
||||
gains = [d if d > 0 else 0 for d in deltas]
|
||||
losses = [abs(d) if d < 0 else 0 for d in deltas]
|
||||
|
||||
# 평균 계산 (간단한 이동평균)
|
||||
avg_gain = sum(gains[-period:]) / period if period <= len(gains) else sum(gains) / len(gains)
|
||||
avg_loss = sum(losses[-period:]) / period if period <= len(losses) else sum(losses) / len(losses)
|
||||
|
||||
if avg_loss == 0:
|
||||
return 100 if avg_gain > 0 else 50
|
||||
|
||||
rs = avg_gain / avg_loss
|
||||
rsi = 100 - (100 / (1 + rs))
|
||||
|
||||
return round(rsi, 2)
|
||||
|
||||
|
||||
def auto_fill_rsi14(row: dict, historical_closes: list[float] = None) -> dict:
|
||||
"""
|
||||
자동 충전: rsi_14 필드
|
||||
|
||||
입력:
|
||||
row: 현재 행 (rsi_14 = None)
|
||||
historical_closes: 과거 close 가격 (최소 14일)
|
||||
|
||||
출력:
|
||||
row (rsi_14 채워짐) 또는 원본 (실패시)
|
||||
"""
|
||||
if not historical_closes or row.get("rsi_14") is not None:
|
||||
return row
|
||||
|
||||
rsi14 = calculate_rsi14(historical_closes)
|
||||
if rsi14 is not None:
|
||||
row["rsi_14"] = rsi14
|
||||
row["_fill_source"] = "auto_fill_rsi14_v1"
|
||||
|
||||
return row
|
||||
Reference in New Issue
Block a user