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:
47
deepcoin/data/mtf_bb.py
Normal file
47
deepcoin/data/mtf_bb.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
coins.db에서 전 간격 봉 데이터를 로드합니다.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from config import DOWNLOAD_INTERVALS, SYMBOL
|
||||
|
||||
|
||||
def interval_label(interval: int) -> str:
|
||||
"""봉 간격 표시 라벨."""
|
||||
if interval >= 1440:
|
||||
return "일봉"
|
||||
return f"{interval}분"
|
||||
|
||||
|
||||
def load_frames_from_db(
|
||||
monitor,
|
||||
symbol: str,
|
||||
lookback_days: int | None = None,
|
||||
) -> dict[int, pd.DataFrame]:
|
||||
"""
|
||||
coins.db에서 DOWNLOAD_INTERVALS 전부 로드·지표 계산.
|
||||
|
||||
Args:
|
||||
monitor: Monitor 인스턴스.
|
||||
symbol: 코인 심볼.
|
||||
lookback_days: 지정 시 간격별로 해당 일수만큼 DB에서 더 많이 읽습니다.
|
||||
|
||||
Returns:
|
||||
간격(분) → OHLCV+지표 DataFrame.
|
||||
"""
|
||||
frames: dict[int, pd.DataFrame] = {}
|
||||
for iv in DOWNLOAD_INTERVALS:
|
||||
db_max = None
|
||||
if lookback_days is not None:
|
||||
db_max = monitor.db_row_limit_for_interval(iv, lookback_days)
|
||||
df = monitor.get_coin_some_data(symbol, iv, db_max_rows=db_max)
|
||||
if df is None or df.empty:
|
||||
print(f" [{interval_label(iv)}] DB/API 데이터 없음 — 스킵")
|
||||
continue
|
||||
df = monitor.calculate_technical_indicators(df)
|
||||
frames[iv] = df
|
||||
print(f" [{interval_label(iv)}] {len(df)}봉 {df.index[0]} ~ {df.index[-1]}")
|
||||
return frames
|
||||
Reference in New Issue
Block a user