Struct fxoanda::TradeSummary

source ·
pub struct TradeSummary {
Show 19 fields pub stop_loss_order_id: Option<String>, pub financing: Option<f32>, pub open_time: Option<DateTime<Utc>>, pub margin_used: Option<f32>, pub trailing_stop_loss_order_id: Option<String>, pub price: Option<f32>, pub unrealized_pl: Option<f32>, pub realized_pl: Option<f32>, pub close_time: Option<DateTime<Utc>>, pub instrument: Option<String>, pub state: Option<String>, pub take_profit_order_id: Option<String>, pub initial_margin_required: Option<f32>, pub initial_units: Option<f32>, pub average_close_price: Option<f32>, pub current_units: Option<f32>, pub closing_transaction_i_ds: Option<Vec<String>>, pub client_extensions: Option<ClientExtensions>, pub id: Option<String>,
}

Fields§

§stop_loss_order_id: Option<String>

ID of the Trade’s Stop Loss Order, only provided if such an Order exists. format: The string representation of the OANDA-assigned OrderID. OANDA- assigned OrderIDs are positive integers, and are derived from the TransactionID of the Transaction that created the Order.

§financing: Option<f32>

The financing paid/collected for this Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

§open_time: Option<DateTime<Utc>>

The date/time when the Trade was opened. format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).

§margin_used: Option<f32>

Margin currently used by the Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

§trailing_stop_loss_order_id: Option<String>

ID of the Trade’s Trailing Stop Loss Order, only provided if such an Order exists. format: The string representation of the OANDA-assigned OrderID. OANDA- assigned OrderIDs are positive integers, and are derived from the TransactionID of the Transaction that created the Order.

§price: Option<f32>

The execution price of the Trade. format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.

§unrealized_pl: Option<f32>

The unrealized profit/loss on the open portion of the Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

§realized_pl: Option<f32>

The total profit/loss realized on the closed portion of the Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

§close_time: Option<DateTime<Utc>>

The date/time when the Trade was fully closed. Only provided for Trades whose state is CLOSED. format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).

§instrument: Option<String>

The Trade’s Instrument. format: A string containing the base currency and quote currency delimited by a “_”.

§state: Option<String>

The current state of the Trade.

§take_profit_order_id: Option<String>

ID of the Trade’s Take Profit Order, only provided if such an Order exists. format: The string representation of the OANDA-assigned OrderID. OANDA- assigned OrderIDs are positive integers, and are derived from the TransactionID of the Transaction that created the Order.

§initial_margin_required: Option<f32>

The margin required at the time the Trade was created. Note, this is the ‘pure’ margin required, it is not the ‘effective’ margin used that factors in the trade risk if a GSLO is attached to the trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

§initial_units: Option<f32>

The initial size of the Trade. Negative values indicate a short Trade, and positive values indicate a long Trade. format: A decimal number encoded as a string. The amount of precision provided depends on what the number represents.

§average_close_price: Option<f32>

The average closing price of the Trade. Only present if the Trade has been closed or reduced at least once. format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.

§current_units: Option<f32>

The number of units currently open for the Trade. This value is reduced to 0.0 as the Trade is closed. format: A decimal number encoded as a string. The amount of precision provided depends on what the number represents.

§closing_transaction_i_ds: Option<Vec<String>>

The IDs of the Transactions that have closed portions of this Trade.

§client_extensions: Option<ClientExtensions>

A ClientExtensions object allows a client to attach a clientID, tag and comment to Orders and Trades in their Account. Do not set, modify, or delete this field if your account is associated with MT4.

§id: Option<String>

The Trade’s identifier, unique within the Trade’s Account. format: The string representation of the OANDA-assigned TradeID. OANDA- assigned TradeIDs are positive integers, and are derived from the TransactionID of the Transaction that opened the Trade.

Implementations§

source§

impl TradeSummary

source

pub fn new() -> TradeSummary

source

pub fn with_stop_loss_order_id(self, x: String) -> TradeSummary

ID of the Trade’s Stop Loss Order, only provided if such an Order exists. format: The string representation of the OANDA-assigned OrderID. OANDA- assigned OrderIDs are positive integers, and are derived from the TransactionID of the Transaction that created the Order.

  • param String
  • return TradeSummary
source

pub fn with_financing(self, x: f32) -> TradeSummary

