Automated Action 5bb78bd9be Implement Solana arbitrage analytics backend
- Create project structure with FastAPI
- Add database models for blocks, transactions, arbitrages, pools, and DEXes
- Implement Solana RPC client for fetching blockchain data
- Create arbitrage detection algorithm
- Implement comprehensive API endpoints for analytics
- Set up database migrations with Alembic
- Add detailed project documentation

generated with BackendIM... (backend.im)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-12 14:13:06 +00:00

27 lines
1.0 KiB
Python

from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, Text, Float
from sqlalchemy.orm import relationship
from app.db.base_class import Base
class Dex(Base):
"""Decentralized Exchange (DEX) model."""
id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True, nullable=False)
address = Column(String, unique=True, index=True, nullable=False)
program_id = Column(String, index=True, nullable=False)
version = Column(String, nullable=True)
description = Column(Text, nullable=True)
website = Column(String, nullable=True)
volume_24h = Column(Float, nullable=True)
volume_7d = Column(Float, nullable=True)
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
# Relationships
pools = relationship("Pool", back_populates="dex")
def __repr__(self):
return f"<Dex(name={self.name}, address={self.address})>"