0% found this document useful (0 votes)
51 views10 pages

and Setup IBridgePy On Windows

This document provides a step-by-step guide to install and run IBridgePy on a Windows system, starting with the installation of Anaconda Python and downloading IBridgePy. It includes instructions for configuring IB TradeStation (TWS) and running a Python strategy using the RUN_ME.py file in Spyder IDE. Additionally, it offers troubleshooting tips and links to video guides for setup on both Windows and Mac.

Uploaded by

nishairindia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views10 pages

and Setup IBridgePy On Windows

This document provides a step-by-step guide to install and run IBridgePy on a Windows system, starting with the installation of Anaconda Python and downloading IBridgePy. It includes instructions for configuring IB TradeStation (TWS) and running a Python strategy using the RUN_ME.py file in Spyder IDE. Additionally, it offers troubleshooting tips and links to video guides for setup on both Windows and Mac.

Uploaded by

nishairindia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Contents

Objective 1

Install Anaconda Python 2

Download IBridgepy 3

Unzip IBridgePy Package 3

Download IB TradeStation (TWS) 4

Configure IB TradeStation (TWS) 6

Open and Edit RunME.py File in Spyder IDE 7

Video Guide to Setup IBridgePy on Windows 10

Video Guide to Setup IBridgePy on Mac 10

Troubleshooting 10

Objective
After completing this document, you will be able to install and run IBridgePy in your windows system.

Install Anaconda Python


Before installing IBridgePy, you need to install Anaconda Python in your local system. You can install using
this link.

© Copyright QuantInsti Quantitative Learning Private Limited | 1


You can see there are two versions: Python 2.7 and Python 3.7. We recommend you to download Python
3.7, as going forward Python 2.7 will be deprecated and not supported by IBridgePy. Also, you need to
check the specifics of your windows system and accordingly download the 64-bit or 32-bit package.

Download IBridgePy
To download IBridgepy, first, you need to register on the portal here.

After the successful registration, you will be redirected to this page where you can login to your account.

© Copyright QuantInsti Quantitative Learning Private Limited | 2


Once you logged in, you will be redirected to this page where there are options to download IBridgePy. You
need to scroll down to see the options. You need to choose the IBridgePy version based on your operating
system and Python version. For example, if you have Python 3.7 64-bit installed in your system, you need to
install IBridgePy Python 3.7.

Note: If there is a mismatch in Python and IBridgePy versions, then IBridgePy won’t work.

3. Unzip IBridgePy Package


After downloading, unzip IBridgePy in your local folder.

© Copyright QuantInsti Quantitative Learning Private Limited | 3


Download IB TradeStation (TWS)
Visit this link to download IB TradeStation.

When you click the "Download" button you will see a tab in the bottom left corner of your browser.

Once you click on the tws…exe download button, a new tab will appear.

© Copyright QuantInsti Quantitative Learning Private Limited | 4


Click the "Next" button on the Setup Wizard to install TWS. Once the installation is complete, a new tab
will open.

Click the "Finish" button. A TWS icon is installed on your desktop.

Find the TWS icon on your desktop and double-click to launch the Login box.

© Copyright QuantInsti Quantitative Learning Private Limited | 5


Enter your ‘Username’ and ‘Password’ for simulated/paper trading and click on Paper Log In. If you want to
proceed with a demo account, click on the ‘Return to the demo’ and enter your Username. You can also
choose live trading, but if you are doing it for the first time, we recommend doing paper trading first.

Configure IB TradeStation (TWS)


To connect IBridgePy with IB TWS, you need to configure IB TWS. Click on the ‘File’ at top left corner and
then click on the ‘Global Configuration’.

In the Global Configuration, click on the ‘API’ then click on ‘Setting’ and make the following changes.

© Copyright QuantInsti Quantitative Learning Private Limited | 6


1. Uncheck Read-Only API
2. Check Enable ActiveX and Socket Clients
3. Change the socket port number to 7496
4. Click ‘OK’ to accept changes

Note: If you are using paper trading, change the socket port number to 7497

Open and Edit Run_ME.py File in Spyder IDE


The last step to connect your Python strategy with IB TWS through IBridgePy is to run RUN_ME.py.
RUN_ME.py is a file within the IBridgePy folder.

© Copyright QuantInsti Quantitative Learning Private Limited | 7


Open RUN_ME.py in Spyder.

In RUNME.py file, you need to enter things:


1. fileName: In the file name, enter the name of the .py file you want to run along with its extension.
For example, if you want to run moving_average_crossover.py file which is available in the
‘Strategies’ folder of IBridgePy. First, open moving_average_crossover.py file in the Spyder and run.
In Spyder, you can press ‘F5’ or the green triangle at the top to run a Python script.

© Copyright QuantInsti Quantitative Learning Private Limited | 8


If there is no error in the file, open RUN_ME.py file, enter moving_average_crossover.py in the ‘fileName’.

Note: All .py files that you want to run should be saved in the ‘Strategies’ folder of IBridgePy.

2. accountCode: accountCode is the IB account code that you can find at the right corner (besides
DATA) of IB TWS. This needs to be updated in the RUN_ME.py file.

© Copyright QuantInsti Quantitative Learning Private Limited | 9


After entering fileName and accountCode in RUN_ME.py file, run the file.

Video Guide to Set up IBridgePy on Windows.


Video Guide to Set up IBridgePy on Mac.

Troubleshooting
1. Read the FAQs which is the next unit
2. For more FAQs visit: https://ibridgepy.com/learn-quant-skills-2/
3. If still not resolved, post on the Quantra community with full error stack trace, Python version, OS
detail and IBridgepy version.

© Copyright QuantInsti Quantitative Learning Private Limited | 10

You might also like