[][src]Struct fxoanda_definitions::Trade

pub struct Trade {
    pub financing: Option<f32>,
    pub open_time: Option<DateTime<Utc>>,
    pub take_profit_order: Option<TakeProfitOrder>,
    pub margin_used: Option<f32>,
    pub price: Option<f32>,
    pub unrealized_pl: Option<f32>,
    pub realized_pl: Option<f32>,
    pub trailing_stop_loss_order: Option<TrailingStopLossOrder>,
    pub close_time: Option<DateTime<Utc>>,
    pub instrument: Option<String>,
    pub state: 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>,
    pub stop_loss_order: Option<StopLossOrder>,
}

Fields

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).

take_profit_order: Option<TakeProfitOrder>

A TakeProfitOrder is an order that is linked to an open Trade and created with a price threshold. The Order will be filled (closing the Trade) by the first price that is equal to or better than the threshold. A TakeProfitOrder cannot be used to open a new Position.

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.

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.

trailing_stop_loss_order: Option<TrailingStopLossOrder>

A TrailingStopLossOrder is an order that is linked to an open Trade and created with a price distance. The price distance is used to calculate a trailing stop value for the order that is in the losing direction from the market price at the time of the order's creation. The trailing stop value will follow the market price as it moves in the winning direction, and the order will filled (closing the Trade) by the first price that is equal to or worse than the trailing stop value. A TrailingStopLossOrder cannot be used to open a new Position.

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.

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.

stop_loss_order: Option<StopLossOrder>

A StopLossOrder is an order that is linked to an open Trade and created with a price threshold. The Order will be filled (closing the Trade) by the first price that is equal to or worse than the threshold. A StopLossOrder cannot be used to open a new Position.

Methods

impl Trade[src]

pub fn new() -> Trade[src]

pub fn with_financing(self, x: f32) -> Self[src]

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 Trade

pub fn with_open_time(self, x: DateTime<Utc>) -> Self[src]

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 Trade

pub fn with_take_profit_order(self, x: TakeProfitOrder) -> Self[src]

A TakeProfitOrder is an order that is linked to an open Trade and created with a price threshold. The Order will be filled (closing the Trade) by the first price that is equal to or better than the threshold. A TakeProfitOrder cannot be used to open a new Position.

  • param TakeProfitOrder
  • return Trade

pub fn with_margin_used(self, x: f32) -> Self[src]

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 Trade

pub fn with_price(self, x: f32) -> Self[src]

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 Trade

pub fn with_unrealized_pl(self, x: f32) -> Self[src]

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 Trade

pub fn with_realized_pl(self, x: f32) -> Self[src]

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 Trade

pub fn with_trailing_stop_loss_order(self, x: TrailingStopLossOrder) -> Self[src]

A TrailingStopLossOrder is an order that is linked to an open Trade and created with a price distance. The price distance is used to calculate a trailing stop value for the order that is in the losing direction from the market price at the time of the order's creation. The trailing stop value will follow the market price as it moves in the winning direction, and the order will filled (closing the Trade) by the first price that is equal to or worse than the trailing stop value. A TrailingStopLossOrder cannot be used to open a new Position.

  • param TrailingStopLossOrder
  • return Trade

pub fn with_close_time(self, x: DateTime<Utc>) -> Self[src]

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 Trade

pub fn with_instrument(self, x: String) -> Self[src]

The Trade's Instrument. format: A string containing the base currency and quote currency delimited by a "_".

  • param String
  • return Trade

pub fn with_state(self, x: String) -> Self[src]

The current state of the Trade.

  • param String
  • return Trade

pub fn with_initial_margin_required(self, x: f32) -> Self[src]

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 Trade

pub fn with_initial_units(self, x: f32) -> Self[src]

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 Trade

pub fn with_average_close_price(self, x: f32) -> Self[src]

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 Trade

pub fn with_current_units(self, x: f32) -> Self[src]

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 Trade

pub fn with_closing_transaction_i_ds(self, x: Vec<String>) -> Self[src]

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

  • param Vec
  • return Trade

pub fn with_client_extensions(self, x: ClientExtensions) -> Self[src]

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 Trade

pub fn with_id(self, x: String) -> Self[src]

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 Trade

pub fn with_stop_loss_order(self, x: StopLossOrder) -> Self[src]

A StopLossOrder is an order that is linked to an open Trade and created with a price threshold. The Order will be filled (closing the Trade) by the first price that is equal to or worse than the threshold. A StopLossOrder cannot be used to open a new Position.

  • param StopLossOrder
  • return Trade

Trait Implementations

impl Debug for Trade[src]

impl Serialize for Trade[src]

impl<'de> Deserialize<'de> for Trade[src]

Auto Trait Implementations

impl Send for Trade

impl Sync for Trade

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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