INNER CODE UNIT · Python

get_regime_distribution

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

async def get_regime_distribution():
    """Get regime distribution from recent market snapshots."""
    if not db.is_available():
        return {"distribution": []}

    rows = db.query(
        """SELECT regime, COUNT(*) as count
           FROM market_snapshots
           WHERE snapshot_time > NOW() - INTERVAL '7 days'
           GROUP BY regime
           ORDER BY count DESC"""
    )
    return {"distribution": rows}


# ─── Signal / Alert Endpoints ───

@app.get("/api/signals")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…