The financing paid/collected for this Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

  • param f32
  • return TradeSummary
source

pub fn with_open_time(self, x: DateTime<Utc>) -> TradeSummary

The date/time when the Trade was opened. format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).

  • param DateTime
  • return TradeSummary
source

pub fn with_margin_used(self, x: f32) -> TradeSummary

Margin currently used by the Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

  • param f32
  • return TradeSummary
source

pub fn with_trailing_stop_loss_order_id(self, x: String) -> TradeSummary

ID of the Trade’s Trailing Stop Loss Order, only provided if such an Order exists. format: The string representation of the OANDA-assigned OrderID. OANDA- assigned OrderIDs are positive integers, and are derived from the TransactionID of the Transaction that created the Order.

  • param String
  • return TradeSummary
source

pub fn with_price(self, x: f32) -> TradeSummary

The execution price of the Trade. format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.

  • param f32
  • return TradeSummary
source

pub fn with_unrealized_pl(self, x: f32) -> TradeSummary

The unrealized profit/loss on the open portion of the Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

  • param f32
  • return TradeSummary
source

pub fn with_realized_pl(self, x: f32) -> TradeSummary

The total profit/loss realized on the closed portion of the Trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

  • param f32
  • return TradeSummary
source

pub fn with_close_time(self, x: DateTime<Utc>) -> TradeSummary

The date/time when the Trade was fully closed. Only provided for Trades whose state is CLOSED. format: The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places).

  • param DateTime
  • return TradeSummary
source

pub fn with_instrument(self, x: String) -> TradeSummary

The Trade’s Instrument. format: A string containing the base currency and quote currency delimited by a “_”.

  • param String
  • return TradeSummary
source

pub fn with_state(self, x: String) -> TradeSummary

The current state of the Trade.

  • param String
  • return TradeSummary
source

pub fn with_take_profit_order_id(self, x: String) -> TradeSummary

ID of the Trade’s Take Profit Order, only provided if such an Order exists. format: The string representation of the OANDA-assigned OrderID. OANDA- assigned OrderIDs are positive integers, and are derived from the TransactionID of the Transaction that created the Order.

  • param String
  • return TradeSummary
source

pub fn with_initial_margin_required(self, x: f32) -> TradeSummary

The margin required at the time the Trade was created. Note, this is the ‘pure’ margin required, it is not the ‘effective’ margin used that factors in the trade risk if a GSLO is attached to the trade. format: A decimal number encoded as a string. The amount of precision provided depends on the Account’s home currency.

  • param f32
  • return TradeSummary
source

pub fn with_initial_units(self, x: f32) -> TradeSummary

The initial size of the Trade. Negative values indicate a short Trade, and positive values indicate a long Trade. format: A decimal number encoded as a string. The amount of precision provided depends on what the number represents.

  • param f32
  • return TradeSummary
source

pub fn with_average_close_price(self, x: f32) -> TradeSummary

The average closing price of the Trade. Only present if the Trade has been closed or reduced at least once. format: A decimal number encodes as a string. The amount of precision provided depends on the Instrument.

  • param f32
  • return TradeSummary
source

pub fn with_current_units(self, x: f32) -> TradeSummary

The number of units currently open for the Trade. This value is reduced to 0.0 as the Trade is closed. format: A decimal number encoded as a string. The amount of precision provided depends on what the number represents.

  • param f32
  • return TradeSummary
source

pub fn with_closing_transaction_i_ds(self, x: Vec<String>) -> TradeSummary

The IDs of the Transactions that have closed portions of this Trade.

  • param Vec
  • return TradeSummary
source

pub fn with_client_extensions(self, x: ClientExtensions) -> TradeSummary

A ClientExtensions object allows a client to attach a clientID, tag and comment to Orders and Trades in their Account. Do not set, modify, or delete this field if your account is associated with MT4.

  • param ClientExtensions
  • return TradeSummary
source

pub fn with_id(self, x: String) -> TradeSummary

The Trade’s identifier, unique within the Trade’s Account. format: The string representation of the OANDA-assigned TradeID. OANDA- assigned TradeIDs are positive integers, and are derived from the TransactionID of the Transaction that opened the Trade.

  • param String
  • return TradeSummary

Trait Implementations§

source§

impl Debug for TradeSummary

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for TradeSummary

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<TradeSummary, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for TradeSummary

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,