feat: AI agent, signal engine, surge detector, portfolio simulator
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
20
engine/surge.py
Normal file
20
engine/surge.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class SurgeDetector:
|
||||
def __init__(self, multiplier: float = 3.0):
|
||||
self.multiplier = multiplier
|
||||
|
||||
def detect(self, tickers: list[dict], avg_volumes: dict[str, float]) -> list[str]:
|
||||
surged = []
|
||||
for t in tickers:
|
||||
symbol = t["symbol"]
|
||||
if not symbol.endswith("USDT"):
|
||||
continue
|
||||
current_vol = float(t.get("quoteVolume", 0))
|
||||
avg_vol = avg_volumes.get(symbol, 0)
|
||||
if avg_vol > 0 and current_vol >= avg_vol * self.multiplier:
|
||||
logger.info(f"Surge detected: {symbol} volume {current_vol:.0f} vs avg {avg_vol:.0f}")
|
||||
surged.append(symbol)
|
||||
return surged
|
||||
Reference in New Issue
Block a user