I have some issues with subscription to MarketData events (Level1 or Time&Sales) on BarsRequest objects.
I can subscribe well to OnBarUpdate (Update event) from BarsRequest objects and works fine.
But I need to subscribe also to MarketData event from BarsRequest objects.
If I subscribe to MarketDataUpdate event from BarsRequest.Bars.Instrument.MarketDataUpdate looks like all works fine: first an OnBarUpdate event is received and then inmediately an OnMarketData event is received. The volumens match exactly and the time secuency is correct.
The next image reports the following sequence:
First: OnBarUpdate event, with Close price and Volume of the bar.
Next: MarketDataUpdate event, with Last Price and volume of the print.
The bug happens when I try unsubscribe to MarketDataUpdate when the indicator is Terminated. Then I get an exception, and the connection continues live receiving OnMarketData events.
Other alternative is subscribe to BarsRequest.Bars.Instrument.MarketData.Update like the Help advises. In this case the desubscription doesn't raise any exception, but the live events (OnBarUpdate vs OnMarketData) are very unsynchronized.
But the main issue is that some times the OnMarketData events are duplicated as you can see in the image.
I attach the code. It is an indicator but should works equal like add-on (the bugs are the same).
For example, I load the indicator on ES 06-17 Range-4, 3-days.
In short, there are two bugs:
1.- Subscribing to MarketDataUpdate: exception when I make the disposing (bug).
2.- Subscribing to MarketData.Update: desynchronization (can be expected) and duplicated events (bug).
Sorry for the length but my english level is not high and wanted explain correctly the context.
Thanks.
Comment