feat: signal generator — weighted ensemble with market data

This commit is contained in:
Viktor Barzin 2026-02-22 15:36:04 +00:00
parent e483e9987f
commit f3e5fc944d
No known key found for this signature in database
GPG key ID: 0EB088298288D958
11 changed files with 1013 additions and 0 deletions

26
shared/strategies/base.py Normal file
View file

@ -0,0 +1,26 @@
"""Abstract base class for trading strategies."""
from abc import ABC, abstractmethod
from shared.schemas.trading import MarketSnapshot, SentimentContext, TradeSignal
class BaseStrategy(ABC):
"""Interface that every trading strategy must implement.
Each strategy evaluates market conditions (and optionally sentiment)
for a given ticker and returns a ``TradeSignal`` if the strategy has
an opinion, or ``None`` if it is neutral.
"""
name: str
@abstractmethod
async def evaluate(
self,
ticker: str,
market: MarketSnapshot,
sentiment: SentimentContext | None = None,
) -> TradeSignal | None:
"""Return a signal if this strategy has an opinion, ``None`` otherwise."""
...