feat(kevin_bridge): main orchestrator with dependency injection
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled

Composable: cursor/aggregator/strategy/publisher/audit_writer/broker
all injected. Master kill-switch (kevin_enable_trading=false) routes to
audit-only path. Cursor advances ONLY after XADD succeeds (race fix).
Concrete collaborators wired in subsequent tasks.

Also extends TradeSignal + SignalDirection.EXIT with the optional
fields Kevin paths need (strategy_id, target_dollars, stop_loss_pct,
take_profit_pct).
This commit is contained in:
Viktor Barzin 2026-05-24 00:59:56 +00:00
parent cd75c4ab7e
commit adbd7f3c65
6 changed files with 461 additions and 2 deletions

View file

@ -1,6 +1,7 @@
"""Trading-related Pydantic schemas for Redis Streams messages and API payloads."""
from datetime import datetime
from datetime import UTC, datetime
from decimal import Decimal
from enum import Enum
from typing import Any
from uuid import UUID, uuid4
@ -30,6 +31,7 @@ class SignalDirection(str, Enum):
LONG = "LONG"
SHORT = "SHORT"
NEUTRAL = "NEUTRAL"
EXIT = "EXIT"
# ---------------------------------------------------------------------------
@ -102,7 +104,13 @@ class TradeSignal(BaseModel):
strength: float = Field(ge=0.0, le=1.0)
strategy_sources: list[str]
sentiment_context: dict[str, Any] | None = None
timestamp: datetime
timestamp: datetime = Field(default_factory=lambda: datetime.now(UTC))
# --- Kevin v2 extensions (optional) ---
strategy_id: UUID | None = None
target_dollars: Decimal | None = None
stop_loss_pct: Decimal | None = None
take_profit_pct: Decimal | None = None
model_config = {"from_attributes": True}