IB API Questions

Discussion in 'Automated Trading' started by jeffreykr, Nov 19, 2005.

  1. jeffreykr


    Have you written an application to interface your trading application with IB via their API's? I am thinking about doing this with a system that trades frequently, but wanted to get input first:

    - What development language did you use - Java, C++, DDE?
    - How robust and reliable is the IB-provided API set?
    - Are there any routines available via the samples or elsewhere to build price bars out of the data stream?
    - Did you build in checks to make sure a maximum position size is not exceed and how easy is that?
    - How about processing exception conditions - how robust are the API's?
    - Was the demo account access a near 100% simulation that allowed you to test the trading strategy, risk mgt (ie, position limit checks mentioned above), and exception conditions?
    - Finally, how has it worked when trading for real - what was the overall experience?
    - How closely do you need to watch it to make sure it's executing as expected - check in every hour, every day, every week???
  2. jeffreykr


    Or would you recommend a different platform like TradeStation for this sort of application...
  3. 1. Java

    2. Reasonably robust.

    3. Building price bars from the streaming data is not particularly difficult, but you need to make sure your PC clock is accurate as there is no time stamp on the incoming data. PC clocks are quite poor in this respect so frequent (eg hourly) synchronization with a network time server is advisable.

    4. Checking for maxmium position size is not difficult - in fact its quite simple.

    5. There are some caught exceptions in the Java API that result in silent failures. Best to change the API to at least print a stack trace. Overall error handling is OK, but documentation could be improved. Things like order status events, portfolio updates and so forth seem very reliable and an accurate representation of the the state of orders and of your account.

    6. The demo account is very so so. You absolutely cannot use it to test trading strategies. It is useful for some unit testing. Streaming price data is woefully slow - you can wait minutes for trade to occur on a liquid instrument such as ES. Some message types are incomplete. Overall, I would catagorise the demo system as poor.

    7. I'm not using it for a fully automated system, but my feeling is that it is adequate. Put most simply, I believe that the vast majority of problems with a fully automated system would not come from the IB API but rather other issues such as internet/exchange failure and issues with order fills.
  4. Choad


    I use VB. My system has been cranking out thousands of trades for a few years now, essentially unchanged.

    I have had to fix a few logic and code errors. These kinds of problems typically don't result in nice "accidental" gains. Quite the contrary! The market has a way of finding EVERY SINGLE crack in your system. Just takes a few years...

    My system sends me emails showing status and it used to update by FTP a private website showing current trades and p/l. I stopped doing the FTP stuff, because it isn't necessary anymore and my ISP kept having problems with their FTP setup. I have a fulltime (very good) job, so I just start it up before the open.

    It's easy to check current account exposure and limit or halt new trades based on a set parameter.

    Getting to the point of a reliable performer takes plenty of time and lots of trial and error. And lots of market experience...

    Don't give up.

  5. LOL, I use VC++ with the socket API.

    My choice isn't based on an impartial analysis of which is the "best" language. It just happens to be the language that I use for work and so I'm most familiar with it.

    Besides, it's the best. :cool:
  6. True, but only for those that have never heard about :) :cool: PYTHON :cool: :)
  7. rwk


    I use Delphi, because it's what I know best. I have one system that can run unattended, but it was not built with that objective. I don't trust fully automated systems, because there are so many things that can go wrong, and because I don't test my programs as thoroughly as I should. I now make my living trading with a semi-automated app, so I am a loyal fan of IB's API.
  8. TickJob


    Could someone here help me writing a simple automatic trading prgramm using a breakout strategy, how much will be the fee?
  9. Choad


    Here's how to do a working system, on an EOD basis, absolutely free!

    1. Become a member at Wealth-Lab and learn how to write, test, and market scan your system (script). It all can be done at the site for free (for simple scripts and simple is better anyway). Your script needs to trade using Limit orders.

    2. Get an account at IB. Very cheap stock and option commish for small trades. You NEED small trades when you start out and test your system.

    3. Use a decent watchlist of stocks, like the Naz100, a group of good earnings stocks, etc. (max 100)

    4. Scan your script at the EOD or before the open. Grab your limit order alerts (don't try to do too many) and load 'em into IB TWS.

    5. Compare your fills with the backtested ones, put ALL of your trades in a spreadsheet for analysis and taxes.

    6. Don't give up. Have LOTS of patience.

    7. Don't spend all of your profits!



  10. TickJob


    I already have a working system and now I want to program it in IB API to automatic it. The system is quite simple, don't use any indicator, just some price level and logical sequence in buy/sell order.
    #10     Nov 19, 2005