The Problem
Deploying high‑frequency crypto trading bots requires a reliable runtime, exchange connectors, and a repeatable build pipeline. Teams often cobble together scripts, handle credential storage manually, and lack a unified way to test strategies against live markets, which leads to fragile deployments and security gaps.
What This Does
The repository is a portfolio of five self‑contained projects. The core hummingbot package (≈1 000 files) implements exchange connectors, data‑type models, and the CLI client (bin/hummingbot.py). Controllers (≈35 files) provide ready‑made strategy templates such as bollinger_v1.py and arbitrage_controller.py. Helper scripts (scripts/) and configuration stubs (conf/) support quick local setup. Docker support (Dockerfile, docker‑compose.yml) and a Makefile expose make setup / make deploy for reproducible container builds. The package is declared in pyproject.toml and installed via setup.py.
How It Is Wired
Execution begins at bin/hummingbot.py:main (line 82). main changes into the data directory (chdir_to_data_directory → filesystem via os.makedirs) and then launches the async UI loop (ui_start_handler). The UI entry (hummingbot/client/ui/hummingbot_cli.py:run) creates the HummingbotApplication object, which in turn calls run_application.
Key internal pathways (from the resolved call graph):
safe_ensure_future– invoked from 62 places, used to schedule coroutine workers (order books, user streams)._api_get– 54 callers, central to all REST queries through the web‑assistant factory.create_throttler→AsyncThrottler– 35 callers, throttles exchange rate‑limit compliance.
The most‑connected hub is hummingbot/core/data_type/common (301 inbound imports). It is a stability anchor; any change ripples through most of the codebase. Circular imports involve hummingbot/core/web_assistant/connections/data_types, hummingbot/core/data_type/trade_fee, and hummingbot/core/web_assistant/web_assistants_factory, increasing cognitive load for refactors.
External effects are minimal and clearly traced:
- Filesystem:
main → chdir_to_data_directory(creates data dir). - Files:
load_strategy_config_map_from_file → load_yml_into_cm_legacy(reads strategy YAML). - Subprocess:
quick_start → autofix_permissions(runssubprocess.run). - Network: connector classes (e.g.,
aevo_perpetual_derivative.py) issue HTTP calls via_api_getand_api_post. - Crypto: authenticators in connector classes generate signed requests.
The call graph shows that changing a hub module or any of the 20+ functions listed above will have the widest blast radius because they are referenced from dozens of distinct callers.
How To Use It
# Clone the exact repo
git clone https://github.com/moses-y/hummingbot
cd hummingbot
# Build and start the container (Docker Compose)
make setup # installs dependencies, builds the image
make deploy # runs docker-compose up -d
# Attach to the running CLI
docker attach hummingbot
Configuration files live under conf/ (e.g., conf/connectors/ for exchange keys). The CLI reads client_config_map.yml via hummingbot/client/config/config_helpers.py. To run a custom controller, place the Python file under controllers/ and reference it from the UI menu.
Real‑World Use
A prop‑trading desk can spin up a Docker instance, drop a new controller such as controllers/generic/arbitrage_controller.py, supply API keys in conf/connectors/, and start the bot with docker attach hummingbot. The desk then monitors live P&L via the built‑in UI, while the container isolates the runtime from the host.
Code Health & Issues
- High – Pin GitHub Actions –
.github/workflows/*.ymluses tags (@v3). Replace with 40‑char commit SHA. - High – Add lockfile –
pyproject.tomlhas no lockfile; generate and commitpoetry.lock/uv.lock. - High – Remove privileged/host networking –
docker-compose.ymlsetsnetwork_mode: hostandprivileged: true. Use explicitports:andcap_add. - Medium – Least‑privilege GITHUB_TOKEN – workflows omit
permissions:; addcontents: read. - Medium – Enable Dependabot – No
.github/dependabot.yml; add one for Python and Docker. - Medium – Pin base image by digest –
Dockerfileusescontinuumio/miniconda3:latest. Replace with@sha256:digest. - Medium – Add vulnerability scan – No dependency‑review step; integrate
dependency-review-actionorosv-scanner. - Medium – Run as non‑root user – Dockerfile lacks
USER; create an unprivileged user and setUSER. - Low – Set workflow timeouts –
.github/workflows/docker_buildx_workflow.ymlhas notimeout-minutes; add reasonable limits.
Other hygiene: tests are present (test/), CI runs via GitHub Actions, license is Apache 2.0, no secrets in history.
The Bottom Line
The repo delivers a full‑stack, Docker‑ready Hummingbot framework with a rich set of connectors and strategy templates. Its codebase is functional but hampered by deep import cycles, high‑complexity hub modules, and several security‑hardening gaps in the build pipeline. Teams comfortable with Python and Docker can adopt it quickly, but should address the high‑severity CI and container hardening issues before production use.