Skip to content

Commit dd97801

Browse files
Regenerate cboe protocols with better timestamps
1 parent 3e4137b commit dd97801

6 files changed

Lines changed: 145 additions & 32 deletions

Cboe/Cboe_C1Options_AuctionFeed_Pitch_v1_1_1_Dissector.lua

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.show_packet = Pref.bool("Show
9393
omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.show_packet_header = Pref.bool("Show Packet Header", show.packet_header, "Parse and add Packet Header to protocol tree")
9494
omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.show_message_index = Pref.bool("Show Message Index", show.message_index, "Show generated message index in protocol tree")
9595

96+
-- Time Offset Display Preferences
97+
cboe_c1options_auctionfeed_pitch_v1_1_1.time_offset_format = 2 -- 0=Raw, 1=TimeOfDay, 2=FullDateTime
98+
cboe_c1options_auctionfeed_pitch_v1_1_1.utc_offset_hours = 5 -- Hours behind UTC (EST = 5, EDT = 4, UTC = 0)
99+
100+
local time_offset_format_enum = {
101+
{ 1, "Raw", 0 },
102+
{ 2, "Time of Day", 1 },
103+
{ 3, "Full DateTime", 2 }
104+
}
105+
106+
omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.time_offset_format = Pref.enum("Time Offset Format", 2, "Time Offset display format", time_offset_format_enum, false)
107+
omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC for midnight calculation (EST=5, EDT=4, UTC=0)")
108+
96109
-- Handle changed preferences
97110
function omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs_changed()
98111

@@ -115,6 +128,14 @@ function omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs_changed()
115128
if show.message_index ~= omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.show_message_index then
116129
show.message_index = omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.show_message_index
117130
end
131+
132+
-- Check Time Offset preferences
133+
if cboe_c1options_auctionfeed_pitch_v1_1_1.time_offset_format ~= omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.time_offset_format then
134+
cboe_c1options_auctionfeed_pitch_v1_1_1.time_offset_format = omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.time_offset_format
135+
end
136+
if cboe_c1options_auctionfeed_pitch_v1_1_1.utc_offset_hours ~= omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.utc_offset_hours then
137+
cboe_c1options_auctionfeed_pitch_v1_1_1.utc_offset_hours = omi_cboe_c1options_auctionfeed_pitch_v1_1_1.prefs.utc_offset_hours
138+
end
118139
end
119140

120141

@@ -1105,12 +1126,28 @@ cboe_c1options_auctionfeed_pitch_v1_1_1.timestamp = {}
11051126

11061127
-- Translate: Timestamp
11071128
cboe_c1options_auctionfeed_pitch_v1_1_1.timestamp.translate = function(time_offset, stored_time)
1108-
return UInt64.new(stored_midnightreference + stored_time * 1000000000 + time_offset)
1129+
return UInt64.new(stored_time * 1000000000 + time_offset)
11091130
end
11101131

11111132
-- Display: Timestamp
1112-
cboe_c1options_auctionfeed_pitch_v1_1_1.timestamp.display = function(time_offset, stored_time)
1113-
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_time)..string.format("%09d", time_offset)
1133+
cboe_c1options_auctionfeed_pitch_v1_1_1.timestamp.display = function(time_offset, stored_time, packet)
1134+
-- Raw display mode
1135+
if cboe_c1options_auctionfeed_pitch_v1_1_1.time_offset_format == 0 then
1136+
return "Timestamp: "..(stored_time * 1000000000 + time_offset)
1137+
end
1138+
1139+
-- Full datetime mode (calculate from capture date + UTC offset)
1140+
if cboe_c1options_auctionfeed_pitch_v1_1_1.time_offset_format == 2 and packet then
1141+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
1142+
local utc_offset_seconds = cboe_c1options_auctionfeed_pitch_v1_1_1.utc_offset_hours * 3600
1143+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
1144+
local full_seconds = local_midnight + stored_time
1145+
1146+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", full_seconds)..string.format("%09d", time_offset)
1147+
end
1148+
1149+
-- Time of day mode
1150+
return "Timestamp: "..os.date("%H:%M:%S.", stored_time)..string.format("%09d", time_offset)
11141151
end
11151152

