Skip to content

Commit c659f42

Browse files
Add timestamps to cboe europe specs
1 parent bf057c0 commit c659f42

6 files changed

Lines changed: 248 additions & 25 deletions

Cboe/Cboe_BxeEquities_AuctionFeed_AsciiPitch_v1_4_Dissector.lua

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.fields.username = ProtoField.ne
5050
omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.fields.auction_summary_message = ProtoField.new("Auction Summary Message", "cboe.bxeequities.auctionfeed.asciipitch.v1.4.auctionsummarymessage", ftypes.STRING)
5151
omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.fields.auction_update_message = ProtoField.new("Auction Update Message", "cboe.bxeequities.auctionfeed.asciipitch.v1.4.auctionupdatemessage", ftypes.STRING)
5252

53+
-----------------------------------------------------------------------
54+
-- Cboe BxeEquities AuctionFeed AsciiPitch 1.4 Formatting
55+
-----------------------------------------------------------------------
56+
57+
-- timestamp format
58+
local timestamp_format_enum = {
59+
{ 1, "Raw", 0 },
60+
{ 2, "Time of Day", 1 },
61+
{ 3, "Full DateTime", 2 }
62+
}
63+
64+
-- 0=Raw, 1=TimeOfDay, 2=FullDateTime
65+
cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp_format = 2
66+
67+
-- Hours behind UTC (EST) for midnight calculation
68+
cboe_bxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours = 5
69+
70+
5371
-----------------------------------------------------------------------
5472
-- Declare Dissection Options
5573
-----------------------------------------------------------------------
@@ -78,6 +96,8 @@ omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.show_sequenced_data_packe
7896
omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.show_sequenced_message_header = Pref.bool("Show Sequenced Message Header", show.sequenced_message_header, "Parse and add Sequenced Message Header to protocol tree")
7997
omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.show_unsequenced_data_packet = Pref.bool("Show Unsequenced Data Packet", show.unsequenced_data_packet, "Parse and add Unsequenced Data Packet to protocol tree")
8098

99+
omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.timestamp_format = Pref.enum("Timestamp Format", 2, "Timestamp display format", timestamp_format_enum, false)
100+
omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC (EST) for midnight calculation")
81101

82102
-- Handle changed preferences
83103
function omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs_changed()
@@ -110,6 +130,12 @@ function omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs_changed()
110130
if show.unsequenced_data_packet ~= omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.show_unsequenced_data_packet then
111131
show.unsequenced_data_packet = omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.show_unsequenced_data_packet
112132
end
133+
if cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp_format ~= omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.timestamp_format then
134+
cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp_format = omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.timestamp_format
135+
end
136+
if cboe_bxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours ~= omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.utc_offset_hours then
137+
cboe_bxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours = omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.prefs.utc_offset_hours
138+
end
113139
end
114140

115141

@@ -643,15 +669,44 @@ cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp = {}
643669
cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp.size = 8
644670

645671
-- Display: Timestamp
646-
cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp.display = function(value)
647-
return "Timestamp: "..value
672+
cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp.display = function(value, buffer, offset, packet, parent)
673+
-- Raw display mode (or unparsable ASCII fell back to a non-number)
674+
if type(value) ~= "number" then
675+
return "Timestamp: "..tostring(value)
676+
end
677+
678+
if cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp_format == 0 then
679+
return "Timestamp: "..value
680+
end
681+
682+
-- Parse milliseconds since midnight
683+
local seconds = math.floor(value / 1000)
684+
local milliseconds = value % 1000
685+
686+
-- Full datetime mode (calculate from capture date + UTC offset)
687+
if cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp_format == 2 and packet then
688+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
689+
local utc_offset_seconds = cboe_bxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours * 3600
690+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
691+
local full_seconds = local_midnight + seconds
692+
693+
return "Timestamp: "..os.date("!%Y-%m-%d %H:%M:%S.", full_seconds + utc_offset_seconds)..string.format("%03d", milliseconds)
694+
end
695+
696+
-- Time of day mode
697+
return "Timestamp: "..os.date("!%H:%M:%S.", seconds)..string.format("%03d", milliseconds)
648698
end
649699

650700
-- Dissect: Timestamp
651701
cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp.dissect = function(buffer, offset, packet, parent)
652702
local length = cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp.size
653703
local range = buffer(offset, length)
654-
local value = range:string()
704+
local value = tonumber(range:string())
705+
706+
if value == nil then
707+
value = "Not Applicable"
708+
end
709+
655710
local display = cboe_bxeequities_auctionfeed_asciipitch_v1_4.timestamp.display(value, buffer, offset, packet, parent)
656711

657712
parent:add(omi_cboe_bxeequities_auctionfeed_asciipitch_v1_4.fields.timestamp, range, value, display)

