Thursday, November 25, 2010

ActiveX vs Java API what's the difference?

There has been quite a discussion on Chans blog about ActiveX vs Java API. One of the claims presented by Anonymous is that ActiveX is missing ticks when another function is executing. This alarmed me as I rely heavily on the  ActiveX api.
So I've tested this claim: while tws events are handled in the background by the wrapper and listener classes, I start a ~10 second 100% cpu intensive task in the foreground. After this I examine the timestamps of each tick.
The results are in the figure:
On the horizontal axis is the logged tick number and tick timestamp is plotted vertically. The cpu is loaded between the red lines. This graph shows that during cpu load no ticks reach the listener class, however no events are lost as they are all fired up just after the cpu has some available time.
The other claims were quite vague as 'performance', as far as I'm concerned I've never had any performance issues using activeX. And last but not least, if you need 'performance' why do you use Matlab??? I would directly go for some native language and FIX CTCI api.

So I'm sticking with the ActiveX for now.


  1. This comment has been removed by a blog administrator.

  2. Hi everyone,

    I get the following(see under) error message, can some help out?

    Best FinArt

    deleting tws class...
    Error using feval
    Input PROGID does not represent an Activex control.
    If this PROGID used to work before, please check vendor's
    documentation for equivalent activex control progid.

    Error in C:\Program Files\MATLAB\R2011b\toolbox\matlab\winfun\actxcontrol.p>actxcontrol/createControl (line

    Error in C:\Program Files\MATLAB\R2011b\toolbox\matlab\winfun\actxcontrol.p>actxcontrol (line 181)

    Error in CTws (line 35)
    obj.tws = actxcontrol('TWS.TwsCtrl.1',[0 0 0 0],obj.f);

    Error in demoScript (line 9)
    tws = CTws;

    1. Please contact IB technical support for this.

  3. Hi,
    I am not sure if the blog still alive, but I hope so...anyway :)

    i am trying to subscribe open/high/low/close prices 15 min before the Stock exchange is closed(doing it on ~1.5K quotes 50 in a time), and everything looks fine, But when i am trying to do it 10min before the stock exchange is closed, i am getting timeouts...and I can't receive data for all required stocks, do you know what is the problem ?

    -May be if I will move to Java-API it may help ?

    thnx in advence

    1. I don't think a switch from ActiveX to Java would change much.