Local changes: Updated model training, removed debug instrumentation, and configuration improvements

This commit is contained in:
kfox
2025-12-26 01:15:43 -05:00
commit cc60da49e7
388 changed files with 57127 additions and 0 deletions

42
backend/api/exchanges.py Normal file
View File

@@ -0,0 +1,42 @@
"""Exchange API endpoints."""
from typing import List
from fastapi import APIRouter, HTTPException
from sqlalchemy import select
from ..core.schemas import ExchangeResponse
from src.core.database import Exchange, get_database
router = APIRouter()
@router.get("/", response_model=List[ExchangeResponse])
async def list_exchanges():
"""List all exchanges."""
try:
db = get_database()
async with db.get_session() as session:
stmt = select(Exchange).order_by(Exchange.name)
result = await session.execute(stmt)
exchanges = result.scalars().all()
return [ExchangeResponse.model_validate(e) for e in exchanges]
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@router.get("/{exchange_id}", response_model=ExchangeResponse)
async def get_exchange(exchange_id: int):
"""Get exchange by ID."""
try:
db = get_database()
async with db.get_session() as session:
stmt = select(Exchange).where(Exchange.id == exchange_id)
result = await session.execute(stmt)
exchange = result.scalar_one_or_none()
if not exchange:
raise HTTPException(status_code=404, detail="Exchange not found")
return ExchangeResponse.model_validate(exchange)
except HTTPException:
raise
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))