Sample Scripts
How to Run Scripts¶
In the Hummingbot client, run a script with:
Scripts can be created both with and without config files. To create a configuration file for your script, execute:
This command auto-completes with scripts from the local /scripts
directory that are configurable. You'll be prompted to specify strategy parameters, which are then saved in a YAML file within the conf/scripts
directory. To run the script, use:
Starting Scripts¶
All sample scripts below can be found in the root /scripts folder and are available to run from the Hummingbot client by default.
Simple PMM¶
- Code: simple_pmm
- Author: cardosofede
- Release Added: Configurable 1.25.0 | 1.9.0
- Description: The bot will place two orders around the
price_source
(mid price or last traded price) in atrading_pair
on exchange, with a distance defined by theask_spread
andbid_spread
. Everyorder_refresh_time
in seconds, the bot will cancel and replace the orders.
Simple VWAP¶
- Code: simple_vwap
- Author: cardosofede
- Release Added: 1.7.0
- Description: This example lets you create one VWAP in a market using a percentage of the sum volume of the order book until a spread from the mid price. This example demonstrates:
- How to get the account balance
- How to get the bids and asks of a market
- How to code a "utility" strategy
Simple XEMM¶
- Code: simple_xemm
- Author: fengtality
- Release Added: 1.10.0
- Description: A simplified version of the Cross Exchange Market Making strategy, this bot makes a market on the maker pair and hedges any filled trades in the taker pair. If the spread (difference between maker order price and taker hedge price) dips below
min_spread
, the bot refreshes the order
AMM Data Feed¶
- Code: amm_data_feed_example
- Author: fengtality
- Release Added: 2.4.0
- Description: Demonstrates using
AmmGatewayDataFeed
in Hummingbot to fetch real-time price data from decentralized exchanges (DEXs) such as Uniswap (Ethereum) and Jupiter (Solana). The script initializes two AMM data feeds for specified trading pairs and displays their latest price data when ready.
AMM Trade¶
- Code: amm_trade_example
- Author: fengtality
- Release Added: 2.5.0
- Description: Monitors real-time DEX prices using the Gateway connector and automatically executes swaps once specified price thresholds are reached. The script allows users to configure conditions (price above or below a target) and handles trade execution seamlessly on decentralized exchanges like Jupiter on Solana or Uniswap on Ethereum.
LP Manage Position¶
- Code: lp_manage_position
- Author: fengtality
- Release Added: 2.8.0
- Description: Manages liquidity positions on AMM or CLMM pools via Gateway. The script monitors pool prices, opens a position when a target price is reached, and automatically closes the position if the price moves out of range for a specified duration. Supports both traditional AMM pools and concentrated liquidity pools on protocols like Raydium, Uniswap, and Meteora.
Download Order Book and Trades¶
- Code: download_order_book_and_trades
- Author: cardosofede
- Release Added: 2.3.0
- Description: Continuously captures and stores live trade data and order book snapshots for specified trading pairs from a selected exchange. This strategy writes data to daily
.txt
files in JSON format, ideal for market data analysis, backtesting, or creating custom datasets from exchanges like Binance using Hummingbot.
Wallet Hedge Example¶
- Code: wallet_hedge_example
- Author: fengtality
- Release Added: 2.4.0
- Description: Uses the
WalletTrackerDataFeed
to monitor on-chain wallet balances and automatically hedges any balance changes by placing market orders on a centralized exchange. Ideal for maintaining a neutral position between a wallet (e.g. on Ethereum Goerli) and an exchange like KuCoin, this strategy triggers buy/sell orders once the balance delta exceeds a defined threshold.
V2 Scripts¶
These scripts are more complex and use StrategyV2 components such as Executors and the Market Data Provider.
V2 Controller Loader¶
- Code: v2_with_controllers
- Author: cardosofede
- Release Added: 1.26.0
- Description: This script provides a template for launching Controllers that implement specific sub-strategies. This strategy is flexible and can be adapted to various trading scenarios by implementing custom controllers.
V2 Directional RSI¶
- Code: v2_directional_rsi
- Author: cardosofede
- Release Added: 1.26.0
- Description: This utilizes RSI indicators to generate buy or sell signals based on predefined RSI thresholds. It utilizes PositionExecutors to manage positions with stop-loss and take-profit levels defined by a triple barrier logic.
V2 Funding Rate Arbitrage¶
- Code: v2_funding_rate_arb.py
- Author: cardosofede
- Release Added: 1.27.0
- Description: This script sets up configurations for trading pairs, leverage, and connectors, and initiates market positions based on funding rate differences between exchanges. The strategy continuously monitors funding rates and calculates potential profitability after fees, creating and managing positions accordingly. It also evaluates conditions to take profits or stop losses based on funding rate differences and trading profitability. The script logs and reports its operations and the status of active arbitrage positions.
V2 TWAP¶
- Code: v2_twap_multiple_pairs.py
- Author: cardosofede
- Release Added: 1.26.0
- Description: This script utilizes TWAPExecutors to buy/sell a block of assets.
Other Scripts¶
Other example scripts can be found in sub-folders in the scripts folder:
- Basic: Scripts that peform basic operations (good for beginner script developers)
- Community: Strategies created by Botcamp participants
- Gateway: Scripts that utilize Gateway
- Utility: Scripts that fetch data, screen markets, and perform other functions
To make a script available to run inside Hummingbot, copy or move the file into the root /scripts
folder. For example: