Author |
Topic: Multiple client_OnBarsReceived per RequestBars call (3 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
DRichards310 Posts: 2 Joined: Dec 05, 2011 |
Hi,
I seem to be experiencing a problem where I recieve multiple events for each call I make. Is this normal? A common thing I am seeing; RequestBars client_OnBarsReceived RequestBars client_OnBarsReceived client_OnBarsReceived client_OnBarsReceived client_OnBarsReceived client_OnBarsReceived I use my own ThreadingPolicy class, but basically all I do in Post is call action() inside the worker thread you are giving me so I cannot see how that could cause this. This is a service app and so I am unable to use you normal synchronization context that queues to the windows UI thread loop. Dave Richards |
||||
DRichards310 Posts: 2 Joined: Dec 05, 2011 |
I also tried simply changing post to
public void Post(APIAction action) { var thread = new Thread(() => { action(); }); thread.Start(); } just to put it on a different thread, but to no effect. Dave Richards |
||||
RuslanK Posts: 69 Joined: Jun 02, 2010 |
Hello,
The answer to your first question is: Yes, it is completely normal behavior. Once you request bars we sending them back to you in "packets" - usually 4096 per event. We also send empty packet (zero bars) at the end of series to signal you that no more historical data will come for this request. Please pay your attention to the fact that API does not support multithreading, so please avoid making calls of API from different threads - it is supposed to work in single thread appartment model only. Let me know if you have any questions. Ruslan Kartokhin Software Developer |
||||