Skip to main content

How to Run Multiple Gunbot Instances

Running multiple instances of Gunbot is a straightforward process. By duplicating the Gunbot folder for each instance and ensuring distinct settings, you can efficiently operate multiple bots.

Why multiple instances?

In most cases, a single Gunbot instance is enough. A single Gunbot can trade many assets, on many exchanges.

Splitting up to multiple instances can be useful to spread risk, operate nearer to an exchange, optimize processing speed, or similar setup tuning.

Here's a step-by-step guide to get you started:

Step 1: Duplicate the Gunbot Folder

For each instance of Gunbot you want to run, create a copy of the Gunbot folder. This ensures that each instance operates independently without interfering with the others.

  • Naming Your Instances: When duplicating the Gunbot folder, consider renaming each folder to reflect the strategy or exchange used. For example, Gunbot-Binance-BTC or Gunbot-Kraken-ETH. This helps to easily identify which instance you are working with, especially when running multiple bots simultaneously.
  • Backup: Before making any changes, it's always a good idea to back up your configuration files. In case something goes wrong, you can easily restore your settings without losing progress.

Step 2: Unique Configuration for Each Instance

Each Gunbot instance must have unique settings to function correctly. Pay special attention to the following parameters:

  • Port Settings: The port setting, found in both the GUI and ws sections, must be unique for each instance. This allows you to access the GUI of each instance separately on localhost via the specified port.

    • Example: If your first instance is using port 5000, set the next instance to 5001. Avoid conflicts by incrementing the port number for each new instance.
  • Clientport Setting: In the ws section, ensure that the clientport is distinct for each instance. This is necessary for websocket communication.

    • Example: If one instance uses clientport 5020, the next should use 5021. Keep track of your port numbers to avoid any accidental overlaps.
  • Telegram Token: The TOKEN in the bot section is crucial for Telegram notifications. Each instance should have its own unique token.

    • To get a new token for each instance, you'll need to create a separate Telegram bot for each instance. This ensures you receive notifications for each instance separately.
  • Database Paths: If you're using the built-in database, make sure each instance is set to use a different file path. Otherwise, instances may overwrite each other's data.

  • Log Files: Consider customizing the log file paths for each instance. This helps in troubleshooting, allowing you to easily 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 that the above parameters are unique for each instance.

  • Organize Your Configurations: Group all instance-specific settings (like ports, tokens, and paths) near the top of your configuration file. This will make future edits easier, especially when scaling up to multiple instances.

  • Configuration Variables: If you find yourself frequently adjusting the same settings across multiple instances, consider creating a template configuration file with placeholders. This can save time when setting up new instances by allowing you to quickly replace the 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 the output of each instance 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 that each instance is functioning correctly by checking the GUI, ensuring each bot is connected to its respective 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 in identifying issues quickly.

  • Server Deployment: For more advanced users, you might 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 efficiently manage multiple Gunbot instances, each tailored to your specific trading strategies and goals. Happy trading!

Bonus Feature: Gunbot Monitor

Managing multiple Gunbot instances? While the built-in interface offers everything you need, Gunbot Monitor takes multi-bot management to the next level. 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