tdbe 0.14.0

ThetaData Binary Encoding -- market data types, FIT/FIE codecs, Black-Scholes Greeks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
// @generated DO NOT EDIT -- regenerated by
// `cargo run -p thetadatadx --bin generate_sdk_surfaces`
// from `crates/thetadatadx/tick_schema.toml`.
//
// Per-tick `#[repr(C, align(N))]` struct definitions. The
// hand-written `tick.rs` `pub use`s every type from this file,
// adds the `impl_contract_id!` macro applications + custom
// `Display` / `OptionContract` impls, then re-exports through
// `tdbe::types::tick`.

/// Calendar day -- 5 fields. Market open/close schedule.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct CalendarDay {
    pub date: i32,
    pub is_open: i32,
    pub open_time: i32,
    pub close_time: i32,
    pub status: i32,
}

/// End-of-day tick -- 17 fields. Full EOD snapshot with OHLC + quote.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct EodTick {
    pub ms_of_day: i32,
    pub ms_of_day2: i32,
    pub open: f64,
    pub high: f64,
    pub low: f64,
    pub close: f64,
    pub volume: i64,
    pub count: i64,
    pub bid_size: i32,
    pub bid_exchange: i32,
    pub bid: f64,
    pub bid_condition: i32,
    pub ask_size: i32,
    pub ask_exchange: i32,
    pub ask: f64,
    pub ask_condition: i32,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Full union Greeks tick -- every Greek the v3 server publishes on the
/// `option_*_greeks_all` and `option_*_greeks_eod` endpoints.
///
/// The vendor's per-order endpoints (`option_*_greeks_first_order`,
/// `_second_order`, `_third_order`) emit strict subsets of these columns
/// and bind to `GreeksFirstOrderTick`, `GreeksSecondOrderTick`,
/// `GreeksThirdOrderTick` respectively. `option_*_greeks_implied_volatility`
/// binds to `IvTick`.
///
/// The wire-level `timestamp` -> `ms_of_day`, `underlying_timestamp` ->
/// `underlying_ms_of_day`, and `implied_vol` -> `implied_volatility`
/// mappings are applied through `HEADER_ALIASES` in
/// `crates/thetadatadx/src/decode.rs`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct GreeksAllTick {
    pub ms_of_day: i32,
    pub bid: f64,
    pub ask: f64,
    pub implied_volatility: f64,
    pub delta: f64,
    pub gamma: f64,
    pub theta: f64,
    pub vega: f64,
    pub rho: f64,
    pub iv_error: f64,
    pub vanna: f64,
    pub charm: f64,
    pub vomma: f64,
    pub veta: f64,
    pub speed: f64,
    pub zomma: f64,
    pub color: f64,
    pub ultima: f64,
    pub d1: f64,
    pub d2: f64,
    pub dual_delta: f64,
    pub dual_gamma: f64,
    pub epsilon: f64,
    pub lambda: f64,
    pub vera: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// End-of-day union Greeks tick -- every Greek the v3 server publishes on
/// `option_history_greeks_eod`, paired with the twelve EOD trade/quote
/// context columns (`open`, `high`, `low`, `close`, `volume`, `count`,
/// `bid_size`, `bid_exchange`, `bid_condition`, `ask_size`,
/// `ask_exchange`, `ask_condition`) that identify the daily bar + closing
/// NBBO snapshot the Greeks were calculated against.
///
/// The bare `GreeksAllTick` previously routed by `endpoint_surface.toml`
/// (28 fields) silently dropped those twelve EOD columns from the
/// 39-column EOD response -- the same data-loss class as the per-trade
/// Greeks endpoints. `GreeksEodTick` carries the full
/// EOD wire shape end-to-end across every binding.
///
/// Wire layout verified-live against terminal jar build `202605221`
/// (SPY 2024-06-21 expiration query on 2024-06-14):
///
///   symbol, expiration, strike, right,
///   timestamp, open, high, low, close, volume, count,
///   bid_size, bid_exchange, bid, bid_condition,
///   ask_size, ask_exchange, ask, ask_condition,
///   delta, theta, vega, rho, epsilon, lambda,
///   gamma, vanna, charm, vomma, veta, vera,
///   speed, zomma, color, ultima,
///   d1, d2, dual_delta, dual_gamma,
///   implied_vol, iv_error,
///   underlying_timestamp, underlying_price
///
/// The `timestamp` -> `ms_of_day`, `underlying_timestamp` ->
/// `underlying_ms_of_day`, and `implied_vol` -> `implied_volatility`
/// mappings are applied through `HEADER_ALIASES`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct GreeksEodTick {
    pub ms_of_day: i32,
    pub open: f64,
    pub high: f64,
    pub low: f64,
    pub close: f64,
    pub volume: i64,
    pub count: i64,
    pub bid_size: i32,
    pub bid_exchange: i32,
    pub bid: f64,
    pub bid_condition: i32,
    pub ask_size: i32,
    pub ask_exchange: i32,
    pub ask: f64,
    pub ask_condition: i32,
    pub delta: f64,
    pub theta: f64,
    pub vega: f64,
    pub rho: f64,
    pub epsilon: f64,
    pub lambda: f64,
    pub gamma: f64,
    pub vanna: f64,
    pub charm: f64,
    pub vomma: f64,
    pub veta: f64,
    pub vera: f64,
    pub speed: f64,
    pub zomma: f64,
    pub color: f64,
    pub ultima: f64,
    pub d1: f64,
    pub d2: f64,
    pub dual_delta: f64,
    pub dual_gamma: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// First-order Greeks tick -- the strict column subset emitted by the
