Python and Interactive Brokers

Big_P

Active member
Messages
105
Likes
19
Hi all,

I posted this question in another thread but it was a bit buried so I'm not sure anyone saw it.
I thought I would try again with a new thread, I hope somebody can help.

I had the idea about one year ago to try some coding. I never got stuck in but now I have more time on my hands.

The problem is, I've never done any coding before so I am starting from scratch. My trading account is with Interactive Brokers.

Again, I'm at the very beginning of this journey. I have the trading knowledge (around 12 years now) but not the coding knowledge. I doubt I would ever be able to understand how to code properly, it's just not what I'm good at. I'm leaving that to my brother-in-law who is a coding expert (but only has a basic understanding of the markets). I hoping that the combination of the two of us will produce some decent results.

However, my knowledge is so limited, I don't even understand how to connect the coding side to the trading platform. I want to get a basic understanding of this before I have my first chat with my brother-in-law so that he doesn't think I'm a complete idiot.

As I understand , using Python as my coding language and Interactive Brokers as my trading account ...

I need to download the software in which to write the code.
(from my research, IBridgePy is best suited?)

This software then needs to be linked to my Interactive Brokers API so that the code can do it's stuff .

But I also understand that the code can be linked via the 'IB Gateway' ?

What is the difference between making the direct link between my IB platform and directing through the IB Gateway?

I fully appreciate that these coding questions are the trading equivalent of "what is a candlestick?" , but we all have to start somewhere.... :)

Would anyone be kind enough to explain to me the absolute basics of connecting code to trading account, in simple layman's terms?

Many thanks,

Big P
 
Have a look at this thread which may not cover exactly what you want but it is in the general topic area.
 
Thanks Trader333

That is a great thread, I had read through it before and it has some very good info.

But it doesn't really cover what I'm after unfortunately. It assumes quite a bit of understanding/knowledge regarding how to set everything up (well it does in my mind anyway)

As I mentioned, I'm not intending to have anything to do with the coding side. I trade setups and I'm going to stick with what I'm good at.

But I'm after the most basic understanding of how algo connects to platform, just so I can chat to my coder with a little bit of confidence.

As I understand ...

1) The Python code goes into a chosen framework / software

IBridgePy, Backtrader, Quantopian, Quantconnect, QTPyLib ....

But why are there so many?
In word processing terms, is this the equivalent of choosing between Word, Google Docs, Apple iWork etc?

2) The code connects to my trading platform

If this quite simple to do?
Why does Interactive Brokers also have an 'IB gateway' as an option to run the coding through?

Simple, simple questions, I know. But I'm after the very first steps, just to understand conceptually what is going on between code and trading platform.

Can anybody help please?

Big P
 
A last quick bump to the top....

Just in case there's anyone out there who can answer my question and is feeling in a charitable mood on a Friday to a complete coding novice ?!

Happy trading all,

Big P
 
As I understand ...

1) The Python code goes into a chosen framework / software

IBridgePy, Backtrader, Quantopian, Quantconnect, QTPyLib ....

But why are there so many?
In word processing terms, is this the equivalent of choosing between Word, Google Docs, Apple iWork etc?

2) The code connects to my trading platform

If this quite simple to do?
Why does Interactive Brokers also have an 'IB gateway' as an option to run the coding through?

Were you able to get clarity on this in the end @Big_P ?

1) You don't need environments like IBridgePy, Backtrader etc to 'write' the strategy in Python -> for that you'll need a simple text editor like Notepad++ for example (and of course, the Python environment itself - I recommend downloading Anaconda as most common dependencies will come installed by default, saving you initial hassle)

Backtrader is great for taking ideas to implementation fast (in Python), but non-essential if you can use native Python modules for the job.

Frameworks like Backtrader and 'bt' (Google it, it's open source on GitHub) will help you backtest your ideas conveniently by abstracting away a lot of the code you'd otherwise need to write, letting you focus on methodology rather than lower level matters.

2) You or your programmer colleague would need to implement connectivity (e.g. for order execution, price data acquisition, etc) to your Broker from within your Python code. In the case of Interactive Brokers, your application would need to use the TWS API for instance.

As to your question regarding IB Gateway -> it's essentiall a lightweight intermediary that lets applications connect to Interactive Brokers via TWS (without having TWS itself running in parallel).

Hope that proves useful.

(I've been a 'browser' here at T2W for a while, but thought I'd respond to this open question since no one else had yet).

Cheers
 
First of all, you need to hire a consultant who have experience with IB, the IB API, having updated knowledge on IDE´s for strategy development, having extensive hands on experience with strategy development and automated trading.

You need to know how TWS API works. An answer to one of your questions, both connection methods use same API, but the GUI is different. You need to know that the bridge software to connect to the IB API is closed daily (several times) automatically. Etc etc etc.

What you try to do is not possible, unless you are willing to develop your own development/testing/trading IDE application. Which is by itself years of development.

Assuming above is not what you would like to do, you need to find the development IDE to use. To my knowledge, there is no operational Phyton IDE´s available. Besides Phyton is a scripting language 100 times slower than native code such as C++. Thus once in the far future, if your programmer could do it and have the patience, you will find that Phyton might be too slow and limited to do what you want to do. You will also find, that you constantly need to add more features to your IDE, as you usually find more sophistication is needed to develop and test profitable strategies.

Besides, it is very common that a discretionary traded strategy does not perform when implemented in code -usually cause the discretionary trader use further inputs than the digital criteria, such as "experience".

So you need to find the IDE to use, before you open broker account, hire programmer etc.
 
Top