#[non_exhaustive]pub enum OrderType {
Market,
BuyLimit {
limit_price: f64,
},
BuyStop {
stop_price: f64,
},
SellLimit {
limit_price: f64,
},
SellStop {
stop_price: f64,
},
BuyStopLimit {
stop_price: f64,
limit_price: f64,
},
}Expand description
Order type controlling how a signal’s entry is executed.
OrderType::Market (the default) preserves the existing behaviour:
fill at the next bar’s open. The limit and stop variants queue the order
as a PendingOrder and fill when the bar’s high/low reaches the
specified price level.
This enum is #[non_exhaustive] so that adding new order types (e.g.
MarketOnClose, TrailingStopLimit) in a future release is not a
breaking change for library consumers that match on it exhaustively.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Market
Standard market order — fill at next bar’s open (default).
BuyLimit
Limit buy — fill if candle.low ≤ limit_price.
BuyStop
Stop buy (breakout) — fill if candle.high ≥ stop_price.
SellLimit
Limit sell — fill if candle.high ≥ limit_price.
SellStop
Stop sell (breakdown) — fill if candle.low ≤ stop_price.
BuyStopLimit
Stop-limit buy — triggered when candle.high ≥ stop_price,
filled at the trigger price capped at limit_price.
If the bar opens above limit_price the order cannot fill that bar.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for OrderType
impl<'de> Deserialize<'de> for OrderType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for OrderType
Auto Trait Implementations§
impl Freeze for OrderType
impl RefUnwindSafe for OrderType
impl Send for OrderType
impl Sync for OrderType
impl Unpin for OrderType
impl UnsafeUnpin for OrderType
impl UnwindSafe for OrderType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more