/// vendor's `option_*_greeks_first_order` endpoints (delta / theta / vega
/// / rho / epsilon / lambda) plus the bid/ask quote pair, the IV pair, and
/// the underlying snapshot used to derive each Greek.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct GreeksFirstOrderTick {
    pub ms_of_day: i32,
    pub bid: f64,
    pub ask: f64,
    pub delta: f64,
    pub theta: f64,
    pub vega: f64,
    pub rho: f64,
    pub epsilon: f64,
    pub lambda: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Second-order Greeks tick -- the strict column subset emitted by the
/// vendor's `option_*_greeks_second_order` endpoints (gamma / vanna /
/// charm / vomma / veta) plus the bid/ask quote pair, the IV pair, and the
/// underlying snapshot.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct GreeksSecondOrderTick {
    pub ms_of_day: i32,
    pub bid: f64,
    pub ask: f64,
    pub gamma: f64,
    pub vanna: f64,
    pub charm: f64,
    pub vomma: f64,
    pub veta: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Third-order Greeks tick -- the strict column subset emitted by the
/// vendor's `option_*_greeks_third_order` endpoints (speed / zomma /
/// color / ultima) plus the bid/ask quote pair, the IV pair, and the
/// underlying snapshot. The vendor's third-order schema does not publish
/// `vera`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct GreeksThirdOrderTick {
    pub ms_of_day: i32,
    pub bid: f64,
    pub ask: f64,
    pub speed: f64,
    pub zomma: f64,
    pub color: f64,
    pub ultima: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Index price-at-time tick -- the trade-shaped row the v3 server
/// publishes on `index_at_time_price`. The bare `PriceTick` (3 fields:
/// `ms_of_day`, `price`, `date`) silently dropped seven server-emitted
/// columns -- `sequence`, `ext_condition1..4`, `condition`, `size`,
/// `exchange` -- including the SIP-exchange attribution field.
///
/// Wire layout verified-live against terminal jar build `202605221`:
///
///   timestamp, sequence, ext_condition1..4, condition, size, exchange, price
///
/// The `timestamp` -> `ms_of_day` and `timestamp` -> `date` mappings are
/// applied through the existing `HEADER_ALIASES` rows in
/// `crates/thetadatadx/src/mdds/decode/headers.rs`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct IndexPriceAtTimeTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub date: i32,
}

/// Interest rate tick -- 2 fields. End-of-day interest rate (percent).
///
/// Wire layout per `docs.thetadata.us/operations/interest_rate_history_eod.html`
/// and verified-live against terminal jar build `202605221`:
///
/// | Schema field | Wire header | Wire type        | Mapping                    |
/// |--------------|-------------|------------------|----------------------------|
/// | `date`       | `created`   | Text (ISO date)  | `"2025-04-28"` -> 20250428 |
/// | `rate`       | `rate`      | Number (percent) | `4.3600` -> 4.36           |
///
/// The `date` decode flows through `thetadatadx::decode::row_date`, which
/// accepts `Number`, `Timestamp`, and `Text` cells uniformly — so this tick
/// decodes either the documented Text-ISO shape or any future
/// Number/Timestamp narrowing without a per-parser branch.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct InterestRateTick {
    pub date: i32,
    pub rate: f64,
}

