pub struct OrderRequest {
pub symbol: String,
pub quantity: f64,
pub price: Option<f64>,
pub stop_price: Option<f64>,
pub side: OrderSide,
pub order_type: OrderType,
pub time_in_force: TimeInForce,
pub extended_hours: bool,
pub trailing_type: Option<TrailingStopType>,
pub trailing_stop_step: Option<f64>,
pub client_order_id: Option<String>,
pub instrument_id: Option<String>,
}Expand description
Request to place an order.
Fields§
§symbol: StringSymbol of the security
quantity: f64Quantity of shares
price: Option<f64>Price of the order (for limit orders)
stop_price: Option<f64>Stop price (for stop orders)
side: OrderSideOrder side (buy/sell)
order_type: OrderTypeOrder type
time_in_force: TimeInForceTime in force
extended_hours: boolWhether the order is for extended hours trading
trailing_type: Option<TrailingStopType>Trailing stop type (for trailing stop orders)
trailing_stop_step: Option<f64>Trailing stop step (for trailing stop orders)
client_order_id: Option<String>Client order ID (for tracking purposes)
instrument_id: Option<String>Instrument ID (alternative to symbol)
Implementations§
Source§impl OrderRequest
impl OrderRequest
Sourcepub fn stop_price(self, stop_price: f64) -> Self
pub fn stop_price(self, stop_price: f64) -> Self
Set the stop price.
Sourcepub fn order_type(self, order_type: OrderType) -> Self
pub fn order_type(self, order_type: OrderType) -> Self
Set the order type.
Sourcepub fn time_in_force(self, time_in_force: TimeInForce) -> Self
pub fn time_in_force(self, time_in_force: TimeInForce) -> Self
Set the time in force.
Sourcepub fn extended_hours(self, extended_hours: bool) -> Self
pub fn extended_hours(self, extended_hours: bool) -> Self
Set whether the order is for extended hours trading.
Sourcepub fn trailing_type(self, trailing_type: TrailingStopType) -> Self
pub fn trailing_type(self, trailing_type: TrailingStopType) -> Self
Set the trailing stop type.
Sourcepub fn trailing_stop_step(self, trailing_stop_step: f64) -> Self
pub fn trailing_stop_step(self, trailing_stop_step: f64) -> Self
Set the trailing stop step.
Sourcepub fn client_order_id(self, client_order_id: impl Into<String>) -> Self
pub fn client_order_id(self, client_order_id: impl Into<String>) -> Self
Set the client order ID.
Sourcepub fn instrument_id(self, instrument_id: impl Into<String>) -> Self
pub fn instrument_id(self, instrument_id: impl Into<String>) -> Self
Set the instrument ID.
Sourcepub fn stop_limit() -> Self
pub fn stop_limit() -> Self
Create a stop limit order.
Sourcepub fn trailing_stop() -> Self
pub fn trailing_stop() -> Self
Create a trailing stop order.
Sourcepub fn trailing_stop_limit() -> Self
pub fn trailing_stop_limit() -> Self
Create a trailing stop limit order.
Trait Implementations§
Source§impl Clone for OrderRequest
impl Clone for OrderRequest
Source§fn clone(&self) -> OrderRequest
fn clone(&self) -> OrderRequest
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 moreSource§impl Debug for OrderRequest
impl Debug for OrderRequest
Source§impl Default for OrderRequest
impl Default for OrderRequest
Source§impl<'de> Deserialize<'de> for OrderRequest
impl<'de> Deserialize<'de> for OrderRequest
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
Auto Trait Implementations§
impl Freeze for OrderRequest
impl RefUnwindSafe for OrderRequest
impl Send for OrderRequest
impl Sync for OrderRequest
impl Unpin for OrderRequest
impl UnwindSafe for OrderRequest
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