11161153
-- Composite: Timestamp

Cboe/Cboe_C1Options_Complex_Pitch_v2_1_18_Dissector.lua

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ omi_cboe_c1options_complex_pitch_v2_1_18.prefs.show_packet_header = Pref.bool("S
136136
omi_cboe_c1options_complex_pitch_v2_1_18.prefs.show_message_index = Pref.bool("Show Message Index", show.message_index, "Show generated message index in protocol tree")
137137
omi_cboe_c1options_complex_pitch_v2_1_18.prefs.show_complex_instrument_leg_index = Pref.bool("Show Complex Instrument Leg Index", show.complex_instrument_leg_index, "Show generated complex instrument leg index in protocol tree")
138138

139+
-- Time Offset Display Preferences
140+
cboe_c1options_complex_pitch_v2_1_18.time_offset_format = 2 -- 0=Raw, 1=TimeOfDay, 2=FullDateTime
141+
cboe_c1options_complex_pitch_v2_1_18.utc_offset_hours = 5 -- Hours behind UTC (EST = 5, EDT = 4, UTC = 0)
142+
143+
local time_offset_format_enum = {
144+
{ 1, "Raw", 0 },
145+
{ 2, "Time of Day", 1 },
146+
{ 3, "Full DateTime", 2 }
147+
}
148+
149+
omi_cboe_c1options_complex_pitch_v2_1_18.prefs.time_offset_format = Pref.enum("Time Offset Format", 2, "Time Offset display format", time_offset_format_enum, false)
150+
omi_cboe_c1options_complex_pitch_v2_1_18.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC for midnight calculation (EST=5, EDT=4, UTC=0)")
151+
139152
-- Handle changed preferences
140153
function omi_cboe_c1options_complex_pitch_v2_1_18.prefs_changed()
141154

@@ -167,6 +180,14 @@ function omi_cboe_c1options_complex_pitch_v2_1_18.prefs_changed()
167180
if show.complex_instrument_leg_index ~= omi_cboe_c1options_complex_pitch_v2_1_18.prefs.show_complex_instrument_leg_index then
168181
show.complex_instrument_leg_index = omi_cboe_c1options_complex_pitch_v2_1_18.prefs.show_complex_instrument_leg_index
169182
end
183+
184+
-- Check Time Offset preferences
185+
if cboe_c1options_complex_pitch_v2_1_18.time_offset_format ~= omi_cboe_c1options_complex_pitch_v2_1_18.prefs.time_offset_format then
186+
cboe_c1options_complex_pitch_v2_1_18.time_offset_format = omi_cboe_c1options_complex_pitch_v2_1_18.prefs.time_offset_format
187+
end
188+
if cboe_c1options_complex_pitch_v2_1_18.utc_offset_hours ~= omi_cboe_c1options_complex_pitch_v2_1_18.prefs.utc_offset_hours then
189+
cboe_c1options_complex_pitch_v2_1_18.utc_offset_hours = omi_cboe_c1options_complex_pitch_v2_1_18.prefs.utc_offset_hours
190+
end
170191
end
171192

172193

@@ -1696,12 +1717,28 @@ cboe_c1options_complex_pitch_v2_1_18.timestamp = {}
16961717

16971718
-- Translate: Timestamp
16981719
cboe_c1options_complex_pitch_v2_1_18.timestamp.translate = function(time_offset, stored_time)
1699-
return UInt64.new(stored_midnightreference + stored_time * 1000000000 + time_offset)
1720+
return UInt64.new(stored_time * 1000000000 + time_offset)
17001721
end
17011722

17021723
-- Display: Timestamp
1703-
cboe_c1options_complex_pitch_v2_1_18.timestamp.display = function(time_offset, stored_time)
1704-
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_time)..string.format("%09d", time_offset)
1724+
cboe_c1options_complex_pitch_v2_1_18.timestamp.display = function(time_offset, stored_time, packet)
1725+
-- Raw display mode
1726+
if cboe_c1options_complex_pitch_v2_1_18.time_offset_format == 0 then
1727+
return "Timestamp: "..(stored_time * 1000000000 + time_offset)
1728+
end
1729+
1730+
-- Full datetime mode (calculate from capture date + UTC offset)
1731+
if cboe_c1options_complex_pitch_v2_1_18.time_offset_format == 2 and packet then
1732+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
1733+
local utc_offset_seconds = cboe_c1options_complex_pitch_v2_1_18.utc_offset_hours * 3600
1734+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
1735+
local full_seconds = local_midnight + stored_time
1736+
1737+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", full_seconds)..string.format("%09d", time_offset)
1738+
end
1739+
1740+
-- Time of day mode
1741+
return "Timestamp: "..os.date("%H:%M:%S.", stored_time)..string.format("%09d", time_offset)
17051742
end
17061743