/// Implied volatility tick -- 11 fields.
///
/// Wire layout verified-live against `option_history_greeks_implied_volatility`
/// (terminal jar build `202605221`):
///
/// | Schema field                | Wire header               | Type   |
/// |-----------------------------|---------------------------|--------|
/// | `ms_of_day`                 | `timestamp`               | i32    |
/// | `bid`                       | `bid`                     | price  |
/// | `bid_implied_volatility`    | `bid_implied_vol`         | f64    |
/// | `midpoint`                  | `midpoint`                | price  |
/// | `implied_volatility`        | `implied_vol`             | f64    |
/// | `ask`                       | `ask`                     | price  |
/// | `ask_implied_volatility`    | `ask_implied_vol`         | f64    |
/// | `iv_error`                  | `iv_error`                | f64    |
/// | `underlying_ms_of_day`      | `underlying_timestamp`    | i32    |
/// | `underlying_price`          | `underlying_price`        | price  |
/// | `date`                      | `timestamp`               | i32    |
///
/// The snapshot variant (`option_snapshot_greeks_implied_volatility`) emits
/// a 4-column subset (`ms_of_day, implied_vol, iv_error, date`); the
/// generator's optional-column path defaults the missing fields to 0.0 so
/// the snapshot decode keeps working.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct IvTick {
    pub ms_of_day: i32,
    pub bid: f64,
    pub bid_implied_volatility: f64,
    pub midpoint: f64,
    pub implied_volatility: f64,
    pub ask: f64,
    pub ask_implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Market value tick -- quoted bid/ask/price for a symbol.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct MarketValueTick {
    pub ms_of_day: i32,
    pub market_bid: f64,
    pub market_ask: f64,
    pub market_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// OHLC tick -- 9 fields. Aggregated bar data including SIP-rule VWAP.
///
/// Wire layout verified-live (terminal jar build `202605221`) against
/// `stock_history_ohlc`, `option_history_ohlc`, and `index_history_ohlc`,
/// which emit the same 8 data columns (`timestamp,open,high,low,close,
/// volume,count,vwap`). The snapshot variants (`*_snapshot_ohlc`) omit
/// `vwap`; the generated parser's optional-column path defaults the
/// field to `0.0` for those endpoints, mirroring how `volume`/`count`
/// already zero-default on quote-only intraday bars.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct OhlcTick {
    pub ms_of_day: i32,
    pub open: f64,
    pub high: f64,
    pub low: f64,
    pub close: f64,
    pub volume: i64,
    pub count: i64,
    pub vwap: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Open interest tick -- 3 fields.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct OpenInterestTick {
    pub ms_of_day: i32,
    pub open_interest: i32,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Option contract -- 4 fields. Contract specification.
///
/// Cannot be `Copy` because of the `String` symbol field.
#[must_use]
#[derive(Debug, Clone)]
#[repr(C)]
pub struct OptionContract {
    pub symbol: String,
    pub expiration: i32,
    pub strike: f64,
    pub right: i32,
}

/// Price tick -- 3 fields. Generic price data point.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct PriceTick {
    pub ms_of_day: i32,
    pub price: f64,
    pub date: i32,
}

/// Quote tick -- 10 fields + midpoint. NBBO quote data.
///
/// Wire layout: the full shape is 11 columns (`ms_of_day`,
/// `bid_size`, `bid_exchange`, `bid`, `bid_condition`, `ask_size`,
/// `ask_exchange`, `ask`, `ask_condition`, `price_type`, `date`).
/// The four exchange / condition columns are NOT in the `required` list
/// below so the generator emits `opt_number(row, None) -> 0` arms for
/// them; this lets the decoder accept subset NBBO layouts (e.g. the
/// 6-field `[ms_of_day, bid_size, bid, ask_size, ask, date]` shape some
/// storage tiers emit) without erroring, while still decoding the full
/// 11-field shape bit-exact when every column is present.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct QuoteTick {
    pub ms_of_day: i32,
    pub bid_size: i32,
    pub bid_exchange: i32,
    pub bid: f64,
    pub bid_condition: i32,
    pub ask_size: i32,
    pub ask_exchange: i32,
    pub ask: f64,
    pub ask_condition: i32,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
    /// Pre-computed midpoint: `(bid + ask) / 2.0`.
    pub midpoint: f64,
}

