pub struct RithmicOcoOrderLeg {
pub symbol: String,
pub exchange: String,
pub quantity: i32,
pub price: f64,
pub trigger_price: Option<f64>,
pub transaction_type: TransactionType,
pub duration: Duration,
pub price_type: PriceType,
pub user_tag: String,
}Expand description
One leg of an OCO (One-Cancels-Other) order pair.
When one leg fills, the other is automatically canceled.
§Example
ⓘ
use rithmic_rs::{RithmicOcoOrderLeg, OcoTransactionType, OcoDuration, OcoPriceType};
let take_profit = RithmicOcoOrderLeg {
symbol: "ESM5".to_string(),
exchange: "CME".to_string(),
quantity: 1,
price: 5020.0,
trigger_price: None,
transaction_type: OcoTransactionType::Sell,
duration: OcoDuration::Day,
price_type: OcoPriceType::Limit,
user_tag: "take-profit".to_string(),
};
let stop_loss = RithmicOcoOrderLeg {
symbol: "ESM5".to_string(),
exchange: "CME".to_string(),
quantity: 1,
price: 4980.0,
trigger_price: Some(4980.0),
transaction_type: OcoTransactionType::Sell,
duration: OcoDuration::Day,
price_type: OcoPriceType::StopMarket,
user_tag: "stop-loss".to_string(),
};
handle.place_oco_order(take_profit, stop_loss).await?;Fields§
§symbol: StringTrading symbol (e.g., “ESM5”)
exchange: StringExchange code (e.g., “CME”)
quantity: i32Number of contracts
price: f64Order price
trigger_price: Option<f64>Trigger price for stop orders (None for limit/market)
transaction_type: TransactionTypeBuy or Sell
duration: DurationOrder duration
price_type: PriceTypeOrder type
user_tag: StringYour identifier for this order
Trait Implementations§
Source§impl Clone for RithmicOcoOrderLeg
impl Clone for RithmicOcoOrderLeg
Source§fn clone(&self) -> RithmicOcoOrderLeg
fn clone(&self) -> RithmicOcoOrderLeg
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RithmicOcoOrderLeg
impl RefUnwindSafe for RithmicOcoOrderLeg
impl Send for RithmicOcoOrderLeg
impl Sync for RithmicOcoOrderLeg
impl Unpin for RithmicOcoOrderLeg
impl UnwindSafe for RithmicOcoOrderLeg
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