17071744
-- Composite: Timestamp

Cboe/Cboe_C1Options_Complex_Pitch_v2_1_37_Dissector.lua

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,25 +1799,25 @@ end
17991799
cboe_c1options_complex_pitch_v2_1_37.timestamp = {}
18001800

18011801
-- Translate: Timestamp
1802-
cboe_c1options_complex_pitch_v2_1_37.timestamp.translate = function(time_offset, stored_midnight_reference)
1802+
cboe_c1options_complex_pitch_v2_1_37.timestamp.translate = function(time_offset, stored_midnight_reference, stored_time)
18031803
return UInt64.new(stored_midnight_reference + stored_time * 1000000000 + time_offset)
18041804
end
18051805

18061806
-- Display: Timestamp
1807-
cboe_c1options_complex_pitch_v2_1_37.timestamp.display = function(time_offset, stored_midnight_reference)
1808-
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_midnight_reference)..string.format("%09d", time_offset)
1807+
cboe_c1options_complex_pitch_v2_1_37.timestamp.display = function(time_offset, stored_midnight_reference, stored_time)
1808+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_midnight_reference + stored_time)..string.format("%09d", time_offset)
18091809
end
18101810

18111811
-- Composite: Timestamp
1812-
cboe_c1options_complex_pitch_v2_1_37.timestamp.composite = function(buffer, offset, stored_midnight_reference, packet, parent)
1812+
cboe_c1options_complex_pitch_v2_1_37.timestamp.composite = function(buffer, offset, stored_midnight_reference, stored_time, packet, parent)
18131813
local length = cboe_c1options_complex_pitch_v2_1_37.time_offset.size
18141814
local range = buffer(offset, length)
18151815
local time_offset = range:le_uint()
1816-
local value = cboe_c1options_complex_pitch_v2_1_37.timestamp.translate(time_offset, stored_midnight_reference)
1817-
local display = cboe_c1options_complex_pitch_v2_1_37.timestamp.display(time_offset, stored_midnight_reference)
1816+
local value = cboe_c1options_complex_pitch_v2_1_37.timestamp.translate(time_offset, stored_midnight_reference, stored_time)
1817+
local display = cboe_c1options_complex_pitch_v2_1_37.timestamp.display(time_offset, stored_midnight_reference, stored_time)
18181818
parent = parent:add(omi_cboe_c1options_complex_pitch_v2_1_37.fields.timestamp, range, value, display)
18191819

1820-
cboe_c1options_complex_pitch_v2_1_37.midnight_reference.generated(stored_midnight_reference, range, packet, parent)
1820+
cboe_c1options_complex_pitch_v2_1_37.time.generated(stored_time, range, packet, parent)
18211821

