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

20 lines
610 B
Python

from sqlalchemy import Column, String, Float, DateTime
from datetime import datetime
from app.core.database import Base
class Rate(Base):
__tablename__ = "rates"
id = Column(String, primary_key=True, index=True) # e.g., "bitcoin" or "usd"
symbol = Column(String, index=True)
currency_symbol = Column(String, nullable=True)
type = Column(String) # "crypto" or "fiat"
rate_usd = Column(Float)
# Last updated in our database
last_updated = Column(DateTime, default=datetime.utcnow)
def __repr__(self):
return f"<Rate {self.symbol}: {self.rate_usd} USD>"