#[non_exhaustive]pub struct RithmicOcoOrder {
pub legs: Vec<RithmicOcoOrderLeg>,
pub cancel_at_ssboe: Option<i32>,
pub cancel_at_usecs: Option<i32>,
pub cancel_after_secs: Option<i32>,
}Expand description
A group of OCO legs: when one fills, the others are cancelled.
§Example
use rithmic_rs::{OrderSide, OrderType, RithmicOcoOrder, RithmicOcoOrderLeg};
let take_profit = RithmicOcoOrderLeg::new()
.symbol("ESH6")
.exchange("CME")
.quantity(1)
.transaction_type(OrderSide::Sell)
.price_type(OrderType::Limit)
.price(5020.0)
.build()?;
let stop_loss = RithmicOcoOrderLeg::new()
.symbol("ESH6")
.exchange("CME")
.quantity(1)
.transaction_type(OrderSide::Sell)
.price_type(OrderType::StopMarket)
.trigger_price(4980.0)
.build()?;
let order = RithmicOcoOrder::new().legs([take_profit, stop_loss]).build()?;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.legs: Vec<RithmicOcoOrderLeg>The legs of the group, in the order they are sent.
cancel_at_ssboe: Option<i32>Cancel the group at this second-since-beginning-of-epoch value.
cancel_at_usecs: Option<i32>Microsecond component for cancel_at_ssboe.
cancel_after_secs: Option<i32>Cancel the group after this many seconds.
Implementations§
Source§impl RithmicOcoOrder
impl RithmicOcoOrder
Sourcepub fn leg(self, leg: RithmicOcoOrderLeg) -> Self
pub fn leg(self, leg: RithmicOcoOrderLeg) -> Self
Append one more leg.
Sourcepub fn legs(self, legs: impl IntoIterator<Item = RithmicOcoOrderLeg>) -> Self
pub fn legs(self, legs: impl IntoIterator<Item = RithmicOcoOrderLeg>) -> Self
Append several more legs.
Sourcepub fn cancel_at_ssboe(self, ssboe: i32) -> Self
pub fn cancel_at_ssboe(self, ssboe: i32) -> Self
Cancel the group at this second-since-beginning-of-epoch value.
Sourcepub fn cancel_at_usecs(self, usecs: i32) -> Self
pub fn cancel_at_usecs(self, usecs: i32) -> Self
Microsecond component of the cancel time.
Sourcepub fn cancel_after_secs(self, secs: i32) -> Self
pub fn cancel_after_secs(self, secs: i32) -> Self
Cancel the group after this many seconds.
Sourcepub fn validate(&self) -> Result<(), RithmicError>
pub fn validate(&self) -> Result<(), RithmicError>
Check every leg validates.
Sourcepub fn build(self) -> Result<Self, RithmicError>
pub fn build(self) -> Result<Self, RithmicError>
Validate and return the group. The leg count is not checked here; the handle refuses a group shorter than two legs.
Trait Implementations§
Source§impl Clone for RithmicOcoOrder
impl Clone for RithmicOcoOrder
Source§fn clone(&self) -> RithmicOcoOrder
fn clone(&self) -> RithmicOcoOrder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RithmicOcoOrder
impl Debug for RithmicOcoOrder
Source§impl Default for RithmicOcoOrder
impl Default for RithmicOcoOrder
Source§fn default() -> RithmicOcoOrder
fn default() -> RithmicOcoOrder
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RithmicOcoOrder
impl<'de> Deserialize<'de> for RithmicOcoOrder
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RithmicOcoOrder
impl PartialEq for RithmicOcoOrder
Source§impl Serialize for RithmicOcoOrder
impl Serialize for RithmicOcoOrder
impl StructuralPartialEq for RithmicOcoOrder
Auto Trait Implementations§
impl Freeze for RithmicOcoOrder
impl RefUnwindSafe for RithmicOcoOrder
impl Send for RithmicOcoOrder
impl Sync for RithmicOcoOrder
impl Unpin for RithmicOcoOrder
impl UnsafeUnpin for RithmicOcoOrder
impl UnwindSafe for RithmicOcoOrder
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
Mutably borrows from an owned value. Read more