Trade

class async_v20.Trade(id: TradeID= sentinel, instrument: InstrumentName= sentinel, price: PriceValue= sentinel, open_time: DateTime= sentinel, state: TradeState= sentinel, initial_units: DecimalNumber= sentinel, initial_margin_required: AccountUnits= sentinel, current_units: DecimalNumber= sentinel, realized_pl: AccountUnits= sentinel, unrealized_pl: AccountUnits= sentinel, average_close_price: PriceValue= sentinel, closing_transaction_ids: ArrayTransactionID= sentinel, financing: AccountUnits= sentinel, close_time: DateTime= sentinel, client_extensions: ClientExtensions= sentinel, take_profit_order: TakeProfitOrder= sentinel, stop_loss_order: StopLossOrder= sentinel, trailing_stop_loss_order: TrailingStopLossOrder= sentinel, margin_used: AccountUnits= sentinel)[source]

Bases: async_v20.definitions.base.Model

The specification of a Trade within an Account. This includes the full representation of the Trade’s dependent Orders in addition to the IDs of those Orders.

id

TradeID The Trade’s identifier, unique within the Trade’s Account.

instrument

InstrumentName The Trade’s Instrument.

price

PriceValue The execution price of the Trade.

open_time

DateTime The date/time when the Trade was opened.

state

TradeState The current state of the Trade.

initial_units

DecimalNumber The initial size of the Trade. Negative values indicate a short Trade, and positive values indicate a long Trade.

initial_margin_required

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

current_units

DecimalNumber The number of units currently open for the Trade. This value is reduced to 0.0 as the Trade is closed.

realized_pl

AccountUnits The total profit/loss realized on the closed portion of the Trade.

unrealized_pl

AccountUnits The unrealized profit/loss on the open portion of the Trade.

average_close_price

PriceValue The average closing price of the Trade. Only present if the Trade has been closed or reduced at least once.

closing_transaction_ids

( TransactionID, …) The IDs of the Transactions that have closed portions of this Trade.

financing

AccountUnits The financing paid/collected for this Trade.

close_time

DateTime The date/time when the Trade was fully closed. Only provided for Trades whose state is CLOSED.

client_extensions

ClientExtensions The client extensions of the Trade.

take_profit_order

TakeProfitOrder Full representation of the Trade’s Take Profit Order, only provided if such an Order exists.

stop_loss_order

StopLossOrder Full representation of the Trade’s Stop Loss Order, only provided if such an Order exists.

trailing_stop_loss_order

TrailingStopLossOrder Full representation of the Trade’s Trailing Stop Loss Order, only provided if such an Order exists.

margin_used

Margin currently used by the Trade.

class async_v20.TradeSummary(id: TradeID= sentinel, instrument: InstrumentName= sentinel, price: PriceValue= sentinel, open_time: DateTime= sentinel, state: TradeState= sentinel, initial_units: DecimalNumber= sentinel, initial_margin_required: AccountUnits= sentinel, current_units: DecimalNumber= sentinel, realized_pl: AccountUnits= sentinel, unrealized_pl: AccountUnits= sentinel, average_close_price: PriceValue= sentinel, closing_transaction_ids: ArrayTransactionID= sentinel, financing: AccountUnits= sentinel, close_time: DateTime= sentinel, client_extensions: ClientExtensions= sentinel, take_profit_order_id: OrderID= sentinel, stop_loss_order_id: OrderID= sentinel, trailing_stop_loss_order_id: OrderID= sentinel, margin_used: AccountUnits= sentinel)[source]

Bases: async_v20.definitions.base.Model

The summary of a Trade within an Account. This representation does not provide the full details of the Trade’s dependent Orders.

id

TradeID The Trade’s identifier, unique within the Trade’s Account.

instrument

InstrumentName The Trade’s Instrument.

price

PriceValue The execution price of the Trade.

open_time

DateTime The date/time when the Trade was opened.

state

TradeState The current state of the Trade.

initial_units

DecimalNumber The initial size of the Trade. Negative values indicate a short Trade, and positive values indicate a long Trade.

initial_margin_required

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

current_units

DecimalNumber The number of units currently open for the Trade. This value is reduced to 0.0 as the Trade is closed.

realized_pl

AccountUnits The total profit/loss realized on the closed portion of the Trade.

unrealized_pl

AccountUnits The unrealized profit/loss on the open portion of the Trade.

average_close_price

PriceValue The average closing price of the Trade. Only present if the Trade has been closed or reduced at least once.

closing_transaction_ids

( TransactionID, …) The IDs of the Transactions that have closed portions of this Trade.

financing

AccountUnits The financing paid/collected for this Trade.

close_time

DateTime The date/time when the Trade was fully closed. Only provided for Trades whose state is CLOSED.

client_extensions

ClientExtensions The client extensions of the Trade.

take_profit_order_id

OrderID ID of the Trade’s Take Profit Order, only provided if such an Order exists.

stop_loss_order_id

OrderID ID of the Trade’s Stop Loss Order, only provided if such an Order exists.

trailing_stop_loss_order_id

OrderID ID of the Trade’s Trailing Stop Loss Order, only provided if such an Order exists.

margin_used

Margin currently used by the Trade.

class async_v20.CalculatedTradeState(id: TradeID= sentinel, unrealized_pl: AccountUnits= sentinel, margin_used: AccountUnits= sentinel)[source]

Bases: async_v20.definitions.base.Model

The dynamic (calculated) state of an open Trade

id

TradeID The Trade’s ID.

unrealized_pl

AccountUnits The Trade’s unrealized profit/loss.