Files
signal-platform/app/schemas/sentiment.py
Dennis Thiessen 61ab24490d
Some checks failed
Deploy / lint (push) Failing after 7s
Deploy / test (push) Has been skipped
Deploy / deploy (push) Has been skipped
first commit
2026-02-20 17:31:01 +01:00

31 lines
738 B
Python

"""Pydantic schemas for sentiment endpoints."""
from __future__ import annotations
from datetime import datetime
from typing import Literal
from pydantic import BaseModel, Field
class SentimentScoreResult(BaseModel):
"""A single sentiment score record."""
id: int
classification: Literal["bullish", "bearish", "neutral"]
confidence: int = Field(ge=0, le=100)
source: str
timestamp: datetime
class SentimentResponse(BaseModel):
"""Envelope-ready sentiment response."""
symbol: str
scores: list[SentimentScoreResult]
count: int
dimension_score: float | None = Field(
None, ge=0, le=100, description="Time-decay weighted sentiment dimension score"
)
lookback_hours: float