feat: initial commit of AuraTrade quant terminal and sentinel risk engine

This commit is contained in:
2026-10-22 18:36:55 +06:00
commit 9469afec0b
31 changed files with 2434 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
from fastapi import APIRouter, WebSocket, WebSocketDisconnect
from app.ws.connection_manager import ws_manager
import logging
logger = logging.getLogger("AuraTrade.WSRoutes")
ws_router = APIRouter()
@ws_router.websocket("/ws/stream")
async def websocket_endpoint(websocket: WebSocket):
"""Unified WebSocket streaming endpoint for chart ticks, telemetry, and signals."""
await ws_manager.connect(websocket)
try:
while True:
# Keep connection alive & listen for client ping or incoming commands
data = await websocket.receive_text()
# If client sends ping, respond pong
if data == "ping":
await websocket.send_text("pong")
except WebSocketDisconnect:
ws_manager.disconnect(websocket)
except Exception as e:
logger.warning(f"WebSocket client error: {e}")
ws_manager.disconnect(websocket)