Skip to content

Commit c9ff3a5

Browse files
Update itch protocols
1 parent c659f42 commit c9ff3a5

14 files changed

Lines changed: 2234 additions & 818 deletions

Nasdaq/Nasdaq_IseOptions_OrderComboFeed_Itch_v1_1_Dissector.lua

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@ omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.fields.auction_response_index = P
8080
omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.fields.leg_information_index = ProtoField.new("Leg Information Index", "nasdaq.iseoptions.ordercombofeed.itch.v1.1.leginformationindex", ftypes.UINT16)
8181
omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.fields.message_index = ProtoField.new("Message Index", "nasdaq.iseoptions.ordercombofeed.itch.v1.1.messageindex", ftypes.UINT16)
8282

83+
-----------------------------------------------------------------------
84+
-- Nasdaq IseOptions OrderComboFeed Itch 1.1 Formatting
85+
-----------------------------------------------------------------------
86+
87+
-- timestamp format
88+
local timestamp_format_enum = {
89+
{ 1, "Raw", 0 },
90+
{ 2, "Time of Day", 1 },
91+
{ 3, "Full DateTime", 2 }
92+
}
93+
94+
-- 0=Raw, 1=TimeOfDay, 2=FullDateTime
95+
nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp_format = 2
96+
97+
-- Hours behind UTC (EST) for midnight calculation
98+
nasdaq_iseoptions_ordercombofeed_itch_v1_1.utc_offset_hours = 5
99+
100+
83101
-----------------------------------------------------------------------
84102
-- Declare Dissection Options
85103
-----------------------------------------------------------------------
@@ -110,6 +128,8 @@ omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.show_message_index = Pref.b
110128
omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.show_leg_information_index = Pref.bool("Show Leg Information Index", show.leg_information_index, "Show generated leg information index in protocol tree")
111129
omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.show_auction_response_index = Pref.bool("Show Auction Response Index", show.auction_response_index, "Show generated auction response index in protocol tree")
112130

131+
omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.timestamp_format = Pref.enum("Timestamp Format", 2, "Timestamp display format", timestamp_format_enum, false)
132+
omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC (EST) for midnight calculation")
113133

114134
-- Handle changed preferences
115135
function omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs_changed()
@@ -145,6 +165,12 @@ function omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs_changed()
145165
if show.auction_response_index ~= omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.show_auction_response_index then
146166
show.auction_response_index = omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.show_auction_response_index
147167
end
168+
if nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp_format ~= omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.timestamp_format then
169+
nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp_format = omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.timestamp_format
170+
end
171+
if nasdaq_iseoptions_ordercombofeed_itch_v1_1.utc_offset_hours ~= omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.utc_offset_hours then
172+
nasdaq_iseoptions_ordercombofeed_itch_v1_1.utc_offset_hours = omi_nasdaq_iseoptions_ordercombofeed_itch_v1_1.prefs.utc_offset_hours
173+
end
148174
end
149175

150176

@@ -1359,8 +1385,28 @@ nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp = {}
13591385
nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp.size = 6
13601386

13611387
-- Display: Timestamp
1362-
nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp.display = function(value)
1363-
return "Timestamp: "..value
1388+
nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp.display = function(value, buffer, offset, packet, parent)
1389+
-- Raw display mode
1390+
if nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp_format == 0 then
1391+
return "Timestamp: "..value
1392+
end
1393+
1394+
-- Parse nanoseconds since midnight
1395+
local seconds = (value / UInt64(1000000000)):tonumber()
1396+
local nanoseconds = (value % UInt64(1000000000)):tonumber()
1397+
1398+
-- Full datetime mode (calculate from capture date + UTC offset)
1399+
if nasdaq_iseoptions_ordercombofeed_itch_v1_1.timestamp_format == 2 and packet then
1400+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
1401+
local utc_offset_seconds = nasdaq_iseoptions_ordercombofeed_itch_v1_1.utc_offset_hours * 3600
1402+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
1403+
local full_seconds = local_midnight + seconds
1404+
1405+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", full_seconds)..string.format("%09d", nanoseconds)
1406+
end
1407+
1408+
-- Time of day mode
1409+
return "Timestamp: "..os.date("%H:%M:%S.", seconds)..string.format("%09d", nanoseconds)
13641410
end
13651411

13661412
-- Dissect: Timestamp

