
* Created FastAPI application structure * Added database models for assets, exchanges, markets, and rates * Integrated with CoinCap API * Implemented REST API endpoints * Setup SQLite persistence with Alembic migrations * Added comprehensive documentation Generated with BackendIM... (backend.im)
33 lines
623 B
Python
33 lines
623 B
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional
|
|
|
|
|
|
class RateBase(BaseModel):
|
|
id: str
|
|
symbol: str
|
|
currencySymbol: Optional[str] = None
|
|
type: str
|
|
rateUsd: str
|
|
|
|
|
|
class Rate(RateBase):
|
|
"""Data model for retrieving rates"""
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class RateCreate(RateBase):
|
|
"""Data model for creating rates"""
|
|
pass
|
|
|
|
|
|
class RateResponse(BaseModel):
|
|
"""Response model for rate endpoints"""
|
|
timestamp: int
|
|
data: Rate
|
|
|
|
|
|
class RatesResponse(BaseModel):
|
|
"""Response model for multiple rates"""
|
|
timestamp: int
|
|
data: List[Rate] |