Ahm, i really don't know where to put this subject...
I'm trying to establish a data structure from raw data.... and this raw data sometimes doesn't come in the right order
private void OnMarketData(object sender, MarketDataEventArgs obj) { lock(obj.Instrument.SyncMarketData) lock(obj.Instrument.SyncMarketDepth) { if (obj.MarketDataType != MarketDataType.Last) return; double Position = 0; MarketDataType MarketType = MarketDataType.Ask; if (obj.Price >= obj.Ask) { MarketType = MarketDataType.Ask; Position = obj.Price - obj.Ask; } else if (obj.Price <= obj.Bid) { MarketType = MarketDataType.Bid; Position = obj.Bid - obj.Price; } try { Position = Position / TickSize; } catch(Exception e) { Position = 0; } Row row = new Row(obj) { MarketType = MarketType, Position = (int)Position }; Registry.Add(row); if (Printing) Output(row); } }
private void OnMarketDepth(object sender, MarketDepthEventArgs obj) { lock(obj.Instrument.SyncMarketData) lock(obj.Instrument.SyncMarketDepth) { Row row = new Row(obj); Registry.Add(row); if (Printing) Output(row); } }
I flagged the problem in the image, you can see that there are other cases, sometimes they share the DateTime, sometimes they don't, but the most important is that they are not capable to receive the events in the right order.
Therefore you will have troubles to reconstruct this data.
If you know how to solve this, or some kind of temporary solution.... I'm all ears(or.. eyes..)
My regards.
Fernando.-
Comment