41 lines
800 B
Python
41 lines
800 B
Python
from pydantic import BaseModel, Field
|
|
from typing import List, Optional, Dict, Any
|
|
from datetime import datetime
|
|
|
|
|
|
class ExchangeBase(BaseModel):
|
|
exchange_id: str
|
|
name: str
|
|
rank: str
|
|
percent_total_volume: Optional[str] = None
|
|
volume_usd: Optional[str] = None
|
|
trading_pairs: str
|
|
socket: Optional[bool] = None
|
|
exchange_url: Optional[str] = None
|
|
updated: int
|
|
|
|
|
|
class ExchangeCreate(ExchangeBase):
|
|
pass
|
|
|
|
|
|
class ExchangeInDB(ExchangeBase):
|
|
last_updated: datetime
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
|
|
|
|
class ExchangesResponse(BaseModel):
|
|
data: List[ExchangeBase]
|
|
timestamp: int
|
|
|
|
|
|
class SingleExchangeResponse(BaseModel):
|
|
data: ExchangeBase
|
|
timestamp: int
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
error: str
|
|
timestamp: Optional[int] = None |