/
Launch Hummingbot Miner

Docker Commands

Info and usage of Docker Commands for Hummingbot


Docker commands

CommandDescription
docker psList all running containers
docker ps -aList all created containers (including stopped containers)
docker attach [instance_name]Connect to a running Docker container
docker start [instance_name]Start a stopped container
docker inspect [instance_name]View details of a Docker container, including details of mounted folders

More commands can be found in Docker Documentation.

Docker scripts

These commands execute the helper scripts for running Hummingbot and are performed from the terminal or shell. Ensure that the scripts are located in your current directory before running these commands.

CommandFunction
./create.shCreates a new instance of Hummingbot
./start.shConnect to a running instance or restart an exited Hummingbot instance
./update.shUpdate Hummingbot version

Tip: Run the command ls -l to check the files in your current working directory.

Updating your scripts

We sometimes add/remove/edit commands in the helper scripts along with certain new features like the Scripts we released in version 0.29.0 and you would need to update your scripts.

Copy the commands below and paste into the shell or terminal to delete the old scripts and download the most recently updated ones.

rm -rf create.sh start.sh update.sh
wget https://raw.githubusercontent.com/CoinAlpha/hummingbot/development/installation/docker-commands/create.sh
wget https://raw.githubusercontent.com/CoinAlpha/hummingbot/development/installation/docker-commands/start.sh
wget https://raw.githubusercontent.com/CoinAlpha/hummingbot/development/installation/docker-commands/update.sh
chmod a+x *.sh

Docker Autostart

Warning: This is a recently released experimental feature. Running any trading bots without manual supervision may incur additional risks. It is imperative that you thoroughly understand and test the strategy and parameters before deploying bots that can trade in an unattended manner.

Hummingbot can automatically start the execution of a previously configured trading strategy upon launch, without needing user interaction, when provided with pre-existing configuration files. This can be very useful if you wish to deploy already well-tested strategies and configurations to cloud services, and have Hummingbot running automatically in the background.

Prerequisites

  • You have Hummingbot installed via Docker
  • You have already connected exchanges by adding API keys
  • You have at least one strategy configuration file that has been set up previously

Locating config files

If you used the Scripts method via Docker, the configuration folder is the path printed at the => config files: line, when you run ./create.sh.

If you used the Manual method, the configuration folder is $(pwd)/hummingbot_files/hummingbot_conf at the time when you run docker run.

If your Hummingbot docker instance is already running, you can inspect the volume mount paths of your Hummingbot container with the following command:

docker inspect ${HUMMINGBOT_CONTAINER_NAME} --format='{{.Mounts}}'

The configuration folder is the mount path that corresponds to /conf in the volume mounts listing.

How to autostart

An unattended Hummingbot installation is very similar to the Docker manual installation steps. The only differences are:

  1. You will copy the pre-existing configuration files to the hummingbot_conf directory.
  2. You will set some environment variables telling Hummingbot which strategy configuration to use, and the password to decrypt your API keys and wallets.
# 1) Create folder for your new instance
mkdir hummingbot_files

# 2) Create folders for logs, config files and database file
mkdir hummingbot_files/hummingbot_conf
mkdir hummingbot_files/hummingbot_logs
mkdir hummingbot_files/hummingbot_data

# 3) Copy config files from pre-existing config folder
cp -a <existing config path>/*.yml <existing config path>/*.json hummingbot_files/hummingbot_conf/

# 4) Set environment variables specifying the strategy config file to use, and the decryption password
export STRATEGY=<strategy name>
export CONFIG_FILE_NAME=<strategy config file name>
export CONFIG_PASSWORD=<config password>

# 5) Launch unattended instance of Hummingbot
docker run -d \
  --name hummingbot-instance \
  --network host \
  --mount "type=bind,source=$(pwd)/hummingbot_files/hummingbot_conf,destination=/conf/" \
  --mount "type=bind,source=$(pwd)/hummingbot_files/hummingbot_logs,destination=/logs/" \
  --mount "type=bind,source=$(pwd)/hummingbot_files/hummingbot_data,destination=/data/" \
  -e STRATEGY -e CONFIG_FILE_NAME -e CONFIG_PASSWORD \
  coinalpha/hummingbot:latest

# 6) Clean up
unset STRATEGY CONFIG_FILE_NAME CONFIG_PASSWORD

The Hummingbot instance will be running in the background. You can bring it to foreground via

docker attach hummingbot-instance

You can then detach from the container and put it back to the background by pressing CTRL-p and then CTRL-q.

Optional commands

Use Docker's restart policy to always restart the container if it exits.

docker run -it --restart=always \ ...

Adding the option -d or --detach will start the container without attaching.

docker run -itd \ ...

More information can be found in Docker documentation.

Source Autostart

Prerequisites

  • You have Hummingbot installed via Source.
  • You have already connected exchanges by adding API keys
  • You have at least one strategy configuration file that has been set up previously

Locating config files

Whichever you used was it the Scripts or Manual method from Source, the configuration folder is located inside the hummingbot folder, the path is where you installed your Hummingbot.

How to autostart

Running unattended Hummingbot is very similar to the running hummingbot manually. The only differences are:

  • You will read the pre-existing configuration files to the conf directory.
  • You will pass some parameters telling Hummingbot which strategy configuration to use, and the password to decrypt your API keys and wallets.
bin/hummingbot_quickstart.py -s STRATEGY -f CONFIG_FILE_NAME -p CONFIG_PASSWORD

Where
STRATEGY is the strategy name
CONFIG_FILE_NAME is the strategy config file name
CONFIG_PASSWORD is the config password

Edit on GitHub