Snippets of Python code that let users customize a strategy.
Scripts were an early experiment to let users customize strategies, but a script's functionality is limited because it runs in a separate process. Going forward, we plan to make strategies easier to create and customize, so scripts will be deprecated.
How it works¶
After configured, the script will start automatically once a strategy starts and it stops when the strategy stops. The script is run on a new dedicated process, in case where the script fails or has a bug, your main Hummingbot application can still function.
Create your own script¶
- Create a new script file, you can see examples in the Examples section below, and save it into
- Configure your Hummingbot
- Inside Hummingbot run command
conf_global.ymlfile using a text editor.
script_enabled: true script_file_path: spreads_adjusted_on_volatility_script.py
- Start running a strategy
The following examples can be found in
The most basic example only a few lines of code.
Replicates our current ping pong strategy using script.
Replicates our current price band strategy using script.
Demonstrates how to set the band around mid price moving average, the band moves as the average moves.
Demonstrates how to adjust bid and ask spreads dynamically based on price volatility.
Provides you a base template to start using the scripts functions.
Script base class¶
See this article for a description of the methods in the Script Base class.
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 them 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
rm -rf create.sh start.sh update.sh curl https://raw.githubusercontent.com/CoinAlpha/hummingbot/development/installation/docker-commands/create.sh -o create.sh curl https://raw.githubusercontent.com/CoinAlpha/hummingbot/development/installation/docker-commands/start.sh -o start.sh curl https://raw.githubusercontent.com/CoinAlpha/hummingbot/development/installation/docker-commands/update.sh -o update.sh chmod a+x *.sh