For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
28 5 8 12

How to build and keep full order book snapshot using EMA MarketByPrice domain - C++

Hi,

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.

Thanks.

elektronrefinitiv-realtimeelektron-sdkmarket-by-pricelevel-2order-bookmap-entry
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Monitored by @Warat B.

Hi @mojtaba.danai

I have written an article on how to sort Level 2 data - which is currently being reviewed before it can be published on this site.

If you are interested I can email you a PDF copy directly to you - let me know.

Hi @Umer Nalla

Thanks. I will be very interested in the article you are writing. Would you please send me this?

My email address is: <removed>

Regards

Mojtaba Danai

I have emailed you the article. As mentioned please ask any follow up questions here on the forum or via the Data Helpdesk (link in the article)

Hi @mojtaba.danai,

Thank you for your participation in the forum.

Is a reply below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question. Thanks,

AHS

Upvotes
Accepted
4.4k 10 6 9

Hi @mojtaba.danai

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks @Warat

Upvote
25.3k 87 12 25

There is now an article related to Sorting / Ranking Order Books available at

Sorting/Ranking Level2 Order Books for Display purposes

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks Umer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.