Open-Markets-Initiative / wireshark-lua

Source generated cross platform Wireshark dissectors
GNU General Public License v3.0
186 stars 63 forks source link

Symbol Index Mapping Security Type decode should be conditional on Exchange Code #8

Closed bkulback closed 5 years ago

bkulback commented 5 years ago

In the "Nyse.Equities.IntegratedFeed.Xdp.v2.1.g.Lua" dissector (and maybe others), the specification for XDP Common Client (https://www.nyse.com/publicdocs/nyse/data/XDP_Common_Client_Specification_v2.1h.pdf) and earlier indicate the "Security Type" field of SYMBOL INDEX MAPPING MESSAGE (MSG TYPE 3) should be decoded one way if Exchange Code is "N" and another way if not.

In my case, Symbol "IBM" has an Exchange Code of "N" and Security Type of "A". It is being displayed as "Security Type: Adr (A)". It should be displayed as "Security Type: Common Stock (A)"

Unfortunately, I am unable to provide the underlying data capture.

Open-Markets-Initiative commented 5 years ago

Thanks for bringing this to my attention. This common enum is actually 2 separate enums. We have a couple of options. Is the amex version a separate protocol?

bkulback commented 5 years ago

I thought this might be interesting. The integrated feed carries all the ICE/NYSE equity markets now in the same “protocol”. It’s truly a union of enums with the key being the Exchange Code field in the same message (nyse.equities.integratedfeed.xdp.v2.1.g.exchangecode). I’ve written a number of LUA decoders in the past and it’s been a challenge using discrete functions per field – I hope your generator can handle this.

From the latest spec, Security Type of Arca (P), National (C) & American (A) use one set of enums. NYSE (N) uses a different set. Note that the specification does not explicitly state National as ‘C’, but it follows from the standard exchange codes. Further, National doesn’t have any listings at this time … so ‘C’ should not appear. My recommendation would be to check ‘N’ (or not ‘N’) to determine which set to use.

From: Open-Markets-Initiative notifications@github.com Sent: Wednesday, May 8, 2019 10:09 PM To: Open-Markets-Initiative/wireshark-lua wireshark-lua@noreply.github.com Cc: Bruce Kulback bruce.kulback@quantum-prop.com; Author author@noreply.github.com Subject: Re: [Open-Markets-Initiative/wireshark-lua] Symbol Index Mapping Security Type decode should be conditional on Exchange Code (#8)

Thanks for bringing this to my attention. This common enum is actually 2 separate enums. We have a couple of options. Is the amex version a separate protocol?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Open-Markets-Initiative/wireshark-lua/issues/8#issuecomment-490715466, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE4Q7X3UN54SULQAMCOI5L3PUOBR5ANCNFSM4HLS2MXA.

Open-Markets-Initiative commented 5 years ago

The generator can handle switching on a value (which is how we handle the message branching) but this is a more complicated situation. In addition to the lua, where performance is relatively slow, we are generating multi language machine optimized parsers that take advantage of overloading on types. Short story long: these enums are different types that just happen to overlay. When building the protocol model, how would that look in c++?

A couple options spring to mind:

1) Generate a separate protocol for Amex with a few changes. On closer inspection it looks like arca also has special values in a few of the messages. This is actually fairly common for exchange protocols.

2) Branch on this value with a separate struct overlay. Note that this value will be read every time this message is parsed, increasing the lower bound for the minimum number of instructions.

3) We add union with dependency to the generator.

If the data between separate exchanges is comingled, then we have to do 2 or 3. Otherwise we should do 1, which is surprisingly the easiest. We will review and see what to do.