Step 1: Download and install Interactive Broker’s TWS or IB Gateway
Go to this webpage to download IB’s TraderWorkstation (TWS) or go to this webpage to download IB Gateway.
Both TWS and Gateway can be used to trade. If you are relatively new to trade at IB, then I would recommend TWS as it is more user friendly. However, if you want to save time and avoid IB system restarts then go for the IB Gateway.
Step 2: Configure TWS if you are using TWS
Open TWS and input your credentials, you will see TWS is running.
Then click the little tool and select “Settings”, you will see a window jumping out.
Click “API” on left
Click “Settings”
Make sure “Enable ActiveX and Socket Clients” is checked
Make sure “Socket port” is “7496”
Then, click “OK” to complete the configuration.
Step 2: Configure if you are using IB Gateway
After input your IB credentials, IB Gateway opens. Please go to its configuration.
Then, click API-> settings on the left hand. Make sure the Socket port is 7496. The accountCode is at the upper left corner, which will be used in RUN_ME.py to set up IB connection.