pub struct StopLossOrderRequest {
pub trade_id: TradeId,
pub client_trade_id: Option<ClientId>,
pub price: Option<PriceValue>,
pub distance: Option<DecimalNumber>,
pub time_in_force: Option<StopLossOrderTimeInForce>,
pub gtd_time: Option<DateTime>,
pub trigger_condition: Option<OrderTriggerCondition>,
pub guaranteed: Option<bool>,
pub client_extensions: Option<ClientExtensions>,
}Expand description
Specification of a stop-loss order attached to an existing trade.
Exactly one of price or distance must be set (see
StopLossOrderRequest::at_price and
StopLossOrderRequest::at_distance).
Fields§
§trade_id: TradeIdThe ID of the trade to close when the order is filled.
client_trade_id: Option<ClientId>The client ID of the trade to be closed when the order is filled.
price: Option<PriceValue>The price threshold: the associated trade will be closed by a market price that is equal to or worse than this threshold.
distance: Option<DecimalNumber>The distance (in price units) from the trade’s open price to use as
the stop-loss price instead of an absolute price.
time_in_force: Option<StopLossOrderTimeInForce>The time-in-force for the order (default GTC).
gtd_time: Option<DateTime>The date/time when the order is cancelled if time_in_force is
GTD.
trigger_condition: Option<OrderTriggerCondition>Which price component is used to trigger the order (default
DEFAULT).
guaranteed: Option<bool>Deprecated: whether the order is guaranteed (only allowed when the
account’s guaranteedStopLossOrderMode permits it).
client_extensions: Option<ClientExtensions>The client extensions to add to the order.
Implementations§
Source§impl StopLossOrderRequest
impl StopLossOrderRequest
Sourcepub fn at_price(
trade_id: impl Into<TradeId>,
price: impl Into<PriceValue>,
) -> Self
pub fn at_price( trade_id: impl Into<TradeId>, price: impl Into<PriceValue>, ) -> Self
A stop-loss order closing trade_id at the absolute price
threshold price.
Sourcepub fn at_distance(
trade_id: impl Into<TradeId>,
distance: impl Into<DecimalNumber>,
) -> Self
pub fn at_distance( trade_id: impl Into<TradeId>, distance: impl Into<DecimalNumber>, ) -> Self
A stop-loss order closing trade_id at distance price units from
the trade’s open price.
Sourcepub fn client_trade_id(self, value: impl Into<ClientId>) -> Self
pub fn client_trade_id(self, value: impl Into<ClientId>) -> Self
Targets the trade by its client-provided ID instead.
Sourcepub fn time_in_force(self, value: impl Into<StopLossOrderTimeInForce>) -> Self
pub fn time_in_force(self, value: impl Into<StopLossOrderTimeInForce>) -> Self
Sets the time-in-force (default GTC).
Sourcepub fn gtd_time(self, value: impl Into<DateTime>) -> Self
pub fn gtd_time(self, value: impl Into<DateTime>) -> Self
Sets the cancellation time used with GTD.
Sourcepub fn trigger_condition(self, value: impl Into<OrderTriggerCondition>) -> Self
pub fn trigger_condition(self, value: impl Into<OrderTriggerCondition>) -> Self
Sets the price component used for triggering.
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.
Trait Implementations§
Source§impl Clone for StopLossOrderRequest
impl Clone for StopLossOrderRequest
Source§fn clone(&self) -> StopLossOrderRequest
fn clone(&self) -> StopLossOrderRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more