INNER CODE UNIT · Python

get_trades

GifariKemal/xaubot-ai · web-dashboard/api/main.py:142

async def get_trades(
    page: int = Query(1, ge=1),
    limit: int = Query(25, ge=1, le=100),
    direction: str = Query("ALL"),
    start_date: Optional[str] = None,
    end_date: Optional[str] = None,
):
    """Get paginated trade history."""
    if not db.is_available():
        return {"trades": [], "total": 0, "page": page, "limit": limit}

    where = ["closed_at IS NOT NULL"]
    params = []

    if direction and direction != "ALL":
        where.append("direction = %s")
        params.append(direction.upper())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…