feat: signal generator — weighted ensemble with market data
This commit is contained in:
parent
e483e9987f
commit
f3e5fc944d
11 changed files with 1013 additions and 0 deletions
26
shared/strategies/base.py
Normal file
26
shared/strategies/base.py
Normal 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."""
|
||||
...
|
||||
Loading…
Add table
Add a link
Reference in a new issue