Cboe/Cboe_BxeEquities_TcpDepthOfBook_AsciiPitch_v4_34_Dissector.lua

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.fields.trade_message_long_f
9292
omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.fields.trade_message_unknown_symbol = ProtoField.new("Trade Message Unknown Symbol", "cboe.bxeequities.tcpdepthofbook.asciipitch.v4.34.trademessageunknownsymbol", ftypes.STRING)
9393
omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.fields.trading_status_message = ProtoField.new("Trading Status Message", "cboe.bxeequities.tcpdepthofbook.asciipitch.v4.34.tradingstatusmessage", ftypes.STRING)
9494

95+
-----------------------------------------------------------------------
96+
-- Cboe BxeEquities TcpDepthOfBook AsciiPitch 4.34 Formatting
97+
-----------------------------------------------------------------------
98+
99+
-- timestamp format
100+
local timestamp_format_enum = {
101+
{ 1, "Raw", 0 },
102+
{ 2, "Time of Day", 1 },
103+
{ 3, "Full DateTime", 2 }
104+
}
105+
106+
-- 0=Raw, 1=TimeOfDay, 2=FullDateTime
107+
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp_format = 2
108+
109+
-- Hours behind UTC (EST) for midnight calculation
110+
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.utc_offset_hours = 5
111+
112+
95113
-----------------------------------------------------------------------
96114
-- Declare Dissection Options
97115
-----------------------------------------------------------------------
@@ -120,6 +138,8 @@ omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.show_sequenced_data_p
120138
omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.show_sequenced_message_header = Pref.bool("Show Sequenced Message Header", show.sequenced_message_header, "Parse and add Sequenced Message Header to protocol tree")
121139
omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.show_unsequenced_data_packet = Pref.bool("Show Unsequenced Data Packet", show.unsequenced_data_packet, "Parse and add Unsequenced Data Packet to protocol tree")
122140

141+
omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.timestamp_format = Pref.enum("Timestamp Format", 2, "Timestamp display format", timestamp_format_enum, false)
142+
omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC (EST) for midnight calculation")
123143

124144
-- Handle changed preferences
125145
function omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs_changed()
@@ -152,6 +172,12 @@ function omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs_changed()
152172
if show.unsequenced_data_packet ~= omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.show_unsequenced_data_packet then
153173
show.unsequenced_data_packet = omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.show_unsequenced_data_packet
154174
end
175+
if cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp_format ~= omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.timestamp_format then
176+
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp_format = omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.timestamp_format
177+
end
178+
if cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.utc_offset_hours ~= omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.utc_offset_hours then
179+
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.utc_offset_hours = omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.prefs.utc_offset_hours
180+
end
155181
end
156182

157183

@@ -1334,15 +1360,44 @@ cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp = {}
13341360
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp.size = 11
13351361

13361362
-- Display: Timestamp
1337-
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp.display = function(value)
1338-
return "Timestamp: "..value
1363+
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp.display = function(value, buffer, offset, packet, parent)
1364+
-- Raw display mode (or unparsable ASCII fell back to a non-number)
1365+
if type(value) ~= "number" then
1366+
return "Timestamp: "..tostring(value)
1367+
end
1368+
1369+
if cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp_format == 0 then
1370+
return "Timestamp: "..value
1371+
end
1372+
1373+
-- Parse microseconds since midnight
1374+
local seconds = math.floor(value / 1000000)
1375+
local microseconds = value % 1000000
1376+
1377+
-- Full datetime mode (calculate from capture date + UTC offset)
1378+
if cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp_format == 2 and packet then
1379+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
1380+
local utc_offset_seconds = cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.utc_offset_hours * 3600
1381+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
1382+
local full_seconds = local_midnight + seconds
1383+
1384+
return "Timestamp: "..os.date("!%Y-%m-%d %H:%M:%S.", full_seconds + utc_offset_seconds)..string.format("%06d", microseconds)
1385+
end
1386+
1387+
-- Time of day mode
1388+
return "Timestamp: "..os.date("!%H:%M:%S.", seconds)..string.format("%06d", microseconds)
13391389
end
13401390

13411391
-- Dissect: Timestamp
13421392
cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp.dissect = function(buffer, offset, packet, parent)
13431393
local length = cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp.size
13441394
local range = buffer(offset, length)
1345-
local value = range:string()
1395+
local value = tonumber(range:string())
1396+
1397+
if value == nil then
1398+
value = "Not Applicable"
1399+
end
1400+
13461401
local display = cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.timestamp.display(value, buffer, offset, packet, parent)
13471402

13481403
parent:add(omi_cboe_bxeequities_tcpdepthofbook_asciipitch_v4_34.fields.timestamp, range, value, display)

