Scripts vs Controllers
A controller bot is itself a script: the Hummingbot API deploys controllers by generating a config for the
v2_with_controllers.py script.
Example scripts
The Hummingbot repository ships example scripts, including:The Hummingbot API mounts its own
bots/scripts folder into each bot container, which replaces the scripts bundled in the image. Out of the box that folder holds only v2_with_controllers.py. Upload any other script before you deploy it (step 1 below).Script structure
A script has a config class that subclassesStrategyV2ConfigBase and a strategy class that subclasses StrategyV2Base. The config’s script_file_name ties a config file to its script, and update_markets() declares which connectors and pairs the bot needs.
on_tick() runs on every clock tick (once per second by default). To place orders, call self.buy(...) or self.sell(...) with a connector name, trading pair, Decimal amount and an OrderType (from hummingbot.core.data_type.common). See simple_pmm.py in the Hummingbot repository for a full order-placing example.
If you override on_stop(), make it async and call await super().on_stop(), because the base class uses it to shut down executors and market data.
Deploying a script
You need three things on the Hummingbot API server: the script, a script config, and a deploy call. All three are API calls.1
Upload the script
POST /scripts/{script_name} saves bots/scripts/{script_name}.py. The body is JSON with the file’s source in content:2
Save a script config
POST /scripts/configs/{config_name} saves bots/conf/scripts/{config_name}.yml. The config must include script_file_name, because that’s how Hummingbot knows which script to run:3
Deploy the bot
POST /bot-orchestration/deploy-v2-script starts a container that runs the config:Starting a bot from a script config requires the Hummingbot API’s config password (
CONFIG_PASSWORD) to be set. Without it the deploy fails with “Password not provided”.POST /bot-orchestration/stop-and-archive-bot/{bot_name} with the full bot name.
When to use scripts
Use scripts for:- Quick, self-contained automation
- Experiments and learning the Hummingbot framework
- Strategies you want to deploy and manage from Condor
- Running several strategies in one bot with shared drawdown limits
- Changing parameters while the bot runs

