简体   繁体   中英

Interactive Brokers automated trading

I've tried to setup Interactive Broker's C++ API in Visual Studio 2008, but I know very limited C++ and I keep getiing errors. :<

1) Is there any way to use some kind of light scripting language to connect to Interactive Brokers and make trade. FE

login.('username','password')
>>>'Connected'
makeTrade('GOOG','550')
>>>'Trade Completed'

Something light like Python would be just fine, and yes I have looked into IBPY , but I do not understand how the java2python system works.

2) How did you setup your automated system, or how would you set up your automated trading system with Interactive Brokers?

The "DDE for Excel" API is by far the easiest of the API's to get up and running, and IB provides a sample program with instructions as to how to get it working. https://interactivebrokers.github.io/tws-api/excel_apis.html


And many options are now available to work with TWS API

While there's no officially supported Python API, I've been using ibpy successfully for months now, and it's quite easy. No need to concern oneself with java2python etc. All I had to do was clone ibpy somewhere:

git clone https://github.com/blampe/IbPy

install from there:

cd IbPy
python setup.py install

And voila, it's done. I got this originally from http://www.quantstart.com/articles/Using-Python-IBPy-and-the-Interactive-Brokers-API-to-Automate-Trades

Once you've got that installed, the interface in python is pretty much identical to the Java API interface: IB API pdf

I found it useful to look at the TWS Test Client Java code included with the IB API.

Edit: IB has now had their own python API for a while, so not much more need for ibPy unless you're on python 2.

Or you can use R with IBrokers package.Example:

tws <- twsConnect()
id <- reqIds(tws)
placeOrder(tws, twsSTK("AAPL"), twsOrder(id))
cancelOrder(id)

There are many options to use TWS API for Algorithmic Trading.

Choose any of the below including Excel :

  1. C#
  2. C++
  3. VB
  4. Java
  5. Python
  6. Excel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM