How to Set Up Tbot on TradingBoat Docker with an External TWS Workstation
we've walked you through a comprehensive guide to successfully setting up and running the TradingBoat Docker with an external TWS workstation
Introduction
This section will guide you through setting up the TradingBoat Docker in conjunction with an external TWS workstation. We'll proceed on the assumption that you've read the chapter - 'How to Set Up Tbot on TradingBoat Docker in 5 minutes'. This method bypasses the need for running the IB Gateway inside Docker and using VNC Viewer. Instead, you will operate the TWS workstation on your local machine and configure the Docker containers to recognize the IP address of the TWS workstation. This offers a unique approach to utilizing TBOT on Tradingboat.
Using the TWS workstation instead of the IB Gateway enhances your visibility into your portfolio activities in the TWS workstation.
For users of Apple MacBook M1/M2 with Apple's ARM64 architecture, we strongly recommend running TradingBoat Docker using an external TWS workstation.
Tbot in TradingBoat runs within Linux containers, specifically using the amd64 Linux version of the IB Gateway. While Interactive Brokers offers a Mac version of the IB Gateway compatible with Apple Silicon's ARM64 architecture, Tbot requires an ARM64 Linux version to run effectively on an Apple M1 chip. Therefore, this section serves as a valuable guide for Apple MacBook M1/M2 users.
Running Tbot on TradingBoat Docker
TradingBoat is a trading platform which processes orders from TradingView and dispatches them to either IB Gateway or TWS. Its ecosystem comprises several software tools including NGINX/NGROK, Flask(TVWB), Redis, TBOT, and IB Gateway.
As shown in the following image, the TWS workstation (highlighted in a red rectangle) is separate from the TradingBoat environment. This indicates that you need to operate the TWS workstation independently.
Running the TWS Workstation
Begin by operating the TWS workstation on your local computer using the Paper Account, which typically runs on TCP port 7497. Ensure that the option "Allow connections from localhost only" is checked in the TWS workstation, as illustrated in the ensuing images.
Additionally, ensure that the following settings meet the minimum requirements:
- The “Enable ActiveX and Socket Clients” option must be enabled.
- The “Read-only API” option must be disabled.
Once the TWS workstation is up and running on your local computer, you can proceed to construct the TradingBoat Docker.
Running TradingBoat on Docker: A Step-by-Step Guide
To run TradingBoat using Docker, we need first to build a Docker image and then launch it.
Before that, ensure that you have access to the required repositories that will be used by Docker, which are publicly available:
https://github.com/PlusGenie/ib-gateway-docker
https://github.com/PlusGenie/tbot-tradingboat
https://github.com/PlusGenie/tradingview-webhooks-bot
To start off, clone the TradingBoat Docker repository by running the following command:
git clone -b feature/use_external_tws https://github.com/PlusGenie/ib-gateway-docker
Please note that you should pay special attention to the branch you are using, which is feature/use_external_tws
Then, navigate to the directory and copy the dotenv file to the root directory:
cd ib-gateway-docker
cp stable/tbot/dotenv .env
After copying the dotenv file, open it using a text editor and update the following values:
TBOT_IBKR_PORT
: set this to 7497. 7497 is the TCP port of the paper account. You will use the paper account for this demonstration.TBOT_IBKR_IPADDR
: Set your local computer IP address on TWS workstation running-
NGROK_AUTH
: Authentication Token for NGROK application as needed. (optional)
Once you have set the above variables, you can run the TradingBoat Docker using the following command:
docker-compose build
docker-compose up -d
Once Docker starts, you can access TradingBoat through a web browser to monitor orders from TradingView to Interactive Brokers.
How to Access TBOT
Once the Docker runs successfully, you can access the TBOT application via your browser by visiting:
To view the order menu, click on the "Order" option on the top app bar. Here, you can see the current open orders and portfolio (if available).
Your existing Interactive Brokers account portfolio will appear with the status labelled as 'Portfolio'. If you click the pagination icon below, any open orders in your account will become visible on the webpage.
If you can see your portfolio, it means you've successfully set up the Docker.
In conclusion, we've walked you through a comprehensive guide to successfully setting up and running the TradingBoat Docker with an external TWS workstation. By following these steps, you can efficiently monitor your portfolio and track your orders from TradingView to Interactive Brokers. Remember, understanding the operations of the TWS workstation and TradingBoat Docker will allow for more effective and efficient trading operations.
For further details and procedures, I highly recommend referring to the comprehensive Udemy course available here:Link to Udemy Course.