#[non_exhaustive]pub struct RithmicOrder {Show 19 fields
pub symbol: String,
pub exchange: String,
pub quantity: i32,
pub price: Option<f64>,
pub transaction_type: OrderSide,
pub price_type: OrderType,
pub user_tag: String,
pub duration: TimeInForce,
pub trigger_price: Option<f64>,
pub trailing_stop: Option<TrailingStop>,
pub trade_route: Option<String>,
pub manual_or_auto: ManualOrAutoEntry,
pub window_name: Option<String>,
pub release_at_ssboe: Option<i32>,
pub release_at_usecs: Option<i32>,
pub cancel_at_ssboe: Option<i32>,
pub cancel_at_usecs: Option<i32>,
pub cancel_after_secs: Option<i32>,
pub if_touched: Option<RithmicIfTouchedTrigger>,
}Expand description
A standalone order (not a bracket order).
For orders with automatic profit targets and stop losses, use
RithmicBracketOrder instead.
§Example: limit order
use rithmic_rs::{OrderSide, OrderType, RithmicOrder};
let order = RithmicOrder::new()
.symbol("ESH6")
.exchange("CME")
.quantity(1)
.transaction_type(OrderSide::Buy)
.price_type(OrderType::Limit)
.price(5000.0)
.user_tag("my-order-1")
.build()?;§Example: market order
A market order has no price. Leaving price unset omits the field rather
than pricing the order at zero.
use rithmic_rs::{OrderSide, OrderType, RithmicOrder};
let order = RithmicOrder::new()
.symbol("ESH6")
.exchange("CME")
.quantity(1)
.transaction_type(OrderSide::Buy)
.price_type(OrderType::Market)
.user_tag("market-order")
.build()?;
assert_eq!(order.price, None);§Example: stop-limit with a trailing stop
use rithmic_rs::{OrderSide, OrderType, RithmicOrder};
let order = RithmicOrder::new()
.symbol("ESH6")
.exchange("CME")
.quantity(1)
.transaction_type(OrderSide::Sell)
.price_type(OrderType::StopLimit)
.price(4980.0)
.trigger_price(4985.0)
.trailing_stop_by(20, 1)
.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>Order price. A market order does not need one.
transaction_type: OrderSideBuy or Sell
price_type: OrderTypeOrder type (Limit, Market, StopLimit, StopMarket, etc.)
user_tag: StringYour identifier for tracking this order
duration: TimeInForceOrder duration
trigger_price: Option<f64>Trigger price. Only a stop or if-touched order needs one.
trailing_stop: Option<TrailingStop>Trailing stop configuration
trade_route: Option<String>Route to send on. None uses the route the server published for exchange.
manual_or_auto: ManualOrAutoEntryWhether the order was placed by a human or automatically.
window_name: Option<String>Originating window name reported to Rithmic.
release_at_ssboe: Option<i32>Release the order at this second-since-beginning-of-epoch value.
release_at_usecs: Option<i32>Microsecond component for Self::release_at_ssboe.
cancel_at_ssboe: Option<i32>Cancel the order at this second-since-beginning-of-epoch value.
cancel_at_usecs: Option<i32>Microsecond component for Self::cancel_at_ssboe.
cancel_after_secs: Option<i32>Cancel the order after this many seconds.
if_touched: Option<RithmicIfTouchedTrigger>Conditional trigger that releases this order once touched.
Implementations§
Source§impl RithmicOrder
impl RithmicOrder
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, stop, or if-touched.
Sourcepub fn trigger_price(self, trigger_price: f64) -> Self
pub fn trigger_price(self, trigger_price: f64) -> Self
Trigger price for stop and if-touched order types.
Sourcepub fn duration(self, duration: TimeInForce) -> Self
pub fn duration(self, duration: TimeInForce) -> Self
How long the order stays working.
Sourcepub fn trailing_stop(self, trailing_stop: TrailingStop) -> Self
pub fn trailing_stop(self, trailing_stop: TrailingStop) -> Self
Trailing stop configuration.
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 order under.
Sourcepub fn release_at_ssboe(self, ssboe: i32) -> Self
pub fn release_at_ssboe(self, ssboe: i32) -> Self
Release the order at this second-since-beginning-of-epoch value.
Sourcepub fn release_at_usecs(self, usecs: i32) -> Self
pub fn release_at_usecs(self, usecs: i32) -> Self
Microsecond component of the release time.
Sourcepub fn release_at(self, ssboe: i32, usecs: i32) -> Self
pub fn release_at(self, ssboe: i32, usecs: i32) -> Self
Set both halves of the release time.
Sourcepub fn cancel_at_ssboe(self, ssboe: i32) -> Self
pub fn cancel_at_ssboe(self, ssboe: i32) -> Self
Cancel the order 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 order after this many seconds.
Sourcepub fn if_touched(self, if_touched: RithmicIfTouchedTrigger) -> Self
pub fn if_touched(self, if_touched: RithmicIfTouchedTrigger) -> Self
Conditional trigger that releases this order once touched.
Sourcepub fn validate(&self) -> Result<(), RithmicError>
pub fn validate(&self) -> Result<(), RithmicError>
Check the order names an instrument (symbol, exchange, a positive
quantity) and carries the prices its Self::price_type requires:
Limit, StopLimit and LimitIfTouched need Self::price;
StopMarket, StopLimit, MarketIfTouched and LimitIfTouched need
Self::trigger_price. Market needs neither. An embedded
TrailingStop or RithmicIfTouchedTrigger is deliberately not
re-validated — build() on those types is the opt-in strict path.
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 RithmicOrder
impl Clone for RithmicOrder
Source§fn clone(&self) -> RithmicOrder
fn clone(&self) -> RithmicOrder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more