nautilus_model/
enums.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Enumerations for the trading domain model.
17
18use std::{str::FromStr, sync::OnceLock};
19
20use ahash::AHashSet;
21use serde::{Deserialize, Deserializer, Serialize, Serializer};
22use strum::{AsRefStr, Display, EnumIter, EnumString, FromRepr};
23
24use crate::enum_strum_serde;
25
26/// Provides conversion from a `u8` value to an enum type.
27pub trait FromU8 {
28    /// Converts a `u8` value to the implementing type.
29    ///
30    /// Returns `None` if the value is not a valid representation.
31    fn from_u8(value: u8) -> Option<Self>
32    where
33        Self: Sized;
34}
35
36/// Provides conversion from a `u16` value to an enum type.
37pub trait FromU16 {
38    /// Converts a `u16` value to the implementing type.
39    ///
40    /// Returns `None` if the value is not a valid representation.
41    fn from_u16(value: u16) -> Option<Self>
42    where
43        Self: Sized;
44}
45
46/// An account type provided by a trading venue or broker.
47#[repr(C)]
48#[derive(
49    Copy,
50    Clone,
51    Debug,
52    Display,
53    Hash,
54    PartialEq,
55    Eq,
56    PartialOrd,
57    Ord,
58    AsRefStr,
59    FromRepr,
60    EnumIter,
61    EnumString,
62)]
63#[strum(ascii_case_insensitive)]
64#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
65#[cfg_attr(
66    feature = "python",
67    pyo3::pyclass(
68        frozen,
69        eq,
70        eq_int,
71        hash,
72        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
73    )
74)]
75pub enum AccountType {
76    /// An account with unleveraged cash assets only.
77    Cash = 1,
78    /// An account which facilitates trading on margin, using account assets as collateral.
79    Margin = 2,
80    /// An account specific to betting markets.
81    Betting = 3,
82}
83
84/// An aggregation source for derived data.
85#[repr(C)]
86#[derive(
87    Copy,
88    Clone,
89    Debug,
90    Display,
91    Hash,
92    PartialEq,
93    Eq,
94    PartialOrd,
95    Ord,
96    AsRefStr,
97    FromRepr,
98    EnumIter,
99    EnumString,
100)]
101#[strum(ascii_case_insensitive)]
102#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
103#[cfg_attr(
104    feature = "python",
105    pyo3::pyclass(
106        frozen,
107        eq,
108        eq_int,
109        hash,
110        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
111    )
112)]
113pub enum AggregationSource {
114    /// The data is externally aggregated (outside the Nautilus system boundary).
115    External = 1,
116    /// The data is internally aggregated (inside the Nautilus system boundary).
117    Internal = 2,
118}
119
120/// The side for the aggressing order of a trade in a market.
121#[repr(C)]
122#[derive(
123    Copy,
124    Clone,
125    Debug,
126    Default,
127    Display,
128    Hash,
129    PartialEq,
130    Eq,
131    PartialOrd,
132    Ord,
133    AsRefStr,
134    FromRepr,
135    EnumIter,
136    EnumString,
137)]
138#[strum(ascii_case_insensitive)]
139#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
140#[cfg_attr(
141    feature = "python",
142    pyo3::pyclass(
143        frozen,
144        eq,
145        eq_int,
146        hash,
147        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
148    )
149)]
150pub enum AggressorSide {
151    /// There was no specific aggressor for the trade.
152    #[default]
153    NoAggressor = 0,
154    /// The BUY order was the aggressor for the trade.
155    Buyer = 1,
156    /// The SELL order was the aggressor for the trade.
157    Seller = 2,
158}
159
160impl FromU8 for AggressorSide {
161    fn from_u8(value: u8) -> Option<Self> {
162        match value {
163            0 => Some(Self::NoAggressor),
164            1 => Some(Self::Buyer),
165            2 => Some(Self::Seller),
166            _ => None,
167        }
168    }
169}
170
171/// A broad financial market asset class.
172#[repr(C)]
173#[derive(
174    Copy,
175    Clone,
176    Debug,
177    Display,
178    Hash,
179    PartialEq,
180    Eq,
181    PartialOrd,
182    Ord,
183    AsRefStr,
184    FromRepr,
185    EnumIter,
186    EnumString,
187)]
188#[strum(ascii_case_insensitive)]
189#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
190#[cfg_attr(
191    feature = "python",
192    pyo3::pyclass(
193        frozen,
194        eq,
195        eq_int,
196        hash,
197        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
198    )
199)]
200#[allow(non_camel_case_types)]
201pub enum AssetClass {
202    /// Foreign exchange (FOREX) assets.
203    FX = 1,
204    /// Equity / stock assets.
205    Equity = 2,
206    /// Commodity assets.
207    Commodity = 3,
208    /// Debt based assets.
209    Debt = 4,
210    /// Index based assets (baskets).
211    Index = 5,
212    /// Cryptocurrency or crypto token assets.
213    Cryptocurrency = 6,
214    /// Alternative assets.
215    Alternative = 7,
216}
217
218impl FromU8 for AssetClass {
219    fn from_u8(value: u8) -> Option<Self> {
220        match value {
221            1 => Some(Self::FX),
222            2 => Some(Self::Equity),
223            3 => Some(Self::Commodity),
224            4 => Some(Self::Debt),
225            5 => Some(Self::Index),
226            6 => Some(Self::Cryptocurrency),
227            7 => Some(Self::Alternative),
228            _ => None,
229        }
230    }
231}
232
233/// The instrument class.
234#[repr(C)]
235#[derive(
236    Copy,
237    Clone,
238    Debug,
239    Display,
240    Hash,
241    PartialEq,
242    Eq,
243    PartialOrd,
244    Ord,
245    AsRefStr,
246    FromRepr,
247    EnumIter,
248    EnumString,
249)]
250#[strum(ascii_case_insensitive)]
251#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
252#[cfg_attr(
253    feature = "python",
254    pyo3::pyclass(
255        frozen,
256        eq,
257        eq_int,
258        hash,
259        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
260    )
261)]
262pub enum InstrumentClass {
263    /// A spot market instrument class. The current market price of an instrument that is bought or sold for immediate delivery and payment.
264    Spot = 1,
265    /// A swap instrument class. A derivative contract through which two parties exchange the cash flows or liabilities from two different financial instruments.
266    Swap = 2,
267    /// A futures contract instrument class. A legal agreement to buy or sell an asset at a predetermined price at a specified time in the future.
268    Future = 3,
269    /// A futures spread instrument class. A strategy involving the use of futures contracts to take advantage of price differentials between different contract months, underlying assets, or marketplaces.
270    FuturesSpread = 4,
271    /// A forward derivative instrument class. A customized contract between two parties to buy or sell an asset at a specified price on a future date.
272    Forward = 5,
273    /// A contract-for-difference (CFD) instrument class. A contract between an investor and a CFD broker to exchange the difference in the value of a financial product between the time the contract opens and closes.
274    Cfd = 6,
275    /// A bond instrument class. A type of debt investment where an investor loans money to an entity (typically corporate or governmental) which borrows the funds for a defined period of time at a variable or fixed interest rate.
276    Bond = 7,
277    /// An option contract instrument class. A type of derivative that gives the holder the right, but not the obligation, to buy or sell an underlying asset at a predetermined price before or at a certain future date.
278    Option = 8,
279    /// An option spread instrument class. A strategy involving the purchase and/or sale of multiple option contracts on the same underlying asset with different strike prices or expiration dates to hedge risk or speculate on price movements.
280    OptionSpread = 9,
281    /// A warrant instrument class. A derivative that gives the holder the right, but not the obligation, to buy or sell a security—most commonly an equity—at a certain price before expiration.
282    Warrant = 10,
283    /// A sports betting instrument class. A financialized derivative that allows wagering on the outcome of sports events using structured contracts or prediction markets.
284    SportsBetting = 11,
285    /// A binary option instrument class. A type of derivative where the payoff is either a fixed monetary amount or nothing, depending on whether the price of an underlying asset is above or below a predetermined level at expiration.
286    /// A binary option instrument class. A type of derivative where the payoff is either a fixed monetary amount or nothing, based on a yes/no proposition about an underlying event.
287    BinaryOption = 12,
288}
289
290/// The aggregation method through which a bar is generated and closed.
291#[repr(C)]
292#[derive(
293    Copy,
294    Clone,
295    Debug,
296    Display,
297    Hash,
298    PartialEq,
299    Eq,
300    PartialOrd,
301    Ord,
302    AsRefStr,
303    FromRepr,
304    EnumIter,
305    EnumString,
306)]
307#[strum(ascii_case_insensitive)]
308#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
309#[cfg_attr(
310    feature = "python",
311    pyo3::pyclass(
312        frozen,
313        eq,
314        eq_int,
315        hash,
316        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
317    )
318)]
319pub enum BarAggregation {
320    /// Based on a number of ticks.
321    Tick = 1,
322    /// Based on the buy/sell imbalance of ticks.
323    TickImbalance = 2,
324    /// Based on sequential buy/sell runs of ticks.
325    TickRuns = 3,
326    /// Based on traded volume.
327    Volume = 4,
328    /// Based on the buy/sell imbalance of traded volume.
329    VolumeImbalance = 5,
330    /// Based on sequential runs of buy/sell traded volume.
331    VolumeRuns = 6,
332    /// Based on the 'notional' value of the instrument.
333    Value = 7,
334    /// Based on the buy/sell imbalance of trading by notional value.
335    ValueImbalance = 8,
336    /// Based on sequential buy/sell runs of trading by notional value.
337    ValueRuns = 9,
338    /// Based on time intervals with millisecond granularity.
339    Millisecond = 10,
340    /// Based on time intervals with second granularity.
341    Second = 11,
342    /// Based on time intervals with minute granularity.
343    Minute = 12,
344    /// Based on time intervals with hour granularity.
345    Hour = 13,
346    /// Based on time intervals with day granularity.
347    Day = 14,
348    /// Based on time intervals with week granularity.
349    Week = 15,
350    /// Based on time intervals with month granularity.
351    Month = 16,
352    /// Based on time intervals with year granularity.
353    Year = 17,
354    /// Based on fixed price movements (brick size).
355    Renko = 18,
356}
357
358/// The interval type for bar aggregation.
359#[repr(C)]
360#[derive(
361    Copy,
362    Clone,
363    Debug,
364    Default,
365    Display,
366    Hash,
367    PartialEq,
368    Eq,
369    PartialOrd,
370    Ord,
371    AsRefStr,
372    FromRepr,
373    EnumIter,
374    EnumString,
375)]
376#[strum(ascii_case_insensitive)]
377#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
378#[cfg_attr(
379    feature = "python",
380    pyo3::pyclass(
381        frozen,
382        eq,
383        eq_int,
384        hash,
385        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
386    )
387)]
388pub enum BarIntervalType {
389    /// Left-open interval `(start, end]`: start is exclusive, end is inclusive (default).
390    #[default]
391    LeftOpen = 1,
392    /// Right-open interval `[start, end)`: start is inclusive, end is exclusive.
393    RightOpen = 2,
394}
395
396/// Represents the side of a bet in a betting market.
397#[repr(C)]
398#[derive(
399    Copy,
400    Clone,
401    Debug,
402    Display,
403    Hash,
404    PartialEq,
405    Eq,
406    PartialOrd,
407    Ord,
408    AsRefStr,
409    FromRepr,
410    EnumIter,
411    EnumString,
412)]
413#[strum(ascii_case_insensitive)]
414#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
415#[cfg_attr(
416    feature = "python",
417    pyo3::pyclass(
418        frozen,
419        eq,
420        eq_int,
421        hash,
422        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
423    )
424)]
425pub enum BetSide {
426    /// A "Back" bet signifies support for a specific outcome.
427    Back = 1,
428    /// A "Lay" bet signifies opposition to a specific outcome.
429    Lay = 2,
430}
431
432impl BetSide {
433    /// Returns the opposite betting side.
434    #[must_use]
435    pub fn opposite(&self) -> Self {
436        match self {
437            Self::Back => Self::Lay,
438            Self::Lay => Self::Back,
439        }
440    }
441}
442
443impl From<OrderSide> for BetSide {
444    /// Returns the equivalent [`BetSide`] for a given [`OrderSide`].
445    ///
446    /// # Panics
447    ///
448    /// Panics if `side` is [`OrderSide::NoOrderSide`].
449    fn from(side: OrderSide) -> Self {
450        match side {
451            OrderSide::Buy => Self::Back,
452            OrderSide::Sell => Self::Lay,
453            OrderSide::NoOrderSide => panic!("Invalid `OrderSide` for `BetSide`, was {side}"),
454        }
455    }
456}
457
458/// The type of order book action for an order book event.
459#[repr(C)]
460#[derive(
461    Copy,
462    Clone,
463    Debug,
464    Display,
465    Hash,
466    PartialEq,
467    Eq,
468    PartialOrd,
469    Ord,
470    AsRefStr,
471    FromRepr,
472    EnumIter,
473    EnumString,
474)]
475#[strum(ascii_case_insensitive)]
476#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
477#[cfg_attr(
478    feature = "python",
479    pyo3::pyclass(
480        frozen,
481        eq,
482        eq_int,
483        hash,
484        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
485    )
486)]
487pub enum BookAction {
488    /// An order is added to the book.
489    Add = 1,
490    /// An existing order in the book is updated/modified.
491    Update = 2,
492    /// An existing order in the book is deleted/canceled.
493    Delete = 3,
494    /// The state of the order book is cleared.
495    Clear = 4,
496}
497
498impl FromU8 for BookAction {
499    fn from_u8(value: u8) -> Option<Self> {
500        match value {
501            1 => Some(Self::Add),
502            2 => Some(Self::Update),
503            3 => Some(Self::Delete),
504            4 => Some(Self::Clear),
505            _ => None,
506        }
507    }
508}
509
510/// The order book type, representing the type of levels granularity and delta updating heuristics.
511#[repr(C)]
512#[derive(
513    Copy,
514    Clone,
515    Debug,
516    Display,
517    Hash,
518    PartialEq,
519    Eq,
520    PartialOrd,
521    Ord,
522    AsRefStr,
523    FromRepr,
524    EnumIter,
525    EnumString,
526)]
527#[strum(ascii_case_insensitive)]
528#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
529#[allow(non_camel_case_types)]
530#[cfg_attr(
531    feature = "python",
532    pyo3::pyclass(
533        frozen,
534        eq,
535        eq_int,
536        hash,
537        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
538    )
539)]
540pub enum BookType {
541    /// Top-of-book best bid/ask, one level per side.
542    L1_MBP = 1,
543    /// Market by price, one order per level (aggregated).
544    L2_MBP = 2,
545    /// Market by order, multiple orders per level (full granularity).
546    L3_MBO = 3,
547}
548
549impl FromU8 for BookType {
550    fn from_u8(value: u8) -> Option<Self> {
551        match value {
552            1 => Some(Self::L1_MBP),
553            2 => Some(Self::L2_MBP),
554            3 => Some(Self::L3_MBO),
555            _ => None,
556        }
557    }
558}
559
560/// The order contingency type which specifies the behavior of linked orders.
561///
562/// [FIX 5.0 SP2 : ContingencyType <1385> field](https://www.onixs.biz/fix-dictionary/5.0.sp2/tagnum_1385.html).
563#[repr(C)]
564#[derive(
565    Copy,
566    Clone,
567    Debug,
568    Default,
569    Display,
570    Hash,
571    PartialEq,
572    Eq,
573    PartialOrd,
574    Ord,
575    AsRefStr,
576    FromRepr,
577    EnumIter,
578    EnumString,
579)]
580#[strum(ascii_case_insensitive)]
581#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
582#[cfg_attr(
583    feature = "python",
584    pyo3::pyclass(
585        frozen,
586        eq,
587        eq_int,
588        hash,
589        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
590    )
591)]
592pub enum ContingencyType {
593    /// Not a contingent order.
594    #[default]
595    NoContingency = 0,
596    /// One-Cancels-the-Other.
597    Oco = 1,
598    /// One-Triggers-the-Other.
599    Oto = 2,
600    /// One-Updates-the-Other (by proportional quantity).
601    Ouo = 3,
602}
603
604/// The broad currency type.
605#[repr(C)]
606#[derive(
607    Copy,
608    Clone,
609    Debug,
610    Display,
611    Hash,
612    PartialEq,
613    Eq,
614    PartialOrd,
615    Ord,
616    AsRefStr,
617    FromRepr,
618    EnumIter,
619    EnumString,
620)]
621#[strum(ascii_case_insensitive)]
622#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
623#[cfg_attr(
624    feature = "python",
625    pyo3::pyclass(
626        frozen,
627        eq,
628        eq_int,
629        hash,
630        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
631    )
632)]
633pub enum CurrencyType {
634    /// A type of cryptocurrency or crypto token.
635    Crypto = 1,
636    /// A type of currency issued by governments which is not backed by a commodity.
637    Fiat = 2,
638    /// A type of currency that is based on the value of an underlying commodity.
639    CommodityBacked = 3,
640}
641
642/// The type of event for an instrument close.
643#[repr(C)]
644#[derive(
645    Copy,
646    Clone,
647    Debug,
648    Display,
649    Hash,
650    PartialEq,
651    Eq,
652    PartialOrd,
653    Ord,
654    AsRefStr,
655    FromRepr,
656    EnumIter,
657    EnumString,
658)]
659#[strum(ascii_case_insensitive)]
660#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
661#[cfg_attr(
662    feature = "python",
663    pyo3::pyclass(
664        frozen,
665        eq,
666        eq_int,
667        hash,
668        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
669    )
670)]
671pub enum InstrumentCloseType {
672    /// When the market session ended.
673    EndOfSession = 1,
674    /// When the instrument expiration was reached.
675    ContractExpired = 2,
676}
677
678/// Convert the given `value` to an [`InstrumentCloseType`].
679impl FromU8 for InstrumentCloseType {
680    fn from_u8(value: u8) -> Option<Self> {
681        match value {
682            1 => Some(Self::EndOfSession),
683            2 => Some(Self::ContractExpired),
684            _ => None,
685        }
686    }
687}
688
689/// The liquidity side for a trade.
690#[repr(C)]
691#[derive(
692    Copy,
693    Clone,
694    Debug,
695    Display,
696    Hash,
697    PartialEq,
698    Eq,
699    PartialOrd,
700    Ord,
701    AsRefStr,
702    FromRepr,
703    EnumIter,
704    EnumString,
705)]
706#[strum(ascii_case_insensitive)]
707#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
708#[cfg_attr(
709    feature = "python",
710    pyo3::pyclass(
711        frozen,
712        eq,
713        eq_int,
714        hash,
715        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
716    )
717)]
718#[allow(clippy::enum_variant_names)]
719pub enum LiquiditySide {
720    /// No liquidity side specified.
721    NoLiquiditySide = 0,
722    /// The order passively provided liquidity to the market to complete the trade (made a market).
723    Maker = 1,
724    /// The order aggressively took liquidity from the market to complete the trade.
725    Taker = 2,
726}
727
728/// The status of an individual market on a trading venue.
729#[repr(C)]
730#[derive(
731    Copy,
732    Clone,
733    Debug,
734    Display,
735    Hash,
736    PartialEq,
737    Eq,
738    PartialOrd,
739    Ord,
740    AsRefStr,
741    FromRepr,
742    EnumIter,
743    EnumString,
744)]
745#[strum(ascii_case_insensitive)]
746#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
747#[cfg_attr(
748    feature = "python",
749    pyo3::pyclass(
750        frozen,
751        eq,
752        eq_int,
753        hash,
754        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
755    )
756)]
757pub enum MarketStatus {
758    /// The instrument is trading.
759    Open = 1,
760    /// The instrument is in a pre-open period.
761    Closed = 2,
762    /// Trading in the instrument has been paused.
763    Paused = 3,
764    /// Trading in the instrument has been halted.
765    // Halted = 4,  # TODO: Unfortunately can't use this yet due to Cython (C enum namespacing)
766    /// Trading in the instrument has been suspended.
767    Suspended = 5,
768    /// Trading in the instrument is not available.
769    NotAvailable = 6,
770}
771
772/// An action affecting the status of an individual market on a trading venue.
773#[repr(C)]
774#[derive(
775    Copy,
776    Clone,
777    Debug,
778    Display,
779    Hash,
780    PartialEq,
781    Eq,
782    PartialOrd,
783    Ord,
784    AsRefStr,
785    FromRepr,
786    EnumIter,
787    EnumString,
788)]
789#[strum(ascii_case_insensitive)]
790#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
791#[cfg_attr(
792    feature = "python",
793    pyo3::pyclass(
794        frozen,
795        eq,
796        eq_int,
797        hash,
798        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
799    )
800)]
801pub enum MarketStatusAction {
802    /// No change.
803    None = 0,
804    /// The instrument is in a pre-open period.
805    PreOpen = 1,
806    /// The instrument is in a pre-cross period.
807    PreCross = 2,
808    /// The instrument is quoting but not trading.
809    Quoting = 3,
810    /// The instrument is in a cross/auction.
811    Cross = 4,
812    /// The instrument is being opened through a trading rotation.
813    Rotation = 5,
814    /// A new price indication is available for the instrument.
815    NewPriceIndication = 6,
816    /// The instrument is trading.
817    Trading = 7,
818    /// Trading in the instrument has been halted.
819    Halt = 8,
820    /// Trading in the instrument has been paused.
821    Pause = 9,
822    /// Trading in the instrument has been suspended.
823    Suspend = 10,
824    /// The instrument is in a pre-close period.
825    PreClose = 11,
826    /// Trading in the instrument has closed.
827    Close = 12,
828    /// The instrument is in a post-close period.
829    PostClose = 13,
830    /// A change in short-selling restrictions.
831    ShortSellRestrictionChange = 14,
832    /// The instrument is not available for trading, either trading has closed or been halted.
833    NotAvailableForTrading = 15,
834}
835
836/// Convert the given `value` to an [`OrderSide`].
837impl FromU16 for MarketStatusAction {
838    fn from_u16(value: u16) -> Option<Self> {
839        match value {
840            0 => Some(Self::None),
841            1 => Some(Self::PreOpen),
842            2 => Some(Self::PreCross),
843            3 => Some(Self::Quoting),
844            4 => Some(Self::Cross),
845            5 => Some(Self::Rotation),
846            6 => Some(Self::NewPriceIndication),
847            7 => Some(Self::Trading),
848            8 => Some(Self::Halt),
849            9 => Some(Self::Pause),
850            10 => Some(Self::Suspend),
851            11 => Some(Self::PreClose),
852            12 => Some(Self::Close),
853            13 => Some(Self::PostClose),
854            14 => Some(Self::ShortSellRestrictionChange),
855            15 => Some(Self::NotAvailableForTrading),
856            _ => None,
857        }
858    }
859}
860
861/// The order management system (OMS) type for a trading venue or trading strategy.
862#[repr(C)]
863#[derive(
864    Copy,
865    Clone,
866    Debug,
867    Default,
868    Display,
869    Hash,
870    PartialEq,
871    Eq,
872    PartialOrd,
873    Ord,
874    AsRefStr,
875    FromRepr,
876    EnumIter,
877    EnumString,
878)]
879#[strum(ascii_case_insensitive)]
880#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
881#[cfg_attr(
882    feature = "python",
883    pyo3::pyclass(
884        frozen,
885        eq,
886        eq_int,
887        hash,
888        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
889    )
890)]
891pub enum OmsType {
892    /// There is no specific type of order management specified (will defer to the venue OMS).
893    #[default]
894    Unspecified = 0,
895    /// The netting type where there is one position per instrument.
896    Netting = 1,
897    /// The hedging type where there can be multiple positions per instrument.
898    /// This can be in LONG/SHORT directions, by position/ticket ID, or tracked virtually by
899    /// Nautilus.
900    Hedging = 2,
901}
902
903/// The kind of option contract.
904#[repr(C)]
905#[derive(
906    Copy,
907    Clone,
908    Debug,
909    Display,
910    Hash,
911    PartialEq,
912    Eq,
913    PartialOrd,
914    Ord,
915    AsRefStr,
916    FromRepr,
917    EnumIter,
918    EnumString,
919)]
920#[strum(ascii_case_insensitive)]
921#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
922#[cfg_attr(
923    feature = "python",
924    pyo3::pyclass(
925        frozen,
926        eq,
927        eq_int,
928        hash,
929        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
930    )
931)]
932pub enum OptionKind {
933    /// A Call option gives the holder the right, but not the obligation, to buy an underlying asset at a specified strike price within a specified period of time.
934    Call = 1,
935    /// A Put option gives the holder the right, but not the obligation, to sell an underlying asset at a specified strike price within a specified period of time.
936    Put = 2,
937}
938
939/// The order side for a specific order, or action related to orders.
940#[repr(C)]
941#[derive(
942    Copy,
943    Clone,
944    Debug,
945    Default,
946    Display,
947    Hash,
948    PartialEq,
949    Eq,
950    PartialOrd,
951    Ord,
952    AsRefStr,
953    FromRepr,
954    EnumIter,
955    EnumString,
956)]
957#[strum(ascii_case_insensitive)]
958#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
959#[allow(clippy::enum_variant_names)]
960#[cfg_attr(
961    feature = "python",
962    pyo3::pyclass(
963        frozen,
964        eq,
965        eq_int,
966        hash,
967        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
968    )
969)]
970pub enum OrderSide {
971    /// No order side is specified.
972    #[default]
973    NoOrderSide = 0,
974    /// The order is a BUY.
975    Buy = 1,
976    /// The order is a SELL.
977    Sell = 2,
978}
979
980impl OrderSide {
981    /// Returns the specified [`OrderSideSpecified`] (BUY or SELL) for this side.
982    ///
983    /// # Panics
984    ///
985    /// Panics if `self` is [`OrderSide::NoOrderSide`].
986    #[must_use]
987    pub fn as_specified(&self) -> OrderSideSpecified {
988        match &self {
989            Self::Buy => OrderSideSpecified::Buy,
990            Self::Sell => OrderSideSpecified::Sell,
991            _ => panic!("Order invariant failed: side must be `Buy` or `Sell`"),
992        }
993    }
994}
995
996/// Convert the given `value` to an [`OrderSide`].
997impl FromU8 for OrderSide {
998    fn from_u8(value: u8) -> Option<Self> {
999        match value {
1000            0 => Some(Self::NoOrderSide),
1001            1 => Some(Self::Buy),
1002            2 => Some(Self::Sell),
1003            _ => None,
1004        }
1005    }
1006}
1007
1008/// The specified order side (BUY or SELL).
1009#[repr(C)]
1010#[derive(
1011    Copy,
1012    Clone,
1013    Debug,
1014    Display,
1015    Hash,
1016    PartialEq,
1017    Eq,
1018    PartialOrd,
1019    Ord,
1020    AsRefStr,
1021    FromRepr,
1022    EnumIter,
1023    EnumString,
1024)]
1025#[strum(ascii_case_insensitive)]
1026#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1027#[allow(clippy::enum_variant_names)]
1028pub enum OrderSideSpecified {
1029    /// The order is a BUY.
1030    Buy = 1,
1031    /// The order is a SELL.
1032    Sell = 2,
1033}
1034
1035impl OrderSideSpecified {
1036    /// Returns the opposite order side.
1037    #[must_use]
1038    pub fn opposite(&self) -> Self {
1039        match &self {
1040            Self::Buy => Self::Sell,
1041            Self::Sell => Self::Buy,
1042        }
1043    }
1044
1045    /// Converts this specified side into an [`OrderSide`].
1046    #[must_use]
1047    pub fn as_order_side(&self) -> OrderSide {
1048        match &self {
1049            Self::Buy => OrderSide::Buy,
1050            Self::Sell => OrderSide::Sell,
1051        }
1052    }
1053}
1054
1055/// The status for a specific order.
1056///
1057/// An order is considered _open_ for the following status:
1058///  - `ACCEPTED`
1059///  - `TRIGGERED`
1060///  - `PENDING_UPDATE`
1061///  - `PENDING_CANCEL`
1062///  - `PARTIALLY_FILLED`
1063///
1064/// An order is considered _in-flight_ for the following status:
1065///  - `SUBMITTED`
1066///  - `PENDING_UPDATE`
1067///  - `PENDING_CANCEL`
1068///
1069/// An order is considered _closed_ for the following status:
1070///  - `DENIED`
1071///  - `REJECTED`
1072///  - `CANCELED`
1073///  - `EXPIRED`
1074///  - `FILLED`
1075#[repr(C)]
1076#[derive(
1077    Copy,
1078    Clone,
1079    Debug,
1080    Display,
1081    Hash,
1082    PartialEq,
1083    Eq,
1084    PartialOrd,
1085    Ord,
1086    AsRefStr,
1087    FromRepr,
1088    EnumIter,
1089    EnumString,
1090)]
1091#[strum(ascii_case_insensitive)]
1092#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1093#[cfg_attr(
1094    feature = "python",
1095    pyo3::pyclass(
1096        frozen,
1097        eq,
1098        eq_int,
1099        hash,
1100        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1101    )
1102)]
1103pub enum OrderStatus {
1104    /// The order is initialized (instantiated) within the Nautilus system.
1105    Initialized = 1,
1106    /// The order was denied by the Nautilus system, either for being invalid, unprocessable or exceeding a risk limit.
1107    Denied = 2,
1108    /// The order became emulated by the Nautilus system in the `OrderEmulator` component.
1109    Emulated = 3,
1110    /// The order was released by the Nautilus system from the `OrderEmulator` component.
1111    Released = 4,
1112    /// The order was submitted by the Nautilus system to the external service or trading venue (awaiting acknowledgement).
1113    Submitted = 5,
1114    /// The order was acknowledged by the trading venue as being received and valid (may now be working).
1115    Accepted = 6,
1116    /// The order was rejected by the trading venue.
1117    Rejected = 7,
1118    /// The order was canceled (closed/done).
1119    Canceled = 8,
1120    /// The order reached a GTD expiration (closed/done).
1121    Expired = 9,
1122    /// The order STOP price was triggered on a trading venue.
1123    Triggered = 10,
1124    /// The order is currently pending a request to modify on a trading venue.
1125    PendingUpdate = 11,
1126    /// The order is currently pending a request to cancel on a trading venue.
1127    PendingCancel = 12,
1128    /// The order has been partially filled on a trading venue.
1129    PartiallyFilled = 13,
1130    /// The order has been completely filled on a trading venue (closed/done).
1131    Filled = 14,
1132}
1133
1134impl OrderStatus {
1135    /// Returns a cached `AHashSet` of order statuses safe for cancellation queries.
1136    ///
1137    /// These are statuses where an order is working on the venue but not already
1138    /// in the process of being cancelled or updated. Including `PENDING_CANCEL`
1139    /// in cancellation filters can cause duplicate cancel attempts or incorrect open order counts.
1140    ///
1141    /// Returns:
1142    /// - `ACCEPTED`: Order is working on the venue.
1143    /// - `TRIGGERED`: Stop order has been triggered.
1144    /// - `PENDING_UPDATE`: Order being updated.
1145    /// - `PARTIALLY_FILLED`: Order is partially filled but still working.
1146    ///
1147    /// Excludes:
1148    /// - `PENDING_CANCEL`: Already being cancelled.
1149    #[must_use]
1150    pub fn cancellable_statuses_set() -> &'static AHashSet<Self> {
1151        static CANCELLABLE_SET: OnceLock<AHashSet<OrderStatus>> = OnceLock::new();
1152        CANCELLABLE_SET.get_or_init(|| {
1153            AHashSet::from_iter([
1154                Self::Accepted,
1155                Self::Triggered,
1156                Self::PendingUpdate,
1157                Self::PartiallyFilled,
1158            ])
1159        })
1160    }
1161}
1162
1163/// The type of order.
1164#[repr(C)]
1165#[derive(
1166    Copy,
1167    Clone,
1168    Debug,
1169    Display,
1170    Hash,
1171    PartialEq,
1172    Eq,
1173    PartialOrd,
1174    Ord,
1175    AsRefStr,
1176    FromRepr,
1177    EnumIter,
1178    EnumString,
1179)]
1180#[strum(ascii_case_insensitive)]
1181#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1182#[cfg_attr(
1183    feature = "python",
1184    pyo3::pyclass(
1185        frozen,
1186        eq,
1187        eq_int,
1188        hash,
1189        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1190    )
1191)]
1192pub enum OrderType {
1193    /// A market order to buy or sell at the best available price in the current market.
1194    Market = 1,
1195    /// A limit order to buy or sell at a specific price or better.
1196    Limit = 2,
1197    /// A stop market order to buy or sell once the price reaches the specified stop/trigger price. When the stop price is reached, the order effectively becomes a market order.
1198    StopMarket = 3,
1199    /// A stop limit order to buy or sell which combines the features of a stop order and a limit order. Once the stop/trigger price is reached, a stop-limit order effectively becomes a limit order.
1200    StopLimit = 4,
1201    /// A market-to-limit order is a market order that is to be executed as a limit order at the current best market price after reaching the market.
1202    MarketToLimit = 5,
1203    /// A market-if-touched order effectively becomes a market order when the specified trigger price is reached.
1204    MarketIfTouched = 6,
1205    /// A limit-if-touched order effectively becomes a limit order when the specified trigger price is reached.
1206    LimitIfTouched = 7,
1207    /// A trailing stop market order sets the stop/trigger price at a fixed "trailing offset" amount from the market.
1208    TrailingStopMarket = 8,
1209    /// A trailing stop limit order combines the features of a trailing stop order with those of a limit order.
1210    TrailingStopLimit = 9,
1211}
1212
1213/// The market side for a specific position, or action related to positions.
1214#[repr(C)]
1215#[derive(
1216    Copy,
1217    Clone,
1218    Debug,
1219    Default,
1220    Display,
1221    Hash,
1222    PartialEq,
1223    Eq,
1224    PartialOrd,
1225    Ord,
1226    AsRefStr,
1227    FromRepr,
1228    EnumIter,
1229    EnumString,
1230)]
1231#[strum(ascii_case_insensitive)]
1232#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1233#[allow(clippy::enum_variant_names)]
1234#[cfg_attr(
1235    feature = "python",
1236    pyo3::pyclass(
1237        frozen,
1238        eq,
1239        eq_int,
1240        hash,
1241        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1242    )
1243)]
1244pub enum PositionSide {
1245    /// No position side is specified (only valid in the context of a filter for actions involving positions).
1246    #[default]
1247    NoPositionSide = 0,
1248    /// A neural/flat position, where no position is currently held in the market.
1249    Flat = 1,
1250    /// A long position in the market, typically acquired through one or many BUY orders.
1251    Long = 2,
1252    /// A short position in the market, typically acquired through one or many SELL orders.
1253    Short = 3,
1254}
1255
1256impl PositionSide {
1257    /// Returns the specified [`PositionSideSpecified`] (`Long`, `Short`, or `Flat`) for this side.
1258    ///
1259    /// # Panics
1260    ///
1261    /// Panics if `self` is [`PositionSide::NoPositionSide`].
1262    #[must_use]
1263    pub fn as_specified(&self) -> PositionSideSpecified {
1264        match &self {
1265            Self::Long => PositionSideSpecified::Long,
1266            Self::Short => PositionSideSpecified::Short,
1267            Self::Flat => PositionSideSpecified::Flat,
1268            _ => panic!("Position invariant failed: side must be `Long`, `Short`, or `Flat`"),
1269        }
1270    }
1271}
1272
1273/// The market side for a specific position, or action related to positions.
1274#[repr(C)]
1275#[derive(
1276    Copy,
1277    Clone,
1278    Debug,
1279    Display,
1280    Hash,
1281    PartialEq,
1282    Eq,
1283    PartialOrd,
1284    Ord,
1285    AsRefStr,
1286    FromRepr,
1287    EnumIter,
1288    EnumString,
1289)]
1290#[strum(ascii_case_insensitive)]
1291#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1292#[allow(clippy::enum_variant_names)]
1293#[cfg_attr(
1294    feature = "python",
1295    pyo3::pyclass(
1296        frozen,
1297        eq,
1298        eq_int,
1299        hash,
1300        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1301    )
1302)]
1303pub enum PositionSideSpecified {
1304    /// A neural/flat position, where no position is currently held in the market.
1305    Flat = 1,
1306    /// A long position in the market, typically acquired through one or many BUY orders.
1307    Long = 2,
1308    /// A short position in the market, typically acquired through one or many SELL orders.
1309    Short = 3,
1310}
1311
1312impl PositionSideSpecified {
1313    /// Converts this specified side into a [`PositionSide`].
1314    #[must_use]
1315    pub fn as_position_side(&self) -> PositionSide {
1316        match &self {
1317            Self::Long => PositionSide::Long,
1318            Self::Short => PositionSide::Short,
1319            Self::Flat => PositionSide::Flat,
1320        }
1321    }
1322}
1323
1324/// The type of price for an instrument in a market.
1325#[repr(C)]
1326#[derive(
1327    Copy,
1328    Clone,
1329    Debug,
1330    Display,
1331    Hash,
1332    PartialEq,
1333    Eq,
1334    PartialOrd,
1335    Ord,
1336    AsRefStr,
1337    FromRepr,
1338    EnumIter,
1339    EnumString,
1340)]
1341#[strum(ascii_case_insensitive)]
1342#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1343#[cfg_attr(
1344    feature = "python",
1345    pyo3::pyclass(
1346        frozen,
1347        eq,
1348        eq_int,
1349        hash,
1350        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1351    )
1352)]
1353pub enum PriceType {
1354    /// The best quoted price at which buyers are willing to buy a quantity of an instrument.
1355    /// Often considered the best bid in the order book.
1356    Bid = 1,
1357    /// The best quoted price at which sellers are willing to sell a quantity of an instrument.
1358    /// Often considered the best ask in the order book.
1359    Ask = 2,
1360    /// The arithmetic midpoint between the best bid and ask quotes.
1361    Mid = 3,
1362    /// The price at which the last trade of an instrument was executed.
1363    Last = 4,
1364    /// A reference price reflecting an instrument's fair value, often used for portfolio
1365    /// calculations and risk management.
1366    Mark = 5,
1367}
1368
1369/// A record flag bit field, indicating event end and data information.
1370#[repr(C)]
1371#[derive(
1372    Copy,
1373    Clone,
1374    Debug,
1375    Display,
1376    Hash,
1377    PartialEq,
1378    Eq,
1379    PartialOrd,
1380    Ord,
1381    AsRefStr,
1382    FromRepr,
1383    EnumIter,
1384    EnumString,
1385)]
1386#[strum(ascii_case_insensitive)]
1387#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1388#[cfg_attr(
1389    feature = "python",
1390    pyo3::pyclass(
1391        frozen,
1392        eq,
1393        eq_int,
1394        hash,
1395        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1396    )
1397)]
1398#[allow(non_camel_case_types)]
1399pub enum RecordFlag {
1400    /// Last message in the book event or packet from the venue for a given `instrument_id`.
1401    F_LAST = 1 << 7, // 128
1402    /// Top-of-book message, not an individual order.
1403    F_TOB = 1 << 6, // 64
1404    /// Message sourced from a replay, such as a snapshot server.
1405    F_SNAPSHOT = 1 << 5, // 32
1406    /// Aggregated price level message, not an individual order.
1407    F_MBP = 1 << 4, // 16
1408    /// Reserved for future use.
1409    RESERVED_2 = 1 << 3, // 8
1410    /// Reserved for future use.
1411    RESERVED_1 = 1 << 2, // 4
1412}
1413
1414impl RecordFlag {
1415    /// Checks if the flag matches a given value.
1416    #[must_use]
1417    pub fn matches(self, value: u8) -> bool {
1418        (self as u8) & value != 0
1419    }
1420}
1421
1422/// The 'Time in Force' instruction for an order.
1423#[repr(C)]
1424#[derive(
1425    Copy,
1426    Clone,
1427    Debug,
1428    Display,
1429    Hash,
1430    PartialEq,
1431    Eq,
1432    PartialOrd,
1433    Ord,
1434    AsRefStr,
1435    FromRepr,
1436    EnumIter,
1437    EnumString,
1438)]
1439#[strum(ascii_case_insensitive)]
1440#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1441#[cfg_attr(
1442    feature = "python",
1443    pyo3::pyclass(
1444        frozen,
1445        eq,
1446        eq_int,
1447        hash,
1448        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1449    )
1450)]
1451pub enum TimeInForce {
1452    /// Good Till Cancel (GTC) - Remains active until canceled.
1453    Gtc = 1,
1454    /// Immediate or Cancel (IOC) - Executes immediately to the extent possible, with any unfilled portion canceled.
1455    Ioc = 2,
1456    /// Fill or Kill (FOK) - Executes in its entirety immediately or is canceled if full execution is not possible.
1457    Fok = 3,
1458    /// Good Till Date (GTD) - Remains active until the specified expiration date or time is reached.
1459    Gtd = 4,
1460    /// Day - Remains active until the close of the current trading session.
1461    Day = 5,
1462    /// At the Opening (ATO) - Executes at the market opening or expires if not filled.
1463    AtTheOpen = 6,
1464    /// At the Closing (ATC) - Executes at the market close or expires if not filled.
1465    AtTheClose = 7,
1466}
1467
1468/// The trading state for a node.
1469#[repr(C)]
1470#[derive(
1471    Copy,
1472    Clone,
1473    Debug,
1474    Display,
1475    Hash,
1476    PartialEq,
1477    Eq,
1478    PartialOrd,
1479    Ord,
1480    AsRefStr,
1481    FromRepr,
1482    EnumIter,
1483    EnumString,
1484)]
1485#[strum(ascii_case_insensitive)]
1486#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1487#[cfg_attr(
1488    feature = "python",
1489    pyo3::pyclass(
1490        frozen,
1491        eq,
1492        eq_int,
1493        hash,
1494        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1495    )
1496)]
1497pub enum TradingState {
1498    /// Normal trading operations.
1499    Active = 1,
1500    /// Trading is completely halted, no new order commands will be emitted.
1501    Halted = 2,
1502    /// Only order commands which would cancel order, or reduce position sizes are permitted.
1503    Reducing = 3,
1504}
1505
1506/// The trailing offset type for an order type which specifies a trailing stop/trigger or limit price.
1507#[repr(C)]
1508#[derive(
1509    Copy,
1510    Clone,
1511    Debug,
1512    Default,
1513    Display,
1514    Hash,
1515    PartialEq,
1516    Eq,
1517    PartialOrd,
1518    Ord,
1519    AsRefStr,
1520    FromRepr,
1521    EnumIter,
1522    EnumString,
1523)]
1524#[strum(ascii_case_insensitive)]
1525#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1526#[cfg_attr(
1527    feature = "python",
1528    pyo3::pyclass(
1529        frozen,
1530        eq,
1531        eq_int,
1532        hash,
1533        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1534    )
1535)]
1536pub enum TrailingOffsetType {
1537    /// No trailing offset type is specified (invalid for trailing type orders).
1538    #[default]
1539    NoTrailingOffset = 0,
1540    /// The trailing offset is based on a market price.
1541    Price = 1,
1542    /// The trailing offset is based on a percentage represented in basis points, of a market price.
1543    BasisPoints = 2,
1544    /// The trailing offset is based on the number of ticks from a market price.
1545    Ticks = 3,
1546    /// The trailing offset is based on a price tier set by a specific trading venue.
1547    PriceTier = 4,
1548}
1549
1550/// The trigger type for the stop/trigger price of an order.
1551#[repr(C)]
1552#[derive(
1553    Copy,
1554    Clone,
1555    Debug,
1556    Default,
1557    Display,
1558    Hash,
1559    PartialEq,
1560    Eq,
1561    PartialOrd,
1562    Ord,
1563    AsRefStr,
1564    FromRepr,
1565    EnumIter,
1566    EnumString,
1567)]
1568#[strum(ascii_case_insensitive)]
1569#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
1570#[cfg_attr(
1571    feature = "python",
1572    pyo3::pyclass(
1573        frozen,
1574        eq,
1575        eq_int,
1576        hash,
1577        module = "nautilus_trader.core.nautilus_pyo3.model.enums"
1578    )
1579)]
1580pub enum TriggerType {
1581    /// No trigger type is specified (invalid for orders with a trigger).
1582    #[default]
1583    NoTrigger = 0,
1584    /// The default trigger type set by the trading venue.
1585    Default = 1,
1586    /// Based on the last traded price for the instrument.
1587    LastPrice = 2,
1588    /// Based on the mark price for the instrument.
1589    MarkPrice = 3,
1590    /// Based on the index price for the instrument.
1591    IndexPrice = 4,
1592    /// Based on the top-of-book quoted prices for the instrument.
1593    BidAsk = 5,
1594    /// Based on a 'double match' of the last traded price for the instrument
1595    DoubleLast = 6,
1596    /// Based on a 'double match' of the bid/ask price for the instrument
1597    DoubleBidAsk = 7,
1598    /// Based on both the [`TriggerType::LastPrice`] and [`TriggerType::BidAsk`].
1599    LastOrBidAsk = 8,
1600    /// Based on the mid-point of the [`TriggerType::BidAsk`].
1601    MidPoint = 9,
1602}
1603
1604enum_strum_serde!(AccountType);
1605enum_strum_serde!(AggregationSource);
1606enum_strum_serde!(AggressorSide);
1607enum_strum_serde!(AssetClass);
1608enum_strum_serde!(InstrumentClass);
1609enum_strum_serde!(BarAggregation);
1610enum_strum_serde!(BarIntervalType);
1611enum_strum_serde!(BookAction);
1612enum_strum_serde!(BookType);
1613enum_strum_serde!(ContingencyType);
1614enum_strum_serde!(CurrencyType);
1615enum_strum_serde!(InstrumentCloseType);
1616enum_strum_serde!(LiquiditySide);
1617enum_strum_serde!(MarketStatus);
1618enum_strum_serde!(MarketStatusAction);
1619enum_strum_serde!(OmsType);
1620enum_strum_serde!(OptionKind);
1621enum_strum_serde!(OrderSide);
1622enum_strum_serde!(OrderSideSpecified);
1623enum_strum_serde!(OrderStatus);
1624enum_strum_serde!(OrderType);
1625enum_strum_serde!(PositionSide);
1626enum_strum_serde!(PositionSideSpecified);
1627enum_strum_serde!(PriceType);
1628enum_strum_serde!(RecordFlag);
1629enum_strum_serde!(TimeInForce);
1630enum_strum_serde!(TradingState);
1631enum_strum_serde!(TrailingOffsetType);
1632enum_strum_serde!(TriggerType);