pub struct ProtoOaNewOrderReq {Show 23 fields
pub payload_type: Option<i32>,
pub ctid_trader_account_id: i64,
pub symbol_id: i64,
pub order_type: i32,
pub trade_side: i32,
pub volume: i64,
pub limit_price: Option<f64>,
pub stop_price: Option<f64>,
pub time_in_force: Option<i32>,
pub expiration_timestamp: Option<i64>,
pub stop_loss: Option<f64>,
pub take_profit: Option<f64>,
pub comment: Option<String>,
pub base_slippage_price: Option<f64>,
pub slippage_in_points: Option<i32>,
pub label: Option<String>,
pub position_id: Option<i64>,
pub client_order_id: Option<String>,
pub relative_stop_loss: Option<i64>,
pub relative_take_profit: Option<i64>,
pub guaranteed_stop_loss: Option<bool>,
pub trailing_stop_loss: Option<bool>,
pub stop_trigger_method: Option<i32>,
}Expand description
- Request for sending a new trading order. Allowed only if the accessToken has the “trade” permissions for the trading account.
Fields§
§payload_type: Option<i32>§ctid_trader_account_id: i64The unique identifier of the trader’s account in cTrader platform.
symbol_id: i64The unique identifier of a symbol in cTrader platform.
order_type: i32The type of an order - MARKET, LIMIT, STOP, MARKET_RANGE, STOP_LIMIT.
trade_side: i32The trade direction - BUY or SELL.
volume: i64The volume represented in 0.01 of a unit (e.g. 1000 in protocol means 10.00 units).
limit_price: Option<f64>The limit price, can be specified for the LIMIT order only.
stop_price: Option<f64>Stop Price, can be specified for the STOP and the STOP_LIMIT orders only.
time_in_force: Option<i32>The specific order execution or expiration instruction - GOOD_TILL_DATE, GOOD_TILL_CANCEL, IMMEDIATE_OR_CANCEL, FILL_OR_KILL, MARKET_ON_OPEN.
expiration_timestamp: Option<i64>The Unix time in milliseconds of Order expiration. Should be set for the Good Till Date orders.
stop_loss: Option<f64>The absolute Stop Loss price (1.23456 for example). Not supported for MARKET orders.
take_profit: Option<f64>The absolute Take Profit price (1.23456 for example). Unsupported for MARKET orders.
comment: Option<String>User-specified comment. MaxLength = 512.
base_slippage_price: Option<f64>Base price to calculate relative slippage price for MARKET_RANGE order.
slippage_in_points: Option<i32>Slippage distance for MARKET_RANGE and STOP_LIMIT order.
label: Option<String>User-specified label. MaxLength = 100.
position_id: Option<i64>Reference to the existing position if the Order is intended to modify it.
client_order_id: Option<String>Optional user-specific clientOrderId (similar to FIX ClOrderID). MaxLength = 50.
relative_stop_loss: Option<i64>Relative Stop Loss that can be specified instead of the absolute as one. Specified in 1/100000 of unit of a price. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782) For BUY stopLoss = entryPrice - relativeStopLoss, for SELL stopLoss = entryPrice + relativeStopLoss.
relative_take_profit: Option<i64>Relative Take Profit that can be specified instead of the absolute one. Specified in 1/100000 of unit of a price. (e.g. 123000 in protocol means 1.23, 53423782 means 534.23782) For BUY takeProfit = entryPrice + relativeTakeProfit, for SELL takeProfit = entryPrice - relativeTakeProfit.
guaranteed_stop_loss: Option<bool>If TRUE then stopLoss is guaranteed. Required to be set to TRUE for the Limited Risk accounts (ProtoOATrader.isLimitedRisk=true).
trailing_stop_loss: Option<bool>If TRUE then the Stop Loss is Trailing.
stop_trigger_method: Option<i32>Trigger method for the STOP or the STOP_LIMIT pending order.
Implementations§
Source§impl ProtoOaNewOrderReq
impl ProtoOaNewOrderReq
Sourcepub fn payload_type(&self) -> ProtoOaPayloadType
pub fn payload_type(&self) -> ProtoOaPayloadType
Returns the enum value of payload_type, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_payload_type(&mut self, value: ProtoOaPayloadType)
pub fn set_payload_type(&mut self, value: ProtoOaPayloadType)
Sets payload_type to the provided enum value.
Sourcepub fn order_type(&self) -> ProtoOaOrderType
pub fn order_type(&self) -> ProtoOaOrderType
Returns the enum value of order_type, or the default if the field is set to an invalid enum value.
Sourcepub fn set_order_type(&mut self, value: ProtoOaOrderType)
pub fn set_order_type(&mut self, value: ProtoOaOrderType)
Sets order_type to the provided enum value.
Sourcepub fn trade_side(&self) -> ProtoOaTradeSide
pub fn trade_side(&self) -> ProtoOaTradeSide
Returns the enum value of trade_side, or the default if the field is set to an invalid enum value.
Sourcepub fn set_trade_side(&mut self, value: ProtoOaTradeSide)
pub fn set_trade_side(&mut self, value: ProtoOaTradeSide)
Sets trade_side to the provided enum value.
Sourcepub fn limit_price(&self) -> f64
pub fn limit_price(&self) -> f64
Returns the value of limit_price, or the default value if limit_price is unset.
Sourcepub fn stop_price(&self) -> f64
pub fn stop_price(&self) -> f64
Returns the value of stop_price, or the default value if stop_price is unset.
Sourcepub fn time_in_force(&self) -> ProtoOaTimeInForce
pub fn time_in_force(&self) -> ProtoOaTimeInForce
Returns the enum value of time_in_force, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_time_in_force(&mut self, value: ProtoOaTimeInForce)
pub fn set_time_in_force(&mut self, value: ProtoOaTimeInForce)
Sets time_in_force to the provided enum value.
Sourcepub fn expiration_timestamp(&self) -> i64
pub fn expiration_timestamp(&self) -> i64
Returns the value of expiration_timestamp, or the default value if expiration_timestamp is unset.
Sourcepub fn stop_loss(&self) -> f64
pub fn stop_loss(&self) -> f64
Returns the value of stop_loss, or the default value if stop_loss is unset.
Sourcepub fn take_profit(&self) -> f64
pub fn take_profit(&self) -> f64
Returns the value of take_profit, or the default value if take_profit is unset.
Sourcepub fn comment(&self) -> &str
pub fn comment(&self) -> &str
Returns the value of comment, or the default value if comment is unset.
Sourcepub fn base_slippage_price(&self) -> f64
pub fn base_slippage_price(&self) -> f64
Returns the value of base_slippage_price, or the default value if base_slippage_price is unset.
Sourcepub fn slippage_in_points(&self) -> i32
pub fn slippage_in_points(&self) -> i32
Returns the value of slippage_in_points, or the default value if slippage_in_points is unset.
Sourcepub fn label(&self) -> &str
pub fn label(&self) -> &str
Returns the value of label, or the default value if label is unset.
Sourcepub fn position_id(&self) -> i64
pub fn position_id(&self) -> i64
Returns the value of position_id, or the default value if position_id is unset.
Sourcepub fn client_order_id(&self) -> &str
pub fn client_order_id(&self) -> &str
Returns the value of client_order_id, or the default value if client_order_id is unset.
Sourcepub fn relative_stop_loss(&self) -> i64
pub fn relative_stop_loss(&self) -> i64
Returns the value of relative_stop_loss, or the default value if relative_stop_loss is unset.
Sourcepub fn relative_take_profit(&self) -> i64
pub fn relative_take_profit(&self) -> i64
Returns the value of relative_take_profit, or the default value if relative_take_profit is unset.
Sourcepub fn guaranteed_stop_loss(&self) -> bool
pub fn guaranteed_stop_loss(&self) -> bool
Returns the value of guaranteed_stop_loss, or the default value if guaranteed_stop_loss is unset.
Sourcepub fn trailing_stop_loss(&self) -> bool
pub fn trailing_stop_loss(&self) -> bool
Returns the value of trailing_stop_loss, or the default value if trailing_stop_loss is unset.
Sourcepub fn stop_trigger_method(&self) -> ProtoOaOrderTriggerMethod
pub fn stop_trigger_method(&self) -> ProtoOaOrderTriggerMethod
Returns the enum value of stop_trigger_method, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_stop_trigger_method(&mut self, value: ProtoOaOrderTriggerMethod)
pub fn set_stop_trigger_method(&mut self, value: ProtoOaOrderTriggerMethod)
Sets stop_trigger_method to the provided enum value.
Trait Implementations§
Source§impl Clone for ProtoOaNewOrderReq
impl Clone for ProtoOaNewOrderReq
Source§fn clone(&self) -> ProtoOaNewOrderReq
fn clone(&self) -> ProtoOaNewOrderReq
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtoOaNewOrderReq
impl Debug for ProtoOaNewOrderReq
Source§impl Default for ProtoOaNewOrderReq
impl Default for ProtoOaNewOrderReq
Source§impl<'de> Deserialize<'de> for ProtoOaNewOrderReq
impl<'de> Deserialize<'de> for ProtoOaNewOrderReq
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>,
Source§impl Message for ProtoOaNewOrderReq
impl Message for ProtoOaNewOrderReq
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.