Nasdaq/Nasdaq_IseOptions_OrderFeed_Itch_v1_1_Dissector.lua

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ omi_nasdaq_iseoptions_orderfeed_itch_v1_1.fields.trading_action_message = ProtoF
8181
omi_nasdaq_iseoptions_orderfeed_itch_v1_1.fields.auction_response_index = ProtoField.new("Auction Response Index", "nasdaq.iseoptions.orderfeed.itch.v1.1.auctionresponseindex", ftypes.UINT16)
8282
omi_nasdaq_iseoptions_orderfeed_itch_v1_1.fields.message_index = ProtoField.new("Message Index", "nasdaq.iseoptions.orderfeed.itch.v1.1.messageindex", ftypes.UINT16)
8383

84+
-----------------------------------------------------------------------
85+
-- Nasdaq IseOptions OrderFeed Itch 1.1 Formatting
86+
-----------------------------------------------------------------------
87+
88+
-- timestamp format
89+
local timestamp_format_enum = {
90+
{ 1, "Raw", 0 },
91+
{ 2, "Time of Day", 1 },
92+
{ 3, "Full DateTime", 2 }
93+
}
94+
95+
-- 0=Raw, 1=TimeOfDay, 2=FullDateTime
96+
nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp_format = 2
97+
98+
-- Hours behind UTC (EST) for midnight calculation
99+
nasdaq_iseoptions_orderfeed_itch_v1_1.utc_offset_hours = 5
100+
101+
84102
-----------------------------------------------------------------------
85103
-- Declare Dissection Options
86104
-----------------------------------------------------------------------
@@ -107,6 +125,8 @@ omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.show_packet_header = Pref.bool("
107125
omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.show_message_index = Pref.bool("Show Message Index", show.message_index, "Show generated message index in protocol tree")
108126
omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.show_auction_response_index = Pref.bool("Show Auction Response Index", show.auction_response_index, "Show generated auction response index in protocol tree")
109127

128+
omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.timestamp_format = Pref.enum("Timestamp Format", 2, "Timestamp display format", timestamp_format_enum, false)
129+
omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC (EST) for midnight calculation")
110130

111131
-- Handle changed preferences
112132
function omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs_changed()
@@ -136,6 +156,12 @@ function omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs_changed()
136156
if show.auction_response_index ~= omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.show_auction_response_index then
137157
show.auction_response_index = omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.show_auction_response_index
138158
end
159+
if nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp_format ~= omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.timestamp_format then
160+
nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp_format = omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.timestamp_format
161+
end
162+
if nasdaq_iseoptions_orderfeed_itch_v1_1.utc_offset_hours ~= omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.utc_offset_hours then
163+
nasdaq_iseoptions_orderfeed_itch_v1_1.utc_offset_hours = omi_nasdaq_iseoptions_orderfeed_itch_v1_1.prefs.utc_offset_hours
164+
end
139165
end
140166

141167

@@ -1335,8 +1361,28 @@ nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp = {}
13351361
nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp.size = 6
13361362

13371363
-- Display: Timestamp
1338-
nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp.display = function(value)
1339-
return "Timestamp: "..value
1364+
nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp.display = function(value, buffer, offset, packet, parent)
1365+
-- Raw display mode
1366+
if nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp_format == 0 then
1367+
return "Timestamp: "..value
1368+
end
1369+
1370+
-- Parse nanoseconds since midnight
1371+
local seconds = (value / UInt64(1000000000)):tonumber()
1372+
local nanoseconds = (value % UInt64(1000000000)):tonumber()
1373+
1374+
-- Full datetime mode (calculate from capture date + UTC offset)
1375+
if nasdaq_iseoptions_orderfeed_itch_v1_1.timestamp_format == 2 and packet then
1376+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
1377+
local utc_offset_seconds = nasdaq_iseoptions_orderfeed_itch_v1_1.utc_offset_hours * 3600
1378+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
1379+
local full_seconds = local_midnight + seconds
1380+
1381+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", full_seconds)..string.format("%09d", nanoseconds)
1382+
end
1383+
1384+
-- Time of day mode
1385+
return "Timestamp: "..os.date("%H:%M:%S.", seconds)..string.format("%09d", nanoseconds)
13401386
end
13411387

13421388
-- Dissect: Timestamp

0 commit comments

Comments
 (0)