Spaces:
Running
Running
| """Pydantic models for statistics.""" | |
| from datetime import datetime | |
| from pydantic import BaseModel, Field | |
| class FRStat(BaseModel): | |
| """Single FR statistic.""" | |
| symbol: str | |
| rate: float | |
| rate_percent: str | |
| class StatsResponse(BaseModel): | |
| """Response model for statistics endpoint.""" | |
| success: bool = True | |
| total_pairs: int = Field(..., description="Total number of USDT pairs") | |
| avg_funding_rate: float = Field(..., description="Average funding rate") | |
| avg_funding_rate_percent: str = Field(..., description="Formatted average FR") | |
| highest_fr: FRStat = Field(..., description="Coin with highest FR") | |
| lowest_fr: FRStat = Field(..., description="Coin with lowest FR") | |
| positive_count: int = Field(..., description="Count of coins with positive FR") | |
| negative_count: int = Field(..., description="Count of coins with negative FR") | |
| next_funding_in: int = Field(..., description="Seconds until next funding settlement") | |
| next_funding_time: str = Field(..., description="Next funding time in ISO format") | |
| last_updated: datetime | |