Skip to content
dgbit GitHub

// architecture

A pipeline tuned for strategy iteration.

dgbit is a four-layer stack where each layer has one responsibility. The message bus between the workers is NNG IPC, not HTTP — so a backtest worker can lift a strategy module straight into the live engine without a serialization rewrite.

┌──────────────────────────────────────────────────────────┐
│ 01  Vue 3 dashboard   charts · portfolio · monitoring     │
└───────────────────────────┬──────────────────────────────┘
                    HTTP + WebSocket
┌───────────────────────────┴──────────────────────────────┐
│ 02  FastAPI REST      /backtests /jobs /data /strategies  │
│     + WebSocket        /execution  · /api/ws/events       │
└───────────────────────────┬──────────────────────────────┘
                    NNG IPC bus (ipc:///tmp/dgbit_cmd.ipc)
┌───────────────────────────┴──────────────────────────────┐
│ 03  Workers           data service · backtest worker ·    │
│                       strategy service                    │
└───────────────────────────┬──────────────────────────────┘
                    imports the shared library
┌───────────────────────────┴──────────────────────────────┐
│ 04  Trading core      strategies · backtesting ·          │
│                       position tracking · BybitDataFetcher │
└──────────────────────────────────────────────────────────┘

The four layers

01 · Vue 3 dashboard

Charts, portfolio view, strategy state, and monitoring. Talks to the API over HTTP and subscribes to the WebSocket event stream.

02 · FastAPI REST + WebSocket

Async endpoints for /backtests, /jobs, /data, /strategies, and /execution, plus a live event stream at /api/ws/events (job.*, trade.*, signal.generated).

03 · NNG IPC worker bus

The data service, backtest worker, and strategy service exchange messages over NNG IPC rather than HTTP — so passing a strategy between workers needs no serialization rewrite.

04 · Shared trading core

Strategies, backtesting, position tracking, and the Bybit data fetcher. Imported equally by the workers, the API, and your own scripts — the reason a backtested strategy lifts straight into live.

The single-exchange scope is what makes this clean: because the trading core targets Bybit directly, the fee model, kline boundaries, and order assumptions in the backtester map one-to-one to live behavior. There is no CCXT-style abstraction hiding a mismatch between simulated and real fills.

Run it end to end.

docker-compose brings every layer up together. Or import the core and run a backtest in eight lines.