As regular readers know I use interactive brokers (IB) to run an automated futures trading system. Now in many ways IB are great. They have several huge plus points compared to most other brokers:
- Uniquely (?) they offer an API that allows you to build your own automated trading system. What's more the trading server software is available for Unix (and Mac, if that's your thing), not just Windows.
- They have extremely low commissions.
- They have a flexible and straightforward portfolio margin and multi-currency system.
- They have a very wide range of markets.
There are a few more things that other people might find annoying, but which I don't. For example IB don't offer UK spread betting, but then spread betting is the work of Satan so that's fine with me. I don't mind the lack of futures execution algos, despite the fact there are loads for stocks, because I'm perfectly happy with my own. The API documentation is... sketchy... but you can read my blog instead!
python, matlab, or R API
(In 2017, a couple of years after I wrote this post, IB finally offered a native python API. I wrote a series of posts on this, starting here. I've edited this section to reflect that change).
IB offers their API in five flavors:
Now there has some very big omissions from that list. The five languages used most in the systematic trading world are (in no particular order): C++, Java, Python, R and Matlab.
- Excel DDE
- Active X
I've never really understood why Active X needs to be included as well as DDE; surely one spreadsheet based solution is enough? I've never met anyone who uses C#, though I'm sure they exist, but isn't having C++ and C# gilding that particular lily?
So why no
Python, R or Matlab? An entire middle ground of people between Excel using 'F9 monkeys' and hairy chested C++ programmers has been missed out.
Fortunately there are third party API's available to support the likes of Python, R and Matlab; such as the swigibpy API that I use which wraps around the C++ code. However it makes me slightly nervous to use a third party product which has been written and is only supported by someone on a part time basis (though I hasten to add this hasn't given me any problems yet). It particularly worries me when combined with the possibility of an IB API upgrade breaking everything (see below). And it would absolutely terrify me if I was using this platform to trade other peoples money.
Why can't IB create proper API's for these
three two high level languages? I am not an expert on Matlab and R, but it would be trivial for IB to do the wrapping of their C++ (as they appear to have done for POSIX). At least then we have some comfort that we are using an official product.
API and server updates aren't always backwardly compatible
There is nothing more annoying than people changing their software so that the changes aren't backwardly compatible. Add new functions? By all means, I don't have to use them do I? Fix bugs? Feel free, as long as it's not a 'bug' whose behaviour I have been relying on (so that is an undocumented feature, not a bug).
Change the name of an existing function just to annoy me? Force me to download the latest version of your API server or stop me trading altogether? No thank you. Especially not while I am relying on a third party to update their python API so it still works. Also why should I have to rewrite my code, retest it and generally make sure its still stable?
No free delayed data via API
When I use the IB front ends (of which more in a second), and I try and look at FTSE futures prices I get the nice friendly message 'Would you like to use 15 minute delayed data, you cheapskate?' (I'm paraphrasing). Click yes, and I can. I can even trade the dammn things, once I've ticked another disclaimer 'Would you really put your families future at stake by submitting a blind market order, just because you refuse to pay the very reasonable fee that Euronext LIFFE want to charge you for live data?'. Oh yes I would.
However when you use the API to get a FTSE futures price you get a very unfriendly message 'IB error id 23 errorcode 200: No security definition has been found for the request'.
Why oh why oh why is it so hard to have a tickbox in the IB API server that says 'Yes I want delayed data where I don't have a subscription. Yes I don't mind trading blind. Yes I am a cheapskate'.
Please IB - give us delayed API data.
No multiple trading login
You can only have be logged into IB in one place at a time.
- It means you can't have multiple IB servers running for one account. No problem since you can connect over a network to your server from multiple machines.
- It means you can't have multiple IB servers for two linked accounts. Cue lots of messy code specifying which account you are trading from and hoping the server doesn't get it wrong. So a small problem, but with a solution.
- It means you can't have a manual front end (see next section) open, perhaps to monitor your trades or do a little manual trading in another account. Unsolvable problem.
- It means you can't have an IB server running a test account, and another for your live account, so running proper tests is impossible. Unsolvable, and very annoying, problem.
- It means, it sucks.
No lightweight stable front end for manual trading
Apart from the API server, which is a very stable product that you can leave running for weeks on end, IB offer a number of ways to trade manually. At the time of writing these are:
- Client side TWS. You download this thing and run it on your machine. It is an obese piece of software with far too many bells and whistles. When I run it it freezes eithier immediately, or when I try and do something complicated, like search for a symbol.
- Server side TWS. Half the time this doesn't download the thin client properly and the other half the time it freezes.
- Web trader. The vanilla version of this just freezes. The 'beta' version of this runs brilliantly, at least compared to the other front ends. Which is to say that I've managed to use it to submit one order at a time. After that, when I try and find the next symbol, it freezes. And I have to close the session. And login again (using my stupid security card, see below). Half a dozen end of tax year housekeeping trades took me the best part of an hour.
- Mobile. I haven't tried this. But if something doesn't run on my 4GB laptop it probably won't run on my little Samsung...
1990's style security access protocol
Darn, a power cut. I'll just reset my fuse box. Now all I have to do is use vncviewer to log in to my headless trading box*, run the IB gateway server, pull out a stupid plastic card thing from my wallet (assuming I haven't temporarily mislaid it) which I need to log in and restart my own client processes.
It's like digital security was never invented. If I have to login to something like webtrader then fair enough, let me use a cruddy plastic card. But why can't I just have a secure ID sitting on a file on my machine? I can then setup my crontab so that the IB API, and all my server side stuff, restarts when I switch the machine on. After each power cut all I would need to do is reset the fuse box and then turn my server back on again.
* This now reflects my current setup - in earlier versions of this post I wasn't using vnc. Thanks to all those who commented below so that I could address this issue - the security is still rubbish but at least I don't have to plug a keyboard and monitor into my headless trading box.
It does seem as an outsider that the IB development team spend most of their time adding new features to the already bloated TWS front end, and designing things that they think are cool and pretty. It might be that the API community are responsible for only a tiny fraction of IB's income. However I seriously doubt that since algorithimic traders will trade a lot more, and probably use margin more aggresively, than the average Joe.
So please guys, I love the product, lets make it better.