Files
signal-platform/app/schemas/sr_level.py
Dennis Thiessen 181cfe6588
Some checks failed
Deploy / lint (push) Failing after 8s
Deploy / test (push) Has been skipped
Deploy / deploy (push) Has been skipped
major update
2026-02-27 16:08:09 +01:00

41 lines
947 B
Python

"""Pydantic schemas for S/R level endpoints."""
from __future__ import annotations
from datetime import datetime
from typing import Literal
from pydantic import BaseModel, Field
class SRLevelResult(BaseModel):
"""A single support/resistance level."""
id: int
price_level: float
type: Literal["support", "resistance"]
strength: int = Field(ge=0, le=100)
detection_method: Literal["volume_profile", "pivot_point", "merged"]
created_at: datetime
class SRZoneResult(BaseModel):
"""A clustered S/R zone spanning a price range."""
low: float
high: float
midpoint: float
strength: int = Field(ge=0, le=100)
type: Literal["support", "resistance"]
level_count: int
class SRLevelResponse(BaseModel):
"""Envelope-ready S/R levels response."""
symbol: str
levels: list[SRLevelResult]
zones: list[SRZoneResult] = []
visible_levels: list[SRLevelResult] = []
count: int