first commit
This commit is contained in:
30
app/schemas/sentiment.py
Normal file
30
app/schemas/sentiment.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user