
* 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)
24 lines
800 B
Python
24 lines
800 B
Python
from sqlalchemy import Column, String, Float, Integer, Boolean, DateTime
|
|
from datetime import datetime
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Exchange(Base):
|
|
__tablename__ = "exchanges"
|
|
|
|
exchange_id = Column(String, primary_key=True, index=True)
|
|
name = Column(String, index=True)
|
|
rank = Column(Integer)
|
|
percent_total_volume = Column(Float, nullable=True)
|
|
volume_usd = Column(Float, nullable=True)
|
|
trading_pairs = Column(Integer)
|
|
socket = Column(Boolean, nullable=True)
|
|
exchange_url = Column(String, nullable=True)
|
|
updated_timestamp = Column(Integer, nullable=True)
|
|
|
|
# Last updated in our database
|
|
last_updated = Column(DateTime, default=datetime.utcnow)
|
|
|
|
def __repr__(self):
|
|
return f"<Exchange {self.exchange_id}: {self.name}>" |