feat: WF always reads from DB + vol bypass threshold

- buy() now always loads WF history from trade_results DB directly
  (not lazy-cached in memory) → restart-safe, no stale-history issue
- Added WF_VOL_BYPASS_THRESH (default 10.0x): if vol_ratio at entry
  exceeds this threshold, WF filter is skipped regardless of win rate
- buy() now accepts vol_ratio param; runner.py passes it from
  get_active_signals() for both fast-poll and main scan loops

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-04 10:54:52 +09:00
parent 2499ea08ef
commit ab5c963803
2 changed files with 31 additions and 12 deletions

View File

@@ -35,8 +35,9 @@ def _fast_poll_loop() -> None:
break
try:
if should_buy(ticker):
logger.info(f"[빠른감시] 매수 신호: {ticker}")
trader.buy(ticker)
vol_r = signals.get(ticker, {}).get("vol_ratio", 0.0)
logger.info(f"[빠른감시] 매수 신호: {ticker} (vol={vol_r:.1f}x)")
trader.buy(ticker, vol_ratio=vol_r)
time.sleep(0.1)
except Exception as e:
logger.error(f"[빠른감시] 오류 {ticker}: {e}")
@@ -85,8 +86,9 @@ def run_scanner() -> None:
try:
if should_buy(ticker):
logger.info(f"매수 신호: {ticker}")
trader.buy(ticker)
vol_r = get_active_signals().get(ticker, {}).get("vol_ratio", 0.0)
logger.info(f"매수 신호: {ticker} (vol={vol_r:.1f}x)")
trader.buy(ticker, vol_ratio=vol_r)
time.sleep(0.15) # API rate limit 방지
except Exception as e:
logger.error(f"스캔 오류 {ticker}: {e}")