pub struct ProtoOaPosition {Show 16 fields
pub position_id: i64,
pub trade_data: ProtoOaTradeData,
pub position_status: i32,
pub swap: i64,
pub price: Option<f64>,
pub stop_loss: Option<f64>,
pub take_profit: Option<f64>,
pub utc_last_update_timestamp: Option<i64>,
pub commission: Option<i64>,
pub margin_rate: Option<f64>,
pub mirroring_commission: Option<i64>,
pub guaranteed_stop_loss: Option<bool>,
pub used_margin: Option<u64>,
pub stop_loss_trigger_method: Option<i32>,
pub money_digits: Option<u32>,
pub trailing_stop_loss: Option<bool>,
}Expand description
- Trade position entity.
Fields§
§position_id: i64The unique ID of the position. Note: trader might have two positions with the same id if positions are taken from accounts from different brokers.
trade_data: ProtoOaTradeDataPosition details. See ProtoOATradeData for details.
position_status: i32Current status of the position.
swap: i64Total amount of charged swap on open position.
price: Option<f64>VWAP price of the position based on all executions (orders) linked to the position.
stop_loss: Option<f64>Current stop loss price.
take_profit: Option<f64>Current take profit price.
utc_last_update_timestamp: Option<i64>The Unix time in milliseconds of the last change of the position, including amend SL/TP of the position, execution of related order, cancel or related order, etc.
commission: Option<i64>Current unrealized commission related to the position.
margin_rate: Option<f64>Rate for used margin computation. Represented as Base/Deposit.
mirroring_commission: Option<i64>Amount of unrealized commission related to following of strategy provider.
guaranteed_stop_loss: Option<bool>If TRUE then position’s stop loss is guaranteedStopLoss.
used_margin: Option<u64>Amount of margin used for the position in deposit currency.
stop_loss_trigger_method: Option<i32>Stop trigger method for SL/TP of the position.
money_digits: Option<u32>Specifies the exponent of the monetary values. E.g. moneyDigits = 8 must be interpret as business value multiplied by 10^8, then real balance would be 10053099944 / 10^8 = 100.53099944. Affects swap, commission, mirroringCommission, usedMargin.
trailing_stop_loss: Option<bool>If TRUE then the Trailing Stop Loss is applied.
Implementations§
Source§impl ProtoOaPosition
impl ProtoOaPosition
Sourcepub fn position_status(&self) -> ProtoOaPositionStatus
pub fn position_status(&self) -> ProtoOaPositionStatus
Returns the enum value of position_status, or the default if the field is set to an invalid enum value.
Sourcepub fn set_position_status(&mut self, value: ProtoOaPositionStatus)
pub fn set_position_status(&mut self, value: ProtoOaPositionStatus)
Sets position_status to the provided enum value.
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 utc_last_update_timestamp(&self) -> i64
pub fn utc_last_update_timestamp(&self) -> i64
Returns the value of utc_last_update_timestamp, or the default value if utc_last_update_timestamp is unset.
Sourcepub fn commission(&self) -> i64
pub fn commission(&self) -> i64
Returns the value of commission, or the default value if commission is unset.
Sourcepub fn margin_rate(&self) -> f64
pub fn margin_rate(&self) -> f64
Returns the value of margin_rate, or the default value if margin_rate is unset.
Sourcepub fn mirroring_commission(&self) -> i64
pub fn mirroring_commission(&self) -> i64
Returns the value of mirroring_commission, or the default value if mirroring_commission 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 used_margin(&self) -> u64
pub fn used_margin(&self) -> u64
Returns the value of used_margin, or the default value if used_margin is unset.
Sourcepub fn stop_loss_trigger_method(&self) -> ProtoOaOrderTriggerMethod
pub fn stop_loss_trigger_method(&self) -> ProtoOaOrderTriggerMethod
Returns the enum value of stop_loss_trigger_method, or the default if the field is unset or set to an invalid enum value.
Sourcepub fn set_stop_loss_trigger_method(&mut self, value: ProtoOaOrderTriggerMethod)
pub fn set_stop_loss_trigger_method(&mut self, value: ProtoOaOrderTriggerMethod)
Sets stop_loss_trigger_method to the provided enum value.
Sourcepub fn money_digits(&self) -> u32
pub fn money_digits(&self) -> u32
Returns the value of money_digits, or the default value if money_digits 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.
Trait Implementations§
Source§impl Clone for ProtoOaPosition
impl Clone for ProtoOaPosition
Source§fn clone(&self) -> ProtoOaPosition
fn clone(&self) -> ProtoOaPosition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtoOaPosition
impl Debug for ProtoOaPosition
Source§impl Default for ProtoOaPosition
impl Default for ProtoOaPosition
Source§impl<'de> Deserialize<'de> for ProtoOaPosition
impl<'de> Deserialize<'de> for ProtoOaPosition
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 ProtoOaPosition
impl Message for ProtoOaPosition
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.