IB ActiveX

Discussion in 'Interactive Brokers' started by rickty, Feb 8, 2002.

  1. rickty

    rickty

    I was waiting for an IB ActiveX thread to spring up, but
    searching around a bit I found discussion on this in the
    very long thread "IB Improvements (Part 2)". I think this
    topic deserves a thread of its own.

    I down loaded the ActiveX files from IB, but I'm sorry
    to say that I'm a bit lost as to what they're offering.
    I couldn't find any documentation, so yesterday I emailed
    IB about it. They've yet to get back to me. Is all this
    code obvious to someone?

    I'm hoping someone here could give me an overview of
    what IB has given us.

    Some basic questions:
    1) As it is, does Excel need to be used with the ActiveX control?
    If so, is there a way to have direct control of the TWS via
    C++ commands? My ultimate aim is to control the TWS from C++ code.
    I'm hoping this can be done. Any ideas on how?

    2) I compilied their two C++ projects: i) in directory TestActiveX,
    and ii) in directory TestSocketClient. They compiled and linked OK
    but crashed on execution. Anyone know the cause of this?

    Any input will be appreciated,

    Richard
     
  2. Yes the activex stuff is quite straightforward just look at the testactivex project and thats all you need. Other than tws not currently working with it you can see all the functionality.

    Basically its all contained in the two files called tws.h and tws.cpp this is a wrapper interface class generated by MFC to access the activex control. So you only need to copy those two files into your project. Then you need to create an object of type CTws and call the Create function on it to get it initialized.

    After that you can use the various Methods in CTws to do the actual order manipulation. One last advanced thing you might want to do if you want to be notified by events from the TWS is to derive your own class from CTws and use the EVENTSINK_MAP
    functionality in MFC to route the events to functions in your class.

    Note that in the example code a lot of this is simplified by having the CTws as an object within a dialog. MFC handles all the creation and eventsink stuff automatically if you put it in a dialog.

    I don't know why you are getting an error when executing the test app. Works fine for me.
     
  3. Also you should check the online manual onthe IB website under the trading systems link. They have documentation on the ActiveX interface.
     
  4. nitro

    nitro

    Please, in the hope of making this useful, it might make sense from now on to:

    1) State the OS and patch level you are using
    2) The MSVC version (or other programming env) and patch level that you are using
    3) etc (Other important things I may have missed, e.g., the CRT version)

    I have three machines I tried this under, two are Win2K machines, SP-2, using MSVC 6.0, under TWS 752.6, and the other is a WinNT 4 machine SP-6 using MSVC 6 under TWS 752.6.

    I can't even get TWS the old Excel Integration to work correctly under the Win2K machines, but for some unknown (or unrelated) reason, the ActiveX example works great under the WinNT 4 machine.

    If I can figure out why this is the case, I will post here.

    nitro
     
  5. nitro

    nitro

    Well, I did some searching, and the only thing that I could come up with is that the Win2K machines went through quite a few TWS upgrades, whereas the WinNT 4 machine went from a relatively older TWS version to the new build.

    The hypothesis is that there may be a stale file or Registry setting that may be the culprit.

    This is relatively worthless "knowledge" (even if true) except to possibly the TWS developers, who probably have considered this already.

    nitro
     
  6. rickty

    rickty

    juggernaut, very useful information, thank you.
    echo33029, I found the documentation, thanks.
    Now I can get started.

    While I have extensive experience in MSVC++/MFC,
    I have none in ActiveX. I suspect that my sample
    files are crashing because I haven't somehow
    included the tws.ocx file with these samples.
    Can anyone tell how this is done?

    Richard
     
  7. it appears that it's possible to interact with TWS via sockets alone. Have anyone looked into that ?

    Personally, since I use Java, that would be much easier than having to call the activeX component.
     
  8. nitro

    nitro

    There are ActiveX <-> Bean bridges that would make this "simple."

    nitro
     
  9. nitro,

    Yes, i understand. I just noticed that the code seems to depend on the TWSSocketClient.lib so I couldn't immediately figure out if that was some sort of support class that was required or just a compiled version of the socket client. I'll have to look at it in more detail. Worst case it's pretty simple to call DLLs from Java.
     
  10. I made a simple test application to try out the new ActiveX OCX. It is very simple to get up and running and the documentation is straightforoward. I was hoping that not only would it allow more reliable communications but also FASTER transmission of data. When I compared quotes this morning I noticed that the ActiveX quotes were consistently lagging behind the DDE quotes (which themselves aren't as fast as I would like.) Can someone verify if they are receiving the same results?

    The online manual states that the ActiveX OCX receives quotes updated every second. This is fine because the TWS only updates every second. However it appears that there is a separate timer working for the ActiveX control than for the TWS. This means that the additional delay due to unsynchronized timers is between 0 and 1 second. It would be nice if the TWS could use the same timer loop (or somehow synchronize to the TWS timer) to fire off quotes to the ActiveX OCX, rather than just operating independently.

    Maybe I'm just being picky, but this is important to me. I hope that transmission of orders isn't unnecessarily delayed due to the design choice, but rather that it only affects quote delivery. Even there I would prefer faster faster faster!

    Thanks for listening.
     
    #10     Feb 11, 2002