#[non_exhaustive]pub struct RithmicOcoOrderLeg {Show 13 fields
pub symbol: String,
pub exchange: String,
pub quantity: i32,
pub price: Option<f64>,
pub trigger_price: Option<f64>,
pub transaction_type: OrderSide,
pub duration: TimeInForce,
pub price_type: OrderType,
pub user_tag: String,
pub trailing_stop: Option<TrailingStop>,
pub trade_route: Option<String>,
pub manual_or_auto: ManualOrAutoEntry,
pub window_name: Option<String>,
}Expand description
One leg of an OCO (One-Cancels-Other) order group.
§Example
use rithmic_rs::{OrderSide, OrderType, RithmicOcoOrderLeg};
let take_profit = RithmicOcoOrderLeg::new()
.symbol("ESH6")
.exchange("CME")
.quantity(1)
.transaction_type(OrderSide::Sell)
.price_type(OrderType::Limit)
.price(5020.0)
.user_tag("take-profit")
.build()?;Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.symbol: StringTrading symbol (e.g., “ESH6”)
exchange: StringExchange code (e.g., “CME”)
quantity: i32Number of contracts
price: Option<f64>Leg price. A market leg does not need one.
trigger_price: Option<f64>Trigger price. Only a stop leg needs one.
transaction_type: OrderSideBuy or Sell
duration: TimeInForceOrder duration
price_type: OrderTypeOrder type. Template 328 declares no if-touched price type, so
OrderType::MarketIfTouched and OrderType::LimitIfTouched are
rejected on an OCO leg.
user_tag: StringYour identifier for this order
trailing_stop: Option<TrailingStop>Optional trailing stop configuration for this leg
trade_route: Option<String>Route to send on. None uses the route the server published for this
leg’s exchange.
manual_or_auto: ManualOrAutoEntryWhether the leg was placed by a human or automatically.
window_name: Option<String>Originating window name reported to Rithmic. window_name is repeated
on RequestOcoOrder, so it is per-leg like the other leg fields.
Implementations§
Source§impl RithmicOcoOrderLeg
impl RithmicOcoOrderLeg
Sourcepub fn transaction_type(self, transaction_type: OrderSide) -> Self
pub fn transaction_type(self, transaction_type: OrderSide) -> Self
Buy or sell.
Sourcepub fn price_type(self, price_type: OrderType) -> Self
pub fn price_type(self, price_type: OrderType) -> Self
Market, limit, or stop.
Sourcepub fn trigger_price(self, trigger_price: f64) -> Self
pub fn trigger_price(self, trigger_price: f64) -> Self
Trigger price for stop order types.
Sourcepub fn duration(self, duration: TimeInForce) -> Self
pub fn duration(self, duration: TimeInForce) -> Self
How long the leg stays working.
Sourcepub fn trailing_stop(self, trailing_stop: TrailingStop) -> Self
pub fn trailing_stop(self, trailing_stop: TrailingStop) -> Self
Trailing stop configuration for this leg.
Sourcepub fn trailing_stop_by(
self,
trail_by_ticks: i32,
trail_by_price_id: i32,
) -> Self
pub fn trailing_stop_by( self, trail_by_ticks: i32, trail_by_price_id: i32, ) -> Self
Trail by trail_by_ticks against Rithmic’s trail_by_price_id.
Sourcepub fn trade_route(self, trade_route: impl Into<String>) -> Self
pub fn trade_route(self, trade_route: impl Into<String>) -> Self
Route to send on, overriding the route published for the exchange.
Sourcepub fn manual_or_auto(self, manual_or_auto: ManualOrAutoEntry) -> Self
pub fn manual_or_auto(self, manual_or_auto: ManualOrAutoEntry) -> Self
Whether this was done by a human or automatically.
Sourcepub fn window_name(self, window_name: impl Into<String>) -> Self
pub fn window_name(self, window_name: impl Into<String>) -> Self
Window name to report this leg under.
Sourcepub fn validate(&self) -> Result<(), RithmicError>
pub fn validate(&self) -> Result<(), RithmicError>
Requires a symbol, an exchange, a positive quantity, and the prices
the Self::price_type needs. An OCO leg cannot be if-touched. An
embedded trailing stop is not re-validated.
Sourcepub fn build(self) -> Result<Self, RithmicError>
pub fn build(self) -> Result<Self, RithmicError>
Requires an instrument and the prices the price type needs.
Trait Implementations§
Source§impl Clone for RithmicOcoOrderLeg
impl Clone for RithmicOcoOrderLeg
Source§fn clone(&self) -> RithmicOcoOrderLeg
fn clone(&self) -> RithmicOcoOrderLeg
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more