18221822
display = cboe_c1options_complex_pitch_v2_1_37.time_offset.display(time_offset)
18231823
parent:add(omi_cboe_c1options_complex_pitch_v2_1_37.fields.time_offset, range, time_offset, display)
@@ -1828,9 +1828,10 @@ end
18281828
-- Dissect: Timestamp
18291829
cboe_c1options_complex_pitch_v2_1_37.timestamp.dissect = function(buffer, offset, packet, parent)
18301830
local stored_midnight_reference = cboe_c1options_complex_pitch_v2_1_37.midnight_reference.current
1831+
local stored_time = cboe_c1options_complex_pitch_v2_1_37.time.current
18311832

1832-
if stored_midnight_reference ~= nil then
1833-
return cboe_c1options_complex_pitch_v2_1_37.timestamp.composite(buffer, offset, stored_midnight_reference, packet, parent)
1833+
if stored_midnight_reference ~= nil and stored_time ~= nil then
1834+
return cboe_c1options_complex_pitch_v2_1_37.timestamp.composite(buffer, offset, stored_midnight_reference, stored_time, packet, parent)
18341835
end
18351836

18361837
return cboe_c1options_complex_pitch_v2_1_37.time_offset.dissect(buffer, offset, packet, parent)

Cboe/Cboe_C1Options_MulticastDepthOfBook_Pitch_v2_39_4_Dissector.lua

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,19 @@ omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.show_packet = Pref.b
126126
omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.show_packet_header = Pref.bool("Show Packet Header", show.packet_header, "Parse and add Packet Header to protocol tree")
127127
omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.show_message_index = Pref.bool("Show Message Index", show.message_index, "Show generated message index in protocol tree")
128128

129+
-- Time Offset Display Preferences
130+
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.time_offset_format = 2 -- 0=Raw, 1=TimeOfDay, 2=FullDateTime
131+
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.utc_offset_hours = 5 -- Hours behind UTC (EST = 5, EDT = 4, UTC = 0)
132+
133+
local time_offset_format_enum = {
134+
{ 1, "Raw", 0 },
135+
{ 2, "Time of Day", 1 },
136+
{ 3, "Full DateTime", 2 }
137+
}
138+
139+
omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.time_offset_format = Pref.enum("Time Offset Format", 2, "Time Offset display format", time_offset_format_enum, false)
140+
omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC for midnight calculation (EST=5, EDT=4, UTC=0)")
141+
129142
-- Handle changed preferences
130143
function omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs_changed()
131144

@@ -154,6 +167,14 @@ function omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs_changed()
154167
if show.message_index ~= omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.show_message_index then
155168
show.message_index = omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.show_message_index
156169
end
170+
171+
-- Check Time Offset preferences
172+
if cboe_c1options_multicastdepthofbook_pitch_v2_39_4.time_offset_format ~= omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.time_offset_format then
173+
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.time_offset_format = omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.time_offset_format
174+
end
175+
if cboe_c1options_multicastdepthofbook_pitch_v2_39_4.utc_offset_hours ~= omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.utc_offset_hours then
176+
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.utc_offset_hours = omi_cboe_c1options_multicastdepthofbook_pitch_v2_39_4.prefs.utc_offset_hours
177+
end
157178
end
158179

159180

@@ -1405,12 +1426,28 @@ cboe_c1options_multicastdepthofbook_pitch_v2_39_4.timestamp = {}
14051426

14061427
-- Translate: Timestamp
14071428
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.timestamp.translate = function(time_offset, stored_time)
1408-
return UInt64.new(stored_midnightreference + stored_time * 1000000000 + time_offset)
1429+
return UInt64.new(stored_time * 1000000000 + time_offset)
14091430
end
14101431

