Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding interface for Interactive Brokers #1

Open
jecker7 opened this issue Nov 15, 2019 · 9 comments
Open

Adding interface for Interactive Brokers #1

jecker7 opened this issue Nov 15, 2019 · 9 comments
Labels

Comments

@jecker7
Copy link

jecker7 commented Nov 15, 2019

Any plans for this yet?

@jbax
Copy link
Member

jbax commented Nov 15, 2019 via email

@jecker7
Copy link
Author

jecker7 commented Nov 15, 2019

Here's a link to their API

Happy to help out with the interface also, have some working experience writing these. A low-latency FIX connection would be a nice feature to implement.

@jbax
Copy link
Member

jbax commented Nov 15, 2019

Thanks for that. Their documentation is a bit all over the place but I found this closed project: https://github.com/InteractiveBrokers/tws-api-public

From their website there are a few files from 2013, so I assume it's outdated. I had a quick look over their EClientSocket class that apparently does the communication with their servers and it's plain java socket based. If that's the only option we'd need to implement an Exchange with those dependencies that people would have to download from them.

Not a lot of accessible info on the FIX connection setup either, all I could find was the cost to setup which is not exactly cheap.

As you are more familiar with their API's, would you mind implementing a simple method of the Exchange class such as double getLatestPrice(String assetSymbol, String fundSymbol);?

Cheers!

@jbax
Copy link
Member

jbax commented Nov 15, 2019

Also to help integrating via FIX protocol we'd use quickfixj

@jecker7
Copy link
Author

jecker7 commented Nov 16, 2019

Yes will happily give it a go this weekend. Also plan on adding another interface for IQFeed data vendor with a websocket connection. Also are you available on discord or slack to talk about the project further?

@jbax
Copy link
Member

jbax commented Nov 16, 2019

@SteveH2003
Copy link

SteveH2003 commented Nov 22, 2019

The IB API does not communicate directly with Interactive Brokers' servers. There's a Java app called TWS Workstation which runs on any PC in your network. The API connects to that and then your requests from the API get forwarded from there to the IB servers.

The API is pretty simple. You implement an interface (EWrapper) where all the methods you inherit provide the callbacks (i.e., responses messages from the TWS Workstation app) from your API requests. If you don't want to implement all of the interface, you can instead inherit from the DefaultEWrapper class which implements the callbacks with empty method bodies. That way, you can pick and choose which callbacks are important to your trading app.

Oh, sorry, just found this. IB has recently released a new REST API:

https://interactivebrokers.github.io/cpwebapi/

I got this info from r/algotrading on reddit. Seems there's issues with connecting with that and maintaining the well-established way (TWS Workstation). Personally, I would stick with communicating with the TWS API. If something goes wrong, you can always correct orders manually from the Workstation app.

@SteveH2003
Copy link

One thing you may want to add in the future for better performance is a caching mechanism for your indicators to reduce repeated computation time. Here's a Java TA library which does this as an example:

https://github.com/ta4j/ta4j

@jbax
Copy link
Member

jbax commented Nov 22, 2019

Thanks @SteveH2003, I'll open a new issue with that suggestion.

@jbax jbax added the help wanted Extra attention is needed label Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants