How to Run Multiple Gunbot Instances
Running multiple instances of Gunbot is straightforward: duplicate the Gunbot folder for each instance and assign distinct settings so each bot runs independently.
Info
A Gunbot instance refers to a single, independently running copy of the Gunbot software. Running multiple instances allows you to operate several bots simultaneously, often with different configurations or on different exchanges.
Why Run Multiple Instances?
In most cases, a single Gunbot instance is enough. One Gunbot can trade many assets on many exchanges.
Multiple instances can be useful for spreading risk, operating nearer to an exchange, optimizing processing speed, or other setup tuning.
Step-by-Step Guide
Step 1: Duplicate the Gunbot Folder
For each instance of Gunbot you want to run, create a copy of the Gunbot folder. This ensures each instance operates independently without interfering with others.
- Naming Your Instances: When duplicating the Gunbot folder, consider renaming each folder to reflect the strategy or exchange used, such as
Gunbot-Binance-BTCorGunbot-Kraken-ETH. This makes it easy to identify each instance when running multiple bots. - Backup: Before making changes, back up your configuration files so you can restore your settings if something goes wrong.
Step 2: Unique Configuration for Each Instance
Each Gunbot instance must have unique settings to function correctly. Pay special attention to these parameters:
- Port Settings: The
portsetting, found in both the GUI andwssections, must be unique for each instance. This lets you access each GUI onlocalhostwith a different port.- Example: If your first instance uses port
3001, set the next instance to3002. Avoid conflicts by incrementing the port number for each new instance.
- Example: If your first instance uses port
- Clientport Setting: In the
wssection, ensure that theclientportis distinct for each instance. This is required for WebSocket communication.- Example: If one instance uses
clientport 5020, the next should use5021. Track your port numbers to avoid overlaps.
- Example: If one instance uses
- Telegram Token: The
TOKENin thebotsection is used for Telegram notifications. Each instance should have its own unique token.- To get a new token for each instance, create a separate Telegram bot per instance so notifications stay separate.
- Database Paths: If you're using the built-in database, make sure each instance uses a different file path. Otherwise, instances can overwrite each other's data.
- Log Files: Consider customizing log file paths for each instance. This helps with troubleshooting so you can identify which instance encountered an issue.
Step 3: Edit the config.js File for Each Trading Bot
To make these changes, use a text editor like Notepad++. Carefully edit the config.js file in each Gunbot folder, ensuring the parameters above are unique for each instance.
- Organize Your Configurations: Group instance-specific settings (like ports, tokens, and paths) near the top of your configuration file. This makes future edits easier, especially when scaling up.
- Configuration Variables: If you frequently adjust the same settings across multiple instances, consider creating a template configuration file with placeholders. This saves time when setting up new instances by letting you replace placeholders with instance-specific details.
info
Remember, consistency in configuration is key. Double-check each setting to ensure each instance runs smoothly and independently.
Step 4: Run Your Instances
Once all settings have been configured uniquely, you can run each instance. Ensure that you:
- Launch Each Instance Separately: Open a new terminal window for each Gunbot instance and launch them independently. This helps prevent errors and allows you to monitor output in real time.
- Monitor Resource Usage: Running multiple instances can consume additional system resources. Keep an eye on CPU and memory usage to ensure your system can handle multiple bots without slowing down.
- Testing: After launching, verify each instance is functioning correctly by checking the GUI, confirming each bot connects to its exchange, and receiving notifications from Telegram.
Step 5: Scaling Up Your Trading Bot Farm
As you get comfortable with running multiple instances, you might want to scale up. Here are some tips for efficient scaling:
- Automated Scripts: Consider writing simple batch or shell scripts to start all instances at once, reducing manual work.
- Centralized Monitoring: Use external tools or dashboards to monitor the performance and status of all running instances in one place. This simplifies management and helps identify issues quickly.
- Server Deployment: For more advanced users, consider deploying Gunbot instances on remote servers closer to the exchange servers. This can help reduce latency, which is especially useful for high-frequency trading strategies.
By following these steps and tips, you can manage multiple Gunbot instances, each tailored to your specific trading strategies and goals.
Bonus Feature: Gunbot Monitor
Managing multiple Gunbot instances? While the built-in interface offers everything you need, Gunbot Monitor adds centralized management. It lets you oversee all your running bots from a single dashboard, making it easier to track performance and control settings remotely. It's an extra designed for power users. Learn more about Gunbot Monitor