trading/shared/schemas/learning.py

33 lines
727 B
Python
Raw Normal View History

"""Learning domain Pydantic schemas."""
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, Field
class TradeOutcomeSchema(BaseModel):
"""Represents the evaluated outcome of a closed trade."""
trade_id: UUID
hold_duration_seconds: float = Field(ge=0)
realized_pnl: float
roi_pct: float
was_profitable: bool
model_config = {"from_attributes": True}
class WeightAdjustment(BaseModel):
"""Represents a strategy weight change made by the learning engine."""
strategy_id: UUID
strategy_name: str
old_weight: float
new_weight: float
reason: str
reward_signal: float
timestamp: datetime
model_config = {"from_attributes": True}