File size: 1,078 Bytes
7b8993a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""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