use std::{str::FromStr, sync::OnceLock};
use ahash::AHashSet;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use strum::{AsRefStr, Display, EnumIter, EnumString, FromRepr};
use crate::enum_strum_serde;
pub trait FromU8 {
fn from_u8(value: u8) -> Option<Self>
where
Self: Sized;
}
pub trait FromU16 {
fn from_u16(value: u16) -> Option<Self>
where
Self: Sized;
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum AccountType {
Cash = 1,
Margin = 2,
Betting = 3,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum AggregationSource {
External = 1,
Internal = 2,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum AggressorSide {
#[default]
NoAggressor = 0,
Buyer = 1,
Seller = 2,
}
impl FromU8 for AggressorSide {
fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(Self::NoAggressor),
1 => Some(Self::Buyer),
2 => Some(Self::Seller),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
#[allow(non_camel_case_types)]
pub enum AssetClass {
FX = 1,
Equity = 2,
Commodity = 3,
Debt = 4,
Index = 5,
Cryptocurrency = 6,
Alternative = 7,
}
impl FromU8 for AssetClass {
fn from_u8(value: u8) -> Option<Self> {
match value {
1 => Some(Self::FX),
2 => Some(Self::Equity),
3 => Some(Self::Commodity),
4 => Some(Self::Debt),
5 => Some(Self::Index),
6 => Some(Self::Cryptocurrency),
7 => Some(Self::Alternative),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum InstrumentClass {
Spot = 1,
Swap = 2,
Future = 3,
FuturesSpread = 4,
Forward = 5,
Cfd = 6,
Bond = 7,
Option = 8,
OptionSpread = 9,
Warrant = 10,
SportsBetting = 11,
BinaryOption = 12,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum BarAggregation {
Tick = 1,
TickImbalance = 2,
TickRuns = 3,
Volume = 4,
VolumeImbalance = 5,
VolumeRuns = 6,
Value = 7,
ValueImbalance = 8,
ValueRuns = 9,
Millisecond = 10,
Second = 11,
Minute = 12,
Hour = 13,
Day = 14,
Week = 15,
Month = 16,
Year = 17,
Renko = 18,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum BarIntervalType {
#[default]
LeftOpen = 1,
RightOpen = 2,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum BetSide {
Back = 1,
Lay = 2,
}
impl BetSide {
#[must_use]
pub fn opposite(&self) -> Self {
match self {
Self::Back => Self::Lay,
Self::Lay => Self::Back,
}
}
}
impl From<OrderSide> for BetSide {
fn from(side: OrderSide) -> Self {
match side {
OrderSide::Buy => Self::Back,
OrderSide::Sell => Self::Lay,
OrderSide::NoOrderSide => panic!("Invalid `OrderSide` for `BetSide`, was {side}"),
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum BookAction {
Add = 1,
Update = 2,
Delete = 3,
Clear = 4,
}
impl FromU8 for BookAction {
fn from_u8(value: u8) -> Option<Self> {
match value {
1 => Some(Self::Add),
2 => Some(Self::Update),
3 => Some(Self::Delete),
4 => Some(Self::Clear),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[allow(non_camel_case_types)]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum BookType {
L1_MBP = 1,
L2_MBP = 2,
L3_MBO = 3,
}
impl FromU8 for BookType {
fn from_u8(value: u8) -> Option<Self> {
match value {
1 => Some(Self::L1_MBP),
2 => Some(Self::L2_MBP),
3 => Some(Self::L3_MBO),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum ContingencyType {
#[default]
NoContingency = 0,
Oco = 1,
Oto = 2,
Ouo = 3,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum CurrencyType {
Crypto = 1,
Fiat = 2,
CommodityBacked = 3,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum InstrumentCloseType {
EndOfSession = 1,
ContractExpired = 2,
}
impl FromU8 for InstrumentCloseType {
fn from_u8(value: u8) -> Option<Self> {
match value {
1 => Some(Self::EndOfSession),
2 => Some(Self::ContractExpired),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
#[allow(clippy::enum_variant_names)]
pub enum LiquiditySide {
NoLiquiditySide = 0,
Maker = 1,
Taker = 2,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum MarketStatus {
Open = 1,
Closed = 2,
Paused = 3,
Suspended = 5,
NotAvailable = 6,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum MarketStatusAction {
None = 0,
PreOpen = 1,
PreCross = 2,
Quoting = 3,
Cross = 4,
Rotation = 5,
NewPriceIndication = 6,
Trading = 7,
Halt = 8,
Pause = 9,
Suspend = 10,
PreClose = 11,
Close = 12,
PostClose = 13,
ShortSellRestrictionChange = 14,
NotAvailableForTrading = 15,
}
impl FromU16 for MarketStatusAction {
fn from_u16(value: u16) -> Option<Self> {
match value {
0 => Some(Self::None),
1 => Some(Self::PreOpen),
2 => Some(Self::PreCross),
3 => Some(Self::Quoting),
4 => Some(Self::Cross),
5 => Some(Self::Rotation),
6 => Some(Self::NewPriceIndication),
7 => Some(Self::Trading),
8 => Some(Self::Halt),
9 => Some(Self::Pause),
10 => Some(Self::Suspend),
11 => Some(Self::PreClose),
12 => Some(Self::Close),
13 => Some(Self::PostClose),
14 => Some(Self::ShortSellRestrictionChange),
15 => Some(Self::NotAvailableForTrading),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum OmsType {
#[default]
Unspecified = 0,
Netting = 1,
Hedging = 2,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum OptionKind {
Call = 1,
Put = 2,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[allow(clippy::enum_variant_names)]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum OrderSide {
#[default]
NoOrderSide = 0,
Buy = 1,
Sell = 2,
}
impl OrderSide {
#[must_use]
pub fn as_specified(&self) -> OrderSideSpecified {
match &self {
Self::Buy => OrderSideSpecified::Buy,
Self::Sell => OrderSideSpecified::Sell,
_ => panic!("Order invariant failed: side must be `Buy` or `Sell`"),
}
}
}
impl FromU8 for OrderSide {
fn from_u8(value: u8) -> Option<Self> {
match value {
0 => Some(Self::NoOrderSide),
1 => Some(Self::Buy),
2 => Some(Self::Sell),
_ => None,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[allow(clippy::enum_variant_names)]
pub enum OrderSideSpecified {
Buy = 1,
Sell = 2,
}
impl OrderSideSpecified {
#[must_use]
pub fn opposite(&self) -> Self {
match &self {
Self::Buy => Self::Sell,
Self::Sell => Self::Buy,
}
}
#[must_use]
pub fn as_order_side(&self) -> OrderSide {
match &self {
Self::Buy => OrderSide::Buy,
Self::Sell => OrderSide::Sell,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum OrderStatus {
Initialized = 1,
Denied = 2,
Emulated = 3,
Released = 4,
Submitted = 5,
Accepted = 6,
Rejected = 7,
Canceled = 8,
Expired = 9,
Triggered = 10,
PendingUpdate = 11,
PendingCancel = 12,
PartiallyFilled = 13,
Filled = 14,
}
impl OrderStatus {
#[must_use]
pub fn cancellable_statuses_set() -> &'static AHashSet<Self> {
static CANCELLABLE_SET: OnceLock<AHashSet<OrderStatus>> = OnceLock::new();
CANCELLABLE_SET.get_or_init(|| {
AHashSet::from_iter([
Self::Accepted,
Self::Triggered,
Self::PendingUpdate,
Self::PartiallyFilled,
])
})
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum OrderType {
Market = 1,
Limit = 2,
StopMarket = 3,
StopLimit = 4,
MarketToLimit = 5,
MarketIfTouched = 6,
LimitIfTouched = 7,
TrailingStopMarket = 8,
TrailingStopLimit = 9,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[allow(clippy::enum_variant_names)]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum PositionSide {
#[default]
NoPositionSide = 0,
Flat = 1,
Long = 2,
Short = 3,
}
impl PositionSide {
#[must_use]
pub fn as_specified(&self) -> PositionSideSpecified {
match &self {
Self::Long => PositionSideSpecified::Long,
Self::Short => PositionSideSpecified::Short,
Self::Flat => PositionSideSpecified::Flat,
_ => panic!("Position invariant failed: side must be `Long`, `Short`, or `Flat`"),
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[allow(clippy::enum_variant_names)]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum PositionSideSpecified {
Flat = 1,
Long = 2,
Short = 3,
}
impl PositionSideSpecified {
#[must_use]
pub fn as_position_side(&self) -> PositionSide {
match &self {
Self::Long => PositionSide::Long,
Self::Short => PositionSide::Short,
Self::Flat => PositionSide::Flat,
}
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum PriceType {
Bid = 1,
Ask = 2,
Mid = 3,
Last = 4,
Mark = 5,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
#[allow(non_camel_case_types)]
pub enum RecordFlag {
F_LAST = 1 << 7, F_TOB = 1 << 6, F_SNAPSHOT = 1 << 5, F_MBP = 1 << 4, RESERVED_2 = 1 << 3, RESERVED_1 = 1 << 2, }
impl RecordFlag {
#[must_use]
pub fn matches(self, value: u8) -> bool {
(self as u8) & value != 0
}
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum TimeInForce {
Gtc = 1,
Ioc = 2,
Fok = 3,
Gtd = 4,
Day = 5,
AtTheOpen = 6,
AtTheClose = 7,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum TradingState {
Active = 1,
Halted = 2,
Reducing = 3,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum TrailingOffsetType {
#[default]
NoTrailingOffset = 0,
Price = 1,
BasisPoints = 2,
Ticks = 3,
PriceTier = 4,
}
#[repr(C)]
#[derive(
Copy,
Clone,
Debug,
Default,
Display,
Hash,
PartialEq,
Eq,
PartialOrd,
Ord,
AsRefStr,
FromRepr,
EnumIter,
EnumString,
)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
frozen,
eq,
eq_int,
hash,
module = "nautilus_trader.core.nautilus_pyo3.model.enums"
)
)]
pub enum TriggerType {
#[default]
NoTrigger = 0,
Default = 1,
LastPrice = 2,
MarkPrice = 3,
IndexPrice = 4,
BidAsk = 5,
DoubleLast = 6,
DoubleBidAsk = 7,
LastOrBidAsk = 8,
MidPoint = 9,
}
enum_strum_serde!(AccountType);
enum_strum_serde!(AggregationSource);
enum_strum_serde!(AggressorSide);
enum_strum_serde!(AssetClass);
enum_strum_serde!(InstrumentClass);
enum_strum_serde!(BarAggregation);
enum_strum_serde!(BarIntervalType);
enum_strum_serde!(BookAction);
enum_strum_serde!(BookType);
enum_strum_serde!(ContingencyType);
enum_strum_serde!(CurrencyType);
enum_strum_serde!(InstrumentCloseType);
enum_strum_serde!(LiquiditySide);
enum_strum_serde!(MarketStatus);
enum_strum_serde!(MarketStatusAction);
enum_strum_serde!(OmsType);
enum_strum_serde!(OptionKind);
enum_strum_serde!(OrderSide);
enum_strum_serde!(OrderSideSpecified);
enum_strum_serde!(OrderStatus);
enum_strum_serde!(OrderType);
enum_strum_serde!(PositionSide);
enum_strum_serde!(PositionSideSpecified);
enum_strum_serde!(PriceType);
enum_strum_serde!(RecordFlag);
enum_strum_serde!(TimeInForce);
enum_strum_serde!(TradingState);
enum_strum_serde!(TrailingOffsetType);
enum_strum_serde!(TriggerType);