Deploying TradingBoat Docker on a Public Cloud Computer Using AWS EC2

Introduction

This article presumes you have already installed the TradingBoat Docker on your local machine, and are familiar with launching TradingBoat Docker and utilizing the dotenv file to manage the TradingBoat application. If not, please refer to the README file .

After completing the local setup, you may want to run TradingBoat Docker on a public cloud computer. This can be easily accomplished by updating the following two environment variables:

  1. TBOT_IBKR_IPADDR
  2. TBOT_NGROK

The instructions provided below outline how to deploy TradingBoat on an AWS EC2 instance, but the process should be similar for other cloud computing services.

Cloud Computer Setup

For this guide, I have chosen Ubuntu Server 22.04 LTS and installed it on an Amazon AWS T2.small instance. A T2.small instance provides 2GB of memory, which is needed to run the IB Gateway within Docker.

You can find the OS image on the Amazon AWS webpage after signing up.

After installing the Ubuntu OS Image, you can connect to the Ubuntu instance via SSH: Connect to your Linux instance using SSH

Firewall Setup using Amazon EC2 Security Group

You can use the Amazon EC2 security group for setting up the firewall, restricting IP addresses to your own.

EC2 Security Group

Installing Docker

Ubuntu 22.04 does not come with Docker pre-installed, so you'll need to install it following this guide: Install Docker Engine on Ubuntu

Also, make sure to add your user to the Docker user group with this command:

  • sudo usermod -aG docker $USER

Running TradingBoat Docker

Refer to the guide at GitHub - PlusGenie/ib-gateway-docker: Converting TradingView PineScript Alerts into Interactive Brokers Orders to run TradingBoat Docker. Make sure to set up the environment variables as mentioned.

Detailed information on each variable can be found here: How to Use a DotEnv File to Control TradingBoat .

After copying the dotenv file, open it with a text editor and update the following values:

  • TWS_USERID: The account name used to log in to TWS / IB Gateway
  • TWS_PASSWORD: The password used to log in to TWS / IB Gateway
  • VNC_SERVER_PASSWORD: The password used to log in to VNC Server
  • NGROK_AUTH: Authentication Token for NGROK application as required

Deployment Differences

For a public deployment, compared to a local one, you need to customize two variables:

  • TBOT_IBKR_IPADDR: The IP address of the IB Gateway. In our case, 'ib-gateway' is the service name in the docker-compose file used by the TBOT application. Set the variable as follows: TBOT_IBKR_IPADDR=ib-gateway.
  • TBOT_NGROK: The web interface address of Ngrok. For example: TBOT_NGROK=http://ec2-your-ip.compute.amazonaws.com:4040. Ensure to add '4040' as the suffix of the HTTP URL.

Running Docker

After setting the above variables, you can run the TradingBoat Docker using the following commands:

docker-compose build

docker-compose up -d

Once Docker is up and running, you can access TradingBoat via two interfaces - the VNC Viewer to access the IB Gateway and a web browser to track orders from TradingView to Interactive Brokers.


For further details and procedures, please refer to the README file:

GitHub - PlusGenie/ib-gateway-docker: Converting TradingView PineScript Alerts into Interactive Brokers Orders . The rest of the steps remain the same."

For a user-friendly video tutorial, I highly recommend referring to the comprehensive Udemy course available here: Link to Udemy Course.

Subscribe to TBOT on TradingBoat

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe