Files
QuantEngineByItz/src/quant_engine/data_collection_backend_v1.py
T
kjh2064 4cb206a269 KIS Open API 조회전용 연동 + 직접매매 절대금지 안전게이트
매수/매도 주문 및 계좌 잔고조회를 API로 직접 실행하지 않는다는 원칙을
코드 레벨에서 강제하는 안전게이트(governance/rules/06, 07)와 함께,
시세/호가/공매도거래비중 등 조회전용 KIS Open API 연동 및 SQLite
수집 파이프라인을 추가한다.

- kis_api_client_v1: 모든 요청이 _assert_read_only를 통과해야 하며
  /trading/ 경로·주문 TR_ID는 RuntimeError로 즉시 차단
- kis_data_collection_v1: KIS 우선 + Naver 폴백, 네트워크 실패는
  개별 ticker 단위로 흡수(배치 전체 중단 없음)
- data_collection_store_v1 / storage_backend_v1: SQLite 캐노니컬
  저장소, PostgreSQL 전환 대비 백엔드 추상화
- Gitea 영업일 스케줄(2시간 간격) + CI 강제 게이트
  (validate_no_direct_api_trading_v1, validate_kis_api_credentials_v1)
2026-06-21 20:04:44 +09:00

19 lines
601 B
Python

"""Storage backend selection for the collection pipeline.
This module is a thin compatibility wrapper over the generic storage backend
contract. The collector is intentionally designed around a backend contract,
not a hard SQLite-only assumption.
"""
from __future__ import annotations
from pathlib import Path
from src.quant_engine.storage_backend_v1 import StoreSpec, default_sqlite_store_path, normalize_store_spec
CollectionStoreSpec = StoreSpec
def default_collection_store_path(root: Path) -> Path:
return default_sqlite_store_path(root, "kis_data_collection/kis_data_collection.db")