Strategy Autostart¶
Docker autostart¶
Warning
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 running via Docker Compose
- You have already run the instance at least once and have set the password and API keys
- You have at least one strategy configuration file that has been set up previously
How to autostart¶
Stop any running containers
Modify YAML file
Use an IDE like VSCode to edit the docker-compose.yml file.
Edit or add the section that defines the environment variables:
-
The
environment:line -
The
CONFIG_PASSWORDline: add the Hummingbot password to login -
For V2 scripts (including the
v2_with_controllersloader), setSCRIPT_CONFIGto the YAML file name inconf/scripts/(this maps tohummingbot_quickstart.py --v2). - For legacy V1 strategies, set
CONFIG_FILE_NAMEto the YAML file name inconf/strategies/(this maps to-f).
The final environment section of the YAML file should look something like one of these:
Afterwards, save the file.
You can auto-start either a V2 script config or a V1 strategy config:
-
V2:
SCRIPT_CONFIGpoints to a file inconf/scripts/(must includescript_file_namefor the entry script). -
V1:
CONFIG_FILE_NAMEpoints to a file inconf/strategies/. See Strategies for V1 templates.
Relaunch Hummingbot
When you attach to it, the strategy or script should already be running:
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
How to autostart¶
Running unattended Hummingbot is very similar to running Hummingbot manually. The only differences are:
- You will read the pre-existing configuration files to the
confdirectory. - You will pass some parameters telling Hummingbot which strategy configuration to use and the password to decrypt your API keys and wallets.
or, for a legacy V1 strategy:
Where
CONFIG_PASSWORD is the config password;
V2_CONFIG_YML is the file name of a YAML config in conf/scripts/;
V1_STRATEGY_YML is the file name of a YAML config in conf/strategies/.
Example:
Let's say you configured your Hummingbot password as a single letter a and you created a config for simple_pmm which you then want to autostart as soon as you start the bot:
Where:
-
ais the config password -
conf_simple_pmm_1.ymlis the V2 script config underconf/scripts/
More information on strategy can be found in Strategy.
More information on configuration file name can be found in Configuring Hummingbot.
More information on password can be found in Create a secure password.