INNER CODE UNIT · Python

get_state

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

    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)
            if trader is not None:
                trader.set_read_only(True)
            return JSONResponse({'ok': True, 'status': 'paused'})
        elif cmd == 'resume':
            engine._data_paused = False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…