Hi guys,
I am a software engineer by trade, and currently building an automated trading platform on my spare time.
And so I have recently joined IB and downloaded their 9.72 API samples.
I have started inspecting the C# implementation, and I have to say it seems to be poorly written by today's standards.
Instead of using a producer/consumer queue which is also available in the .Net framework (BlockingCollection<T>) they had implemented one by themselves with a Queue<T> and a low level locking mechanism.
And thus they lock the queue every enqueue/dequeue which is wasteful compared to modern implementations.
But this is actually beside the point, just an observation after a very quick dive into their code.
What really concerns me is that every call to the actual server has to go through the Gateway or TWS.
And so I am not sure how do they implement this logic internally since this is a blackbox essentially.
I have several questions that I hope you guys could answer regarding the Gateway to IB servers communication:
1. Does the gateway poll the IB server for updates if a market data stream is requested, or does the server push all updates for all requested stocks.
2. If the data is polled what is the polling frequency?
3. If the data is pushed, is there a push frequency as well (if for instance changes are aggregated and pushed every 0.5 seconds)?
4. Pretty sure I know the answer to this but I need to make sure:
Are all tick changes sent to the gateway?
For instance if there were 100 prices changes in 0.5 seconds are all 100 changes sent to the gateway?
5. This is a bit unrelated but if you guys also worked with TD Ameritrade API, is it also limited to 100 concurrent market streams (without extra fee)? and also how was working with their API in general?
I am a software engineer by trade, and currently building an automated trading platform on my spare time.
And so I have recently joined IB and downloaded their 9.72 API samples.
I have started inspecting the C# implementation, and I have to say it seems to be poorly written by today's standards.
Instead of using a producer/consumer queue which is also available in the .Net framework (BlockingCollection<T>) they had implemented one by themselves with a Queue<T> and a low level locking mechanism.
And thus they lock the queue every enqueue/dequeue which is wasteful compared to modern implementations.
But this is actually beside the point, just an observation after a very quick dive into their code.
What really concerns me is that every call to the actual server has to go through the Gateway or TWS.
And so I am not sure how do they implement this logic internally since this is a blackbox essentially.
I have several questions that I hope you guys could answer regarding the Gateway to IB servers communication:
1. Does the gateway poll the IB server for updates if a market data stream is requested, or does the server push all updates for all requested stocks.
2. If the data is polled what is the polling frequency?
3. If the data is pushed, is there a push frequency as well (if for instance changes are aggregated and pushed every 0.5 seconds)?
4. Pretty sure I know the answer to this but I need to make sure:
Are all tick changes sent to the gateway?
For instance if there were 100 prices changes in 0.5 seconds are all 100 changes sent to the gateway?
5. This is a bit unrelated but if you guys also worked with TD Ameritrade API, is it also limited to 100 concurrent market streams (without extra fee)? and also how was working with their API in general?