WLD DeepCoin 단계별 구조 재편 및 설정·문서 통합
로고스/루트 레거시를 제거하고 deepcoin 패키지·scripts 01~05 CLI·docs/reference로 데이터·GT·분석·매칭·운영 단계를 정리했다. config와 .env 기반 설정, trade_anaysis.html 동기화 포함. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
95
deepcoin/paths.py
Normal file
95
deepcoin/paths.py
Normal file
@@ -0,0 +1,95 @@
|
||||
"""
|
||||
DeepCoin 프로젝트 경로 (data + docs 통합).
|
||||
|
||||
docs/
|
||||
reference/ 가이드·기법 명세 (Git 추적)
|
||||
02_ground_truth/ … 05_ops/, charts/ 단계별 산출물 (로컬 재생성, Git 제외)
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# DeepCoin/ (이 파일: DeepCoin/deepcoin/paths.py)
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
# --- data ---
|
||||
DATA_DIR = PROJECT_ROOT / "data"
|
||||
DB_DIR = DATA_DIR
|
||||
GROUND_TRUTH_DIR = DATA_DIR / "ground_truth"
|
||||
OPS_STATE_DIR = DATA_DIR / "ops"
|
||||
COOLDOWN_FILE = OPS_STATE_DIR / "coins_buy_time.json"
|
||||
|
||||
# --- docs (reference + 단계별 산출물) ---
|
||||
DOCS_DIR = PROJECT_ROOT / "docs"
|
||||
DOCS_REFERENCE_DIR = DOCS_DIR / "reference"
|
||||
|
||||
DOCS_CHARTS = DOCS_DIR / "charts"
|
||||
DOCS_GROUND_TRUTH = DOCS_DIR / "02_ground_truth"
|
||||
DOCS_ANALYSIS = DOCS_DIR / "03_analysis"
|
||||
DOCS_MATCHING = DOCS_DIR / "04_matching"
|
||||
DOCS_OPS = DOCS_DIR / "05_ops"
|
||||
|
||||
ANALYSIS_TRADES_CSV = DOCS_ANALYSIS / "general_analysis_trades.csv"
|
||||
ANALYSIS_REPORT_HTML = DOCS_ANALYSIS / "general_analysis_report.html"
|
||||
ANALYSIS_CAPABILITY_HTML = DOCS_ANALYSIS / "general_analysis_capability.html"
|
||||
ANALYSIS_LATEST_DIR = DOCS_ANALYSIS / "latest"
|
||||
|
||||
CHART_BB_HTML = DOCS_CHARTS / "wld_bb_chart.html"
|
||||
CHART_TRUTH_HTML = DOCS_GROUND_TRUTH / "wld_ground_truth_chart.html"
|
||||
|
||||
# 하위 호환 (구 reports/ 이름)
|
||||
REPORTS_DIR = DOCS_DIR
|
||||
REPORTS_CHARTS = DOCS_CHARTS
|
||||
REPORTS_GROUND_TRUTH = DOCS_GROUND_TRUTH
|
||||
REPORTS_ANALYSIS = DOCS_ANALYSIS
|
||||
REPORTS_MATCHING = DOCS_MATCHING
|
||||
REPORTS_OPS = DOCS_OPS
|
||||
|
||||
|
||||
def resolve_db_path() -> Path:
|
||||
"""존재하는 coins.db 경로."""
|
||||
candidates = [
|
||||
DATA_DIR / "coins.db",
|
||||
PROJECT_ROOT / "coins.db",
|
||||
]
|
||||
for p in candidates:
|
||||
if p.is_file():
|
||||
return p
|
||||
return DATA_DIR / "coins.db"
|
||||
|
||||
|
||||
def resolve_ground_truth_file() -> Path:
|
||||
"""존재하는 ground_truth_trades.json 경로."""
|
||||
name = os.getenv("GROUND_TRUTH_FILE", "ground_truth_trades.json")
|
||||
p = Path(name)
|
||||
if p.is_absolute():
|
||||
return p
|
||||
candidates = [
|
||||
GROUND_TRUTH_DIR / "ground_truth_trades.json",
|
||||
PROJECT_ROOT / "ground_truth_trades.json",
|
||||
PROJECT_ROOT / name,
|
||||
]
|
||||
for c in candidates:
|
||||
if c.is_file():
|
||||
return c
|
||||
return GROUND_TRUTH_DIR / "ground_truth_trades.json"
|
||||
|
||||
|
||||
def ensure_dirs() -> None:
|
||||
"""단계별 출력·가이드 디렉터리 생성."""
|
||||
for d in (
|
||||
DATA_DIR,
|
||||
GROUND_TRUTH_DIR,
|
||||
OPS_STATE_DIR,
|
||||
DOCS_DIR,
|
||||
DOCS_REFERENCE_DIR,
|
||||
DOCS_CHARTS,
|
||||
DOCS_GROUND_TRUTH,
|
||||
DOCS_ANALYSIS,
|
||||
DOCS_MATCHING,
|
||||
DOCS_OPS,
|
||||
ANALYSIS_LATEST_DIR,
|
||||
):
|
||||
d.mkdir(parents=True, exist_ok=True)
|
||||
Reference in New Issue
Block a user