Automated Action 3a29a346a9 Initial implementation of cryptocurrency data API service using CoinCap API
* 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)
2025-05-14 12:18:27 +00:00

28 lines
1.0 KiB
Python

from sqlalchemy import Column, String, Float, Integer, DateTime
from datetime import datetime
from app.core.database import Base
class Market(Base):
__tablename__ = "markets"
id = Column(Integer, primary_key=True, autoincrement=True)
exchange_id = Column(String, index=True)
rank = Column(Integer, nullable=True)
base_symbol = Column(String, index=True)
base_id = Column(String, index=True)
quote_symbol = Column(String, index=True)
quote_id = Column(String, index=True)
price_quote = Column(Float, nullable=True)
price_usd = Column(Float, nullable=True)
volume_usd_24hr = Column(Float, nullable=True)
percent_exchange_volume = Column(Float, nullable=True)
trades_count_24hr = Column(Integer, 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"<Market {self.exchange_id}: {self.base_symbol}/{self.quote_symbol}>"