i looked at the samplecodefor level2Book NT8 code ...
// protect e.Instrument.MarketDepth.Asks and e.Instrument.MarketDepth.Bids against in-flight changes
lock (e.Instrument.SyncMarketDepth)
{
............. detail
process Add Remove Update
}
is it recommended or necessary to bracket the code in a lock { }
I am mostly processing the Update Operation -
it would seem on printing out all the events that the
Add and Remove are when new rows are added to the level 2 book
and when a volume changes on an existing row? or is it only for rows added and removed?
It seems the information i want and to keep track of comes with the Update for the price level in question and whether at the bid or ask.
Looking at the help page only has a short example of printing the update operation.
So my question was to gain a little more clarity confirmation on this.
if orders are pulled from the order book price level on ask or bid side :
is an event triggered for Remove of the those orders AND an event for an update to that price level for the bid or ask? or will i only get the update event.
Also i presume there is no way to know if orders on the book are actually filled by market orders vs pulled/removed?
Similarly if limits are added to the ask or bid at a price level - the Add event is triggered with the volume of contracts : this is in addition to an update for the change to that price level. So in some instances 2 events are triggered -
the add event and then update event
the remove event and then the update event ?
just trying to figure out the sequence for this (if there is a sequence)
printing out the values helps to see this somewhat and the indicator i have written is working fine but i am just wanting to be thorough on the data i am processing.
the indicator i am testing has 2 versions one with the lock bracket code and one without ... the outputs do look different .... so without the lock i am missing some synchronicity in the processing and some events are being missed without the lock code in place?
Any input to the above would be appreciated
thanks
Comment