We are using Elektron Message API C++ edition to receive level 1 and level 2 market data. In case of level 2 or order book retrieval, the call back messages contain a Map with which defines an action (Add, Update or Delete) for each map entry for an order book level. In case of Delete action there is no FieldList associated with the map and the corresponding MapEntry has only a Key which is not supposed to be parsed according to the documentation.
So, one question is whether we can make an assumption that map entries are sorted by map entry key and whether we can use this key to find which level is added, updated or deleted for each order side (Bid or Ask)?
Another question is, how do we know which order book level to delete when there is no price and order side information available? We have overcome this by keeping an internal map of MapEntry key (which is retrieved as EmaBuffer) and corresponding price\orderside combination as the value.
The Consumer220 sample is the only example using MarketByPrice domain, and there is not so much details about applying the Delete action.
Yes, map entries are sorted by keys and you should use it for Add, Update, and Delete.
EMA map work just like any map container. It is an associative containers formed by a combination of a key and value, where in MarketByPrice case value is a FieldList.
Every Add and Update action will give you a Key which is associate with the value in that action. In case of Delete, it will give you a Key only since value is not necessary because you are suppose to delete it. You should use the Key from Delete action to find the value you stored.
The guide says "a Key is not supposed to be parsed" because right now MarketByPrice Key is a combination of price and side which give a false sense that you can just use the Key and ignore the FieldList. This is NOT safe, as the Key may not represent the actual price (i.e. it might be truncated). So the guide must state it to avoid incorrect usage.
There is now an article related to Sorting / Ranking Order Books available at