feat: volume-lead strategy with compounding, WF filter, and DB-backed simulation
- core/strategy.py: replace trend strategy with volume-lead accumulation (vol spike + 2h quiet → signal, +4.8% rise → entry) - core/trader.py: compound budget adjusts on both profit and loss (floor 30%) - core/notify.py: add accumulation signal telegram notification - ohlcv_db.py: Oracle ADB OHLCV cache (insert, load, incremental update) - sim_365.py: 365-day compounding simulation loading from DB - krw_sim.py: KRW-based simulation with MAX_POSITIONS constraint - ticker_sim.py: ticker count expansion comparison - STRATEGY.md: full strategy documentation - .gitignore: exclude *.pkl cache files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import pyupbit
|
||||
|
||||
from .market import get_current_price
|
||||
from .market_regime import get_regime
|
||||
from .notify import notify_signal
|
||||
from .price_db import get_price_n_hours_ago
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -112,6 +113,17 @@ def should_buy(ticker: str) -> bool:
|
||||
logger.info(
|
||||
f"[축적감지] {ticker} 거래량 급증 + 2h 횡보 → 신호가={current:,.2f}원"
|
||||
)
|
||||
# 거래량 비율 계산 후 알림 전송
|
||||
try:
|
||||
fetch_count = LOCAL_VOL_HOURS + 3
|
||||
df_h = pyupbit.get_ohlcv(ticker, interval="minute60", count=fetch_count)
|
||||
if df_h is not None and len(df_h) >= LOCAL_VOL_HOURS + 1:
|
||||
recent_vol = df_h["volume"].iloc[-2]
|
||||
local_avg = df_h["volume"].iloc[-(LOCAL_VOL_HOURS + 1):-2].mean()
|
||||
ratio = recent_vol / local_avg if local_avg > 0 else 0
|
||||
notify_signal(ticker, current, ratio)
|
||||
except Exception:
|
||||
notify_signal(ticker, current, 0.0)
|
||||
return False # 신호 첫 발생 시는 진입 안 함
|
||||
|
||||
# ── 신호 있음: 상승 확인 → 진입 ─────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user