Lightweight reference implementation that showcases how Hummingbot-style market data services can stream a real-time firehose through gRPC.
Hummingbot popularized an open, high-frequency trading stack that separates the noisy market-data plane from latency-sensitive execution strategies. This repository recreates the critical pieces your client cares about:
- gRPC-first transport – async streaming APIs for tickers and order books.
- Connector layer – venues plug into a common interface (
ExchangeConnector). - Router / fan-out core – multiplex snapshots to unlimited downstream consumers with backpressure handling.
- Mock execution engine –
SubmitOrderRPC returns deterministic order IDs, so UI automation or strategy sandboxes can test end-to-end flows.
The goal is to provide production-ready scaffolding, clear documentation, and a place to extend real connectors or proprietary strategies.
hunmming-bot/
├─ proto/marketdata.proto # gRPC definitions
├─ hummingbot/
│ ├─ config.py # Pydantic config models
│ ├─ logging_config.py # Shared logging setup
│ ├─ connectors/ # Exchange connectors (mock + base class)
│ ├─ core/ # Market data router & execution engine
│ ├─ grpc/ # Generated protobuf stubs + service impl
│ └─ scripts/ # CLI entrypoints (server/client)
├─ config.example.yaml # Sample deployment config
└─ README.md # You are here
- 🔌 Connector abstraction – add CEX/DEX adapters by subclassing
ExchangeConnector. - ⚡ Market data firehose – multiplex millions of updates/min via
MarketDataRouterqueues and gRPC streaming RPCs. - 📊 Ticker + order book streaming – both aggregated top-of-book and level-2 depth snapshots.
- 🪪 Order submission mock –
SubmitOrderRPC acknowledges requests and logs execution for strategy prototyping. - 🧪 Deterministic mock venue – configure symbols, depth, and cadence via YAML to simulate venues in CI or demos.
- 🛠️ CLI tooling –
hb-serverlaunches the service,hb-clientinspects streams with Rich-powered output.
| Layer | Responsibility |
|---|---|
| Connector | WebSocket/REST ingestion, snapshot normalization |
| Router Core | Subscription registry, fan-out queues, backpressure + filtering |
| Strategy | Plug your MM/arbitrage logic here, subscribe via gRPC or direct python imports |
| Execution | ExecutionEngine placeholder for DMA/OMS integrations |
| Transport | gRPC service exposes StreamTickers, StreamOrderBook, and SubmitOrder APIs |
This mirrors production Hummingbot deployments where the data plane is decoupled from the strategy plane. You can split components into separate containers or processes as throughput requirements grow.
- Implement a real connector by subclassing
ExchangeConnectorand registering it inCONNECTOR_FACTORIES. - Replace
ExecutionEnginewith a real OMS or smart-order-router. - Add auth/TLS by customizing
run_server.py(mutual TLS, JWT, API keys, etc.). - Emit metrics by tapping into the router broadcast loop.
- Scale horizontally by running multiple connectors and using a message bus (NATS, Kafka) instead of the in-process queue.