Files
signal-platform/app/schemas/indicator.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

50 lines
1.0 KiB
Python

"""Pydantic schemas for technical indicator endpoints."""
from __future__ import annotations
from datetime import date
from typing import Any, Literal
from pydantic import BaseModel, Field
class IndicatorRequest(BaseModel):
"""Query parameters for indicator computation."""
start_date: date | None = None
end_date: date | None = None
period: int | None = None
class IndicatorResult(BaseModel):
"""Raw indicator values plus normalized score."""
indicator_type: str
values: dict[str, Any]
score: float = Field(ge=0, le=100)
bars_used: int
class IndicatorResponse(BaseModel):
"""Envelope-ready indicator response."""
symbol: str
indicator: IndicatorResult
class EMACrossResult(BaseModel):
"""EMA cross signal details."""
short_ema: float
long_ema: float
short_period: int
long_period: int
signal: Literal["bullish", "bearish", "neutral"]
class EMACrossResponse(BaseModel):
"""Envelope-ready EMA cross response."""
symbol: str
ema_cross: EMACrossResult