
* 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)
37 lines
832 B
Python
37 lines
832 B
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional
|
|
|
|
|
|
class ExchangeBase(BaseModel):
|
|
exchangeId: str
|
|
name: str
|
|
rank: str
|
|
percentTotalVolume: Optional[str] = None
|
|
volumeUsd: Optional[str] = None
|
|
tradingPairs: str
|
|
socket: Optional[bool] = None
|
|
exchangeUrl: Optional[str] = None
|
|
updated: Optional[int] = None
|
|
|
|
|
|
class Exchange(ExchangeBase):
|
|
"""Data model for retrieving exchanges"""
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class ExchangeCreate(ExchangeBase):
|
|
"""Data model for creating exchanges"""
|
|
pass
|
|
|
|
|
|
class ExchangeResponse(BaseModel):
|
|
"""Response model for exchange endpoints"""
|
|
timestamp: int
|
|
data: Exchange
|
|
|
|
|
|
class ExchangesResponse(BaseModel):
|
|
"""Response model for multiple exchanges"""
|
|
timestamp: int
|
|
data: List[Exchange] |