Cboe/Cboe_CxeEquities_AuctionFeed_AsciiPitch_v1_4_Dissector.lua

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.fields.username = ProtoField.ne
5050
omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.fields.auction_summary_message = ProtoField.new("Auction Summary Message", "cboe.cxeequities.auctionfeed.asciipitch.v1.4.auctionsummarymessage", ftypes.STRING)
5151
omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.fields.auction_update_message = ProtoField.new("Auction Update Message", "cboe.cxeequities.auctionfeed.asciipitch.v1.4.auctionupdatemessage", ftypes.STRING)
5252

53+
-----------------------------------------------------------------------
54+
-- Cboe CxeEquities AuctionFeed AsciiPitch 1.4 Formatting
55+
-----------------------------------------------------------------------
56+
57+
-- timestamp format
58+
local timestamp_format_enum = {
59+
{ 1, "Raw", 0 },
60+
{ 2, "Time of Day", 1 },
61+
{ 3, "Full DateTime", 2 }
62+
}
63+
64+
-- 0=Raw, 1=TimeOfDay, 2=FullDateTime
65+
cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp_format = 2
66+
67+
-- Hours behind UTC (EST) for midnight calculation
68+
cboe_cxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours = 5
69+
70+
5371
-----------------------------------------------------------------------
5472
-- Declare Dissection Options
5573
-----------------------------------------------------------------------
@@ -78,6 +96,8 @@ omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.show_sequenced_data_packe
7896
omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.show_sequenced_message_header = Pref.bool("Show Sequenced Message Header", show.sequenced_message_header, "Parse and add Sequenced Message Header to protocol tree")
7997
omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.show_unsequenced_data_packet = Pref.bool("Show Unsequenced Data Packet", show.unsequenced_data_packet, "Parse and add Unsequenced Data Packet to protocol tree")
8098

99+
omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.timestamp_format = Pref.enum("Timestamp Format", 2, "Timestamp display format", timestamp_format_enum, false)
100+
omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.utc_offset_hours = Pref.uint("UTC Offset (hours)", 5, "Hours behind UTC (EST) for midnight calculation")
81101

82102
-- Handle changed preferences
83103
function omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs_changed()
@@ -110,6 +130,12 @@ function omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs_changed()
110130
if show.unsequenced_data_packet ~= omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.show_unsequenced_data_packet then
111131
show.unsequenced_data_packet = omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.show_unsequenced_data_packet
112132
end
133+
if cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp_format ~= omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.timestamp_format then
134+
cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp_format = omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.timestamp_format
135+
end
136+
if cboe_cxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours ~= omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.utc_offset_hours then
137+
cboe_cxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours = omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.prefs.utc_offset_hours
138+
end
113139
end
114140

115141

@@ -643,15 +669,44 @@ cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp = {}
643669
cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp.size = 8
644670

645671
-- Display: Timestamp
646-
cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp.display = function(value)
647-
return "Timestamp: "..value
672+
cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp.display = function(value, buffer, offset, packet, parent)
673+
-- Raw display mode (or unparsable ASCII fell back to a non-number)
674+
if type(value) ~= "number" then
675+
return "Timestamp: "..tostring(value)
676+
end
677+
678+
if cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp_format == 0 then
679+
return "Timestamp: "..value
680+
end
681+
682+
-- Parse milliseconds since midnight
683+
local seconds = math.floor(value / 1000)
684+
local milliseconds = value % 1000
685+
686+
-- Full datetime mode (calculate from capture date + UTC offset)
687+
if cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp_format == 2 and packet then
688+
local capture_time = type(packet.abs_ts) == "number" and packet.abs_ts or packet.abs_ts:tonumber()
689+
local utc_offset_seconds = cboe_cxeequities_auctionfeed_asciipitch_v1_4.utc_offset_hours * 3600
690+
local local_midnight = math.floor((capture_time - utc_offset_seconds) / 86400) * 86400 + utc_offset_seconds
691+
local full_seconds = local_midnight + seconds
692+
693+
return "Timestamp: "..os.date("!%Y-%m-%d %H:%M:%S.", full_seconds + utc_offset_seconds)..string.format("%03d", milliseconds)
694+
end
695+
696+
-- Time of day mode
697+
return "Timestamp: "..os.date("!%H:%M:%S.", seconds)..string.format("%03d", milliseconds)
648698
end
649699

650700
-- Dissect: Timestamp
651701
cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp.dissect = function(buffer, offset, packet, parent)
652702
local length = cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp.size
653703
local range = buffer(offset, length)
654-
local value = range:string()
704+
local value = tonumber(range:string())
705+
706+
if value == nil then
707+
value = "Not Applicable"
708+
end
709+
655710
local display = cboe_cxeequities_auctionfeed_asciipitch_v1_4.timestamp.display(value, buffer, offset, packet, parent)
656711

657712
parent:add(omi_cboe_cxeequities_auctionfeed_asciipitch_v1_4.fields.timestamp, range, value, display)

0 commit comments

Comments
 (0)