14111432
-- Display: Timestamp
1412-
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.timestamp.display = function(time_offset, stored_time)
1413-
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_time)..string.format("%09d", time_offset)
1433+
cboe_c1options_multicastdepthofbook_pitch_v2_39_4.timestamp.display = function(time_offset, stored_time, packet)
1434+
-- Raw display mode
1435+
if cboe_c1options_multicastdepthofbook_pitch_v2_39_4.time_offset_format == 0 then
1436+
return "Timestamp: "..(stored_time * 1000000000 + time_offset)
1437+
end
1438+
1439+
-- Full datetime mode (calculate from capture date + UTC offset)
1440+
if cboe_c1options_multicastdepthofbook_pitch_v2_39_4.time_offset_format == 2 and packet then
1441+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
1442+
local utc_offset_seconds = cboe_c1options_multicastdepthofbook_pitch_v2_39_4.utc_offset_hours * 3600
1443+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
1444+
local full_seconds = local_midnight + stored_time
1445+
1446+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", full_seconds)..string.format("%09d", time_offset)
1447+
end
1448+
1449+
-- Time of day mode
1450+
return "Timestamp: "..os.date("%H:%M:%S.", stored_time)..string.format("%09d", time_offset)
14141451
end
14151452

14161453
-- Composite: Timestamp

Cboe/Cboe_C1Options_MulticastDepthOfBook_Pitch_v2_41_29_Dissector.lua

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,25 +1887,25 @@ end
18871887
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp = {}
18881888

18891889
-- Translate: Timestamp
1890-
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.translate = function(time_offset, stored_midnight_reference)
1890+
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.translate = function(time_offset, stored_midnight_reference, stored_time)
18911891
return UInt64.new(stored_midnight_reference + stored_time * 1000000000 + time_offset)
18921892
end
18931893

18941894
-- Display: Timestamp
1895-
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.display = function(time_offset, stored_midnight_reference)
1896-
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_midnight_reference)..string.format("%09d", time_offset)
1895+
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.display = function(time_offset, stored_midnight_reference, stored_time)
1896+
return "Timestamp: "..os.date("%Y-%m-%d %H:%M:%S.", stored_midnight_reference + stored_time)..string.format("%09d", time_offset)
18971897
end
18981898

18991899
-- Composite: Timestamp
1900-
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.composite = function(buffer, offset, stored_midnight_reference, packet, parent)
1900+
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.composite = function(buffer, offset, stored_midnight_reference, stored_time, packet, parent)
19011901
local length = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.time_offset.size
19021902
local range = buffer(offset, length)
19031903
local time_offset = range:le_uint()
1904-
local value = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.translate(time_offset, stored_midnight_reference)
1905-
local display = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.display(time_offset, stored_midnight_reference)
1904+
local value = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.translate(time_offset, stored_midnight_reference, stored_time)
1905+
local display = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.display(time_offset, stored_midnight_reference, stored_time)
19061906
parent = parent:add(omi_cboe_c1options_multicastdepthofbook_pitch_v2_41_29.fields.timestamp, range, value, display)
19071907

1908-
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.midnight_reference.generated(stored_midnight_reference, range, packet, parent)
1908+
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.time.generated(stored_time, range, packet, parent)
19091909

19101910
display = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.time_offset.display(time_offset)
19111911
parent:add(omi_cboe_c1options_multicastdepthofbook_pitch_v2_41_29.fields.time_offset, range, time_offset, display)
@@ -1916,9 +1916,10 @@ end
19161916
-- Dissect: Timestamp
19171917
cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.dissect = function(buffer, offset, packet, parent)
19181918
local stored_midnight_reference = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.midnight_reference.current
1919+
local stored_time = cboe_c1options_multicastdepthofbook_pitch_v2_41_29.time.current
19191920

1920-
if stored_midnight_reference ~= nil then
1921-
return cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.composite(buffer, offset, stored_midnight_reference, packet, parent)
1921+
if stored_midnight_reference ~= nil and stored_time ~= nil then
1922+
return cboe_c1options_multicastdepthofbook_pitch_v2_41_29.timestamp.composite(buffer, offset, stored_midnight_reference, stored_time, packet, parent)
19221923
end
19231924

19241925
return cboe_c1options_multicastdepthofbook_pitch_v2_41_29.time_offset.dissect(buffer, offset, packet, parent)

0 commit comments

Comments
 (0)