INNER CODE UNIT · Python

_build_dashboard_app

YichengYang-Ethan/oracle3 · oracle3/dashboard/server.py:280

def _build_dashboard_app(engine: 'TradingEngine'):  # noqa: C901
    """Build the FastAPI app with WebSocket and REST endpoints."""
    try:
        from fastapi import FastAPI, WebSocket
        from fastapi.responses import FileResponse, JSONResponse
    except ImportError as exc:
        raise RuntimeError(
            'FastAPI not installed. Install with: pip install fastapi uvicorn'
        ) from exc

    app = FastAPI(title='Oracle3 Dashboard', version='1.0.0')

    # Track active WebSocket connections for broadcasting
    ws_clients: set[Any] = set()

    @app.get('/')
    async def index():
        """Serve the dashboard HTML."""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…