/// Per-trade union Greeks tick -- every Greek the v3 server publishes on
/// `option_history_trade_greeks_all`, paired with the trade-side execution
/// columns (`sequence`, `ext_condition1..4`, `condition`, `size`,
/// `exchange`, `price`) that identify which OPRA print each Greek was
/// calculated against.
///
/// Wire layout verified-live against terminal jar build `202605221`:
///
///   symbol, expiration, strike, right,
///   timestamp, sequence, ext_condition1..4, condition, size, exchange, price,
///   delta, theta, vega, rho, epsilon, lambda,
///   gamma, vanna, charm, vomma, veta, vera,
///   speed, zomma, color, ultima,
///   d1, d2, dual_delta, dual_gamma,
///   implied_vol, iv_error,
///   underlying_timestamp, underlying_price
///
/// The `timestamp` -> `ms_of_day`, `underlying_timestamp` ->
/// `underlying_ms_of_day`, and `implied_vol` -> `implied_volatility`
/// mappings are applied through `HEADER_ALIASES`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeGreeksAllTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub delta: f64,
    pub theta: f64,
    pub vega: f64,
    pub rho: f64,
    pub epsilon: f64,
    pub lambda: f64,
    pub gamma: f64,
    pub vanna: f64,
    pub charm: f64,
    pub vomma: f64,
    pub veta: f64,
    pub vera: f64,
    pub speed: f64,
    pub zomma: f64,
    pub color: f64,
    pub ultima: f64,
    pub d1: f64,
    pub d2: f64,
    pub dual_delta: f64,
    pub dual_gamma: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Per-trade first-order Greeks tick (delta / theta / vega / rho / epsilon
/// / lambda) paired with the trade-side execution columns identifying the
/// OPRA print each Greek was calculated against. Wire layout verified-live
/// against terminal jar build `202605221`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeGreeksFirstOrderTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub delta: f64,
    pub theta: f64,
    pub vega: f64,
    pub rho: f64,
    pub epsilon: f64,
    pub lambda: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Per-trade implied-volatility tick (single `implied_volatility` +
/// `iv_error` pair, NOT the bid/mid/ask IV triple of the interval-sampled
/// `IvTick`) paired with the trade-side execution columns identifying the
/// OPRA print the IV was calculated against. Wire layout verified-live
/// against terminal jar build `202605221`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeGreeksImpliedVolatilityTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Per-trade second-order Greeks tick (gamma / vanna / charm / vomma /
/// veta) paired with the trade-side execution columns identifying the OPRA
/// print each Greek was calculated against. Wire layout verified-live
/// against terminal jar build `202605221`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeGreeksSecondOrderTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub gamma: f64,
    pub vanna: f64,
    pub charm: f64,
    pub vomma: f64,
    pub veta: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Per-trade third-order Greeks tick (speed / zomma / color / ultima)
/// paired with the trade-side execution columns identifying the OPRA print
/// each Greek was calculated against. The vendor's third-order schema does
/// not publish `vera`. Wire layout verified-live against terminal jar build
/// `202605221`.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeGreeksThirdOrderTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub speed: f64,
    pub zomma: f64,
    pub color: f64,
    pub ultima: f64,
    pub implied_volatility: f64,
    pub iv_error: f64,
    pub underlying_ms_of_day: i32,
    pub underlying_price: f64,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Combined trade + quote tick -- 24 fields.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeQuoteTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub condition_flags: i32,
    pub price_flags: i32,
    pub volume_type: i32,
    pub records_back: i32,
    pub quote_ms_of_day: i32,
    pub bid_size: i32,
    pub bid_exchange: i32,
    pub bid: f64,
    pub bid_condition: i32,
    pub ask_size: i32,
    pub ask_exchange: i32,
    pub ask: f64,
    pub ask_condition: i32,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}

/// Trade tick -- 15 fields. Core unit of trade data.
#[must_use]
#[derive(Debug, Clone, Copy)]
#[repr(C, align(64))]
pub struct TradeTick {
    pub ms_of_day: i32,
    pub sequence: i32,
    pub ext_condition1: i32,
    pub ext_condition2: i32,
    pub ext_condition3: i32,
    pub ext_condition4: i32,
    pub condition: i32,
    pub size: i32,
    pub exchange: i32,
    pub price: f64,
    pub condition_flags: i32,
    pub price_flags: i32,
    pub volume_type: i32,
    pub records_back: i32,
    pub date: i32,
    /// Contract expiration (`YYYYMMDD`). Populated on wildcard queries, 0 otherwise.
    pub expiration: i32,
    /// Contract strike price (decoded to `f64`).
    pub strike: f64,
    /// Contract right (`'C'` = 67, `'P'` = 80 ASCII). 0 on single-contract queries.
    pub right: i32,
}