This guide was written for anyone that would like to host an instance of the IB Gateway API on GCP. This will allow you to use libraries like node-ib and ib-sdk in a production environment.
You must already have an Interactive Brokers account with account permissions properly configured. If not, you can follow this tutorial
Note: These instructions are for setting up a paper trading account. Ask Ronny for instructions on how to set up live trading. Also, if you have 2FA set up on your live account, you'll need the IBKR mobile app
- Create a GCP account
- Create a project called
leverheads
- Make sure you're allowed to create a GCP instance by going to the VM Instances page
- You may see a message saying that you need to Enable Billing. Click the blue "Enable Billing" button to continue.
- You may see a message saying that you need to Enable the Compute Engine API. Click the blue Enable API button to continue.
- Open the Cloud Shell (top-right corner of the screen)
- Download some necessary files by copy-pasting the below commands into the terminal
git clone https://github.com/ronnyli/headless-ib-gateway-installation-ubuntu-server.git
cd headless-ib-gateway-installation-ubuntu-server
- Run the
gcloud_commands.sh
script by copy-pasting the below command into the terminalsh gcloud_commands.sh
- Provide your username and password when you're prompted:
- You'll also be asked some questions about your GCP instance but you can simply press Enter to skip these steps
- When the script is done you'll see a link that looks like
http://127.0.0.1:8888/?token=alphanum3r1cstr1ng
. Copy and paste it into the URL address but replace127.0.0.1
with the External IP address of your new GCP instance.- You can find the External IP address on the VM Instances page
- You can run any Python code that needs to interact with IB in this JupyterLab setup.
- For security purposes, it is recommended that you edit your Firewall Rules to only allow access from your IP address.
- The two rules that you want to edit are:
ingress-5900
andingress-8888
- Ask for help if necessary!
- The two rules that you want to edit are: