IB---activex, controls?

Discussion in 'Retail Brokers' started by mars, Feb 25, 2002.

  1. mars

    mars

    i'm trying to program some automatic trading routines, but have some questions...

    is it possible to "request position" for a stock?--- i think that it's important for some protective feedback, just so that my program doesn't sell short a position rather than selling a long position....

    also-- same question for profit/loss data from the TWS....
     
  2. There isn't a method for getting the position. What you will need to do is have your program keep track of the positions it opens, and then use that information to determine what steps are appropriate.

    You'll need to do the same for P/L data. Once your code calls the placeOrder method, the orderStatus event will get called when the order is filled. The price parameter of orderStatus will tell you what you got filled at. Then you can use this information in the tickPrice event to calculate your P/L.

    Bottom line: your program must keep track of everything it does that you care about. You can use variables, arrays, classes, or whatever constructs you want that makes sense, to keep track of it.
     
  3. mars

    mars

    crap... it would be nice to be able to "getPosition", to make sure that my program and my account were in sync--- just in case the program thinks it executed an order that wasn't actually executed....

    thanks though---- confirmed what i thought :)
     
  4. jaan

    jaan

    i second that. the current API implies that whenever one of the system components crashes or encounters an error, you're basically screwed. in other words, the TWS API is not robust.

    my wishlist for the API is:
    * ability to get a list of open positions
    * ability to get a list of open orders
    * ability to get feedback if an error occurs when entering an order (eg, trying to short a stock the TWS thinks is not shortable)

    - jaan
     
  5. mars

    mars

    does the "orderstatus"(?) control work okay? i mean, in reporting the status of the order, # shares filled, etc.?


    does anyone know if IB has plans to add those features (especially the position one)? is it a technically difficult thing for them to do, or just not thought of yet?
     
  6. def

    def Interactive Brokers

    just to let you know, i'm not passing these types of suggestions along in the short term as the product was just released. I assume more functionality will be added as we move forward. I'll keep track of what you are requesting and will mention them at appropriate time (for me).

    but for starters: in beta right now is release 754. It will allow activeX socket clients to download open orders.
     
  7. jaan

    jaan

    def,

    thanks a lot!

    - jaan