pub struct MarketOrderRequest {
pub instrument: InstrumentName,
pub units: DecimalNumber,
pub time_in_force: Option<MarketOrderTimeInForce>,
pub price_bound: Option<PriceValue>,
pub position_fill: Option<OrderPositionFill>,
pub client_extensions: Option<ClientExtensions>,
pub take_profit_on_fill: Option<TakeProfitDetails>,
pub stop_loss_on_fill: Option<StopLossDetails>,
pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>,
pub trade_client_extensions: Option<ClientExtensions>,
}Expand description
Specification of a market order. Required fields are set by
MarketOrderRequest::new; everything else is optional.
Fields§
§instrument: InstrumentNameThe market order’s instrument.
units: DecimalNumberThe quantity requested to be filled. A positive number creates a long order, a negative number a short order.
time_in_force: Option<MarketOrderTimeInForce>The time-in-force for the order (default FOK).
price_bound: Option<PriceValue>The worst price the client is willing to have the order filled at.
position_fill: Option<OrderPositionFill>How positions in the account are modified when the order fills
(default DEFAULT).
client_extensions: Option<ClientExtensions>The client extensions to add to the order.
take_profit_on_fill: Option<TakeProfitDetails>A take-profit order to create for a trade opened when the order fills.
stop_loss_on_fill: Option<StopLossDetails>A stop-loss order to create for a trade opened when the order fills.
trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>A trailing stop-loss order to create for a trade opened when the order fills.
trade_client_extensions: Option<ClientExtensions>The client extensions to add to a trade opened when the order fills.
Implementations§
Source§impl MarketOrderRequest
impl MarketOrderRequest
Sourcepub fn new(
instrument: impl Into<InstrumentName>,
units: impl Into<DecimalNumber>,
) -> Self
pub fn new( instrument: impl Into<InstrumentName>, units: impl Into<DecimalNumber>, ) -> Self
A market order for units of instrument (positive units = long,
negative = short).
Sourcepub fn time_in_force(self, value: impl Into<MarketOrderTimeInForce>) -> Self
pub fn time_in_force(self, value: impl Into<MarketOrderTimeInForce>) -> Self
Sets the time-in-force (default FOK).
Sourcepub fn price_bound(self, value: impl Into<PriceValue>) -> Self
pub fn price_bound(self, value: impl Into<PriceValue>) -> Self
Sets the worst acceptable fill price.
Sourcepub fn position_fill(self, value: impl Into<OrderPositionFill>) -> Self
pub fn position_fill(self, value: impl Into<OrderPositionFill>) -> Self
Sets how positions are modified on fill (default DEFAULT).
Sourcepub fn client_extensions(self, value: impl Into<ClientExtensions>) -> Self
pub fn client_extensions(self, value: impl Into<ClientExtensions>) -> Self
Attaches client extensions to the order.
Sourcepub fn take_profit_on_fill(self, value: impl Into<TakeProfitDetails>) -> Self
pub fn take_profit_on_fill(self, value: impl Into<TakeProfitDetails>) -> Self
Attaches a take-profit to the trade opened on fill.
Sourcepub fn stop_loss_on_fill(self, value: impl Into<StopLossDetails>) -> Self
pub fn stop_loss_on_fill(self, value: impl Into<StopLossDetails>) -> Self
Attaches a stop-loss to the trade opened on fill.
Sourcepub fn trailing_stop_loss_on_fill(
self,
value: impl Into<TrailingStopLossDetails>,
) -> Self
pub fn trailing_stop_loss_on_fill( self, value: impl Into<TrailingStopLossDetails>, ) -> Self
Attaches a trailing stop-loss to the trade opened on fill.
Sourcepub fn trade_client_extensions(self, value: impl Into<ClientExtensions>) -> Self
pub fn trade_client_extensions(self, value: impl Into<ClientExtensions>) -> Self
Attaches client extensions to the trade opened on fill.
Trait Implementations§
Source§impl Clone for MarketOrderRequest
impl Clone for MarketOrderRequest
Source§fn clone(&self) -> MarketOrderRequest
fn clone(&self) -> MarketOrderRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more