INNER CODE UNIT · Python
live_dashboard
YichengYang-Ethan/oracle3 · oracle3/dashboard/server.py:301
async def live_dashboard():
"""Serve the live trading dashboard HTML."""
return FileResponse(STATIC_DIR / 'live.html', media_type='text/html')
@app.get('/api/state')
async def get_state():
"""One-shot full state snapshot."""
return JSONResponse(_serialize_snapshot(engine))
@app.post('/api/command/{cmd}')
async def send_command(cmd: str):
"""Execute a control command (pause/resume/stop)."""
if cmd == 'pause':
engine._data_paused = True
strategy = getattr(engine, 'strategy', None)
trader = getattr(engine, 'trader', None)
if strategy is not None:
strategy.set_paused(True)