You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
## 신규 엔드포인트
- GET /insider/form4/{ticker} — PIT-safe Form 4 거래 목록 (as_of 필수)
- GET /insider/form4/by-date/{date} — 특정 공시일 cross-ticker 거래
- GET /insider/form4/aggregate/{ticker} — 내부자 매수 집계 (window_days)
- GET /ownership/13dg/{ticker} — SC 13D/G activist 이벤트 (as_of 필수)
- GET /ownership/13dg/active — 현재 활성 activist 포지션 (window function PIT)
## 데이터 인프라
- activist_ownership_events 테이블 (42,329행, 최근 2년 bootstrap 완료)
- insider_transactions: is_ceo/is_cfo/is_c_suite/purchase_pct_of_holding/owner_relationship 컬럼 추가
- SECFullIndexService: company.idx fixed-width 파서, form345.zip 파서
- ActivistOwnershipService: SGML header issuer 해석 + cover-page XML/HTML enrich
- SEC ingest scheduler: 매 영업일 09:00 ET daily ingest + 30분 enrich job
- scripts: bootstrap_form4_by_ticker.py, bootstrap_form4_2y.py, bootstrap_13dg.py
## 버그 수정 (enrich 품질)
- filing_url double edgar/ prefix 제거
- XML: classPercent + amountBeneficiallyOwned + reportingPerson... 태그 추가
- HTML: 태그 제거 후 regex 적용 (CSS 10pt → shares 오인식 방지)
- HTML: ownership_pct > 100 방어 로직
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
4 months ago | |
|---|---|---|
| .. | ||
| README.md | 5 months ago | |
| TEST_SUMMARY.md | 5 months ago | |
| __init__.py | 5 months ago | |
| conftest.py | 5 months ago | |
| run_all_tests.py | 5 months ago | |
| test_5year_comparison.py | 5 months ago | |
| test_8k_parser.py | 4 months ago | |
| test_15year_financial_data.py | 5 months ago | |
| test_activist_ownership_parse.py | 4 months ago | |
| test_attention.py | 5 months ago | |
| test_catalog.py | 5 months ago | |
| test_final_verification.py | 5 months ago | |
| test_financial.py | 5 months ago | |
| test_form4_pit.py | 4 months ago | |
| test_health.py | 5 months ago | |
| test_integration.py | 5 months ago | |
| test_migration.py | 5 months ago | |
| test_mock_data.py | 5 months ago | |
| test_ohlcv.py | 5 months ago | |
| test_overlay.py | 5 months ago | |
| test_quick.py | 5 months ago | |
| test_real_sec_vs_yfinance_plus.py | 5 months ago | |
| test_sec_edgar_15year.py | 5 months ago | |
| test_sec_filings_fixes.py | 4 months ago | |
| test_sec_full_index_parser.py | 4 months ago | |
| test_simple.py | 5 months ago | |
| test_simple_real_data.py | 5 months ago | |
| test_yfinance_comparison.py | 5 months ago | |
| test_yfinance_fallback.py | 5 months ago | |
README.md
Stock Oracle 테스트 스위트
이 폴더에는 Stock Oracle 시스템의 다양한 기능을 테스트하는 스크립트들이 포함되어 있습니다.
📁 테스트 파일 목록
1. test_yfinance_fallback.py
목적: YFinance Plus 연결 테스트
- yfinance_plus 모듈이 정상적으로 작동하는지 확인
- 기본적인 주식 데이터 가져오기 테스트
- API 수동 호출 테스트
실행 방법:
python tests/test_yfinance_fallback.py
2. test_simple_real_data.py
목적: 실제 SEC 데이터 기본 테스트
- Stock Oracle API에서 실제 SEC 재무 데이터를 정상적으로 가져오는지 확인
- 데이터 품질 검증 (실제 데이터 vs 추정 데이터)
- YFinance Plus와의 기본 비교
실행 방법:
python tests/test_simple_real_data.py
3. test_real_sec_vs_yfinance_plus.py
목적: Stock Oracle vs YFinance Plus 상세 비교
- 두 시스템에서 가져온 재무 데이터의 정확도 비교
- 주요 재무 지표들의 차이점 분석
- 여러 종목(AAPL, MSFT)에 대한 비교 테스트
실행 방법:
python tests/test_real_sec_vs_yfinance_plus.py
4. test_5year_comparison.py
목적: 5년 분기별 정확도 테스트
- 동일한 분기 데이터의 정확도를 5년간 비교 검증
- 분기별 매칭된 데이터만 비교하여 정확도 측정
- 시계열 데이터의 일관성 검증
실행 방법:
python tests/test_5year_comparison.py
5. run_all_tests.py (통합 테스트 스위트)
목적: 모든 테스트를 한번에 실행
- 위의 모든 테스트를 순차적으로 실행
- 각 테스트의 성공/실패 결과 요약
- 실행 시간 측정 및 리포트 생성
실행 방법:
python tests/run_all_tests.py
🚀 빠른 시작
전체 테스트 실행
# 모든 테스트를 한번에 실행
python tests/run_all_tests.py
개별 테스트 실행
# 기본적인 연결 테스트만
python tests/test_yfinance_fallback.py
# 실제 데이터 테스트만
python tests/test_simple_real_data.py
# 정확도 비교 테스트만
python tests/test_real_sec_vs_yfinance_plus.py
# 5년 정확도 검증만
python tests/test_5year_comparison.py
📋 사전 요구사항
테스트 실행 전에 다음 조건들이 만족되어야 합니다:
1. Docker 서비스 실행
docker-compose up -d
2. 필수 Python 패키지
requestsyfinance_pluspandasjson
3. API 서버 확인
Stock Oracle API가 http://localhost:18001에서 실행 중이어야 합니다.
# 서버 상태 확인
curl http://localhost:18001/health
📊 예상 결과
성공적인 테스트 결과
- YFinance Plus 연결: ✅ 정상 연결 및 데이터 가져오기
- 실제 SEC 데이터: ✅ 실제 데이터 (is_estimated: false) 반환
- 데이터 비교: ✅ 합리적인 차이 범위 내 (동일 분기 대비)
- 5년 정확도: ✅ 동일 분기 데이터 100% 일치
문제 해결
API 서버 연결 실패
# Docker 컨테이너 상태 확인
docker-compose ps
# 서비스 재시작
docker-compose restart
yfinance_plus 모듈 오류
# 모듈 재설치
pip install yfinance_plus
# Docker 내부에서 재설치
docker-compose exec api pip install yfinance_plus
데이터베이스 연결 오류
# PostgreSQL 컨테이너 재시작
docker-compose restart postgres
# 로그 확인
docker-compose logs postgres
🎯 테스트 목표
이 테스트 스위트의 목표는 다음과 같습니다:
- 기능 검증: 모든 핵심 기능이 정상 작동하는지 확인
- 데이터 정확성: 실제 SEC 데이터가 정확하게 가져와지는지 검증
- 일관성 확인: 시스템 간 데이터 일관성 보장
- 성능 측정: 각 테스트의 실행 시간 측정
- 회귀 방지: 향후 코드 변경 시 기존 기능 보호
📝 테스트 결과 해석
성공 지표
- 모든 API 호출이 200 상태 코드 반환
- 실제 재무 데이터 (
is_estimated: false) 반환 - 동일 분기 데이터의 정확한 일치
- 합리적인 실행 시간 (각 테스트 < 5분)
주의사항
- 서로 다른 분기 데이터 비교 시 차이는 정상
- 네트워크 상태에 따라 실행 시간 변동 가능
- 일부 종목의 경우 특정 분기 데이터가 없을 수 있음
🔄 정기 테스트 권장
- 개발 후: 코드 변경 후 전체 테스트 실행
- 배포 전: 프로덕션 배포 전 필수 검증
- 주기적: 주 1회 데이터 정확성 검증
- 문제 발생 시: 즉시 해당 영역 테스트 실행