Originally posted by TriPack
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?
That quote feed performance would suffer in an OCX implementation compared to DDE is something that was clear even before they released the OCX. COM adds lots of additional abstraction layers compared to DDE which is actually a very efficient window message based protocol. There is absolutely no reason to switch to the OCX if you just want quotes. (MS is pushing a new COM-based technology for streaming data delivery called RTD that is supposed to supercede the traditional DDE links into applications like Excel. However, this requires special COM interfaces to be implemented and is only supported starting with Excel XP).
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.
I believe the OCX is simply a wrapper around the socket API that IB released along with it. It probably uses a Windows timer that triggers once per second to check the socket for incoming data. I guess your best bet is to use the socket API directly which allows you to implement your own polling mechanism and approximate synchronization by polling e.g. every 1/10 second.
But why not stick with DDE in the first place? From what I've seen so far, the OCX does not add anything that the DDE interface does not already provide. And DDE is fast, efficient and easily programmed from C++ as well as applications like Excel.
The biggest gripe I have with the API is that ID management is not internalized within TWS and exposed through methods like GetNewID(). The current implementation renders the concurrent use of multiple applications that don't explicitly synchronize their use of IDs with each other impossible. I had hoped that this would change with the OCX and socket API, but I guess not.
Dave
