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.ModelThe 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.
-
instrument¶ InstrumentNameThe Trade’s Instrument.
-
price¶ PriceValueThe execution price of the Trade.
-
state¶ TradeStateThe current state of the Trade.
-
initial_units¶ DecimalNumberThe initial size of the Trade. Negative values indicate a short Trade, and positive values indicate a long Trade.
-
initial_margin_required¶ AccountUnitsThe 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¶ DecimalNumberThe number of units currently open for the Trade. This value is reduced to 0.0 as the Trade is closed.
-
realized_pl¶ AccountUnitsThe total profit/loss realized on the closed portion of the Trade.
-
unrealized_pl¶ AccountUnitsThe unrealized profit/loss on the open portion of the Trade.
-
average_close_price¶ PriceValueThe 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¶ AccountUnitsThe financing paid/collected for this Trade.
-
close_time¶ DateTimeThe date/time when the Trade was fully closed. Only provided for Trades whose state is CLOSED.
-
client_extensions¶ ClientExtensionsThe client extensions of the Trade.
-
take_profit_order¶ TakeProfitOrderFull representation of the Trade’s Take Profit Order, only provided if such an Order exists.
-
stop_loss_order¶ StopLossOrderFull representation of the Trade’s Stop Loss Order, only provided if such an Order exists.
-
trailing_stop_loss_order¶ TrailingStopLossOrderFull 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.ModelThe summary of a Trade within an Account. This representation does not provide the full details of the Trade’s dependent Orders.
-
instrument¶ InstrumentNameThe Trade’s Instrument.
-
price¶ PriceValueThe execution price of the Trade.
-
state¶ TradeStateThe current state of the Trade.
-
initial_units¶ DecimalNumberThe initial size of the Trade. Negative values indicate a short Trade, and positive values indicate a long Trade.
-
initial_margin_required¶ AccountUnitsThe 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¶ DecimalNumberThe number of units currently open for the Trade. This value is reduced to 0.0 as the Trade is closed.
-
realized_pl¶ AccountUnitsThe total profit/loss realized on the closed portion of the Trade.
-
unrealized_pl¶ AccountUnitsThe unrealized profit/loss on the open portion of the Trade.
-
average_close_price¶ PriceValueThe 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¶ AccountUnitsThe financing paid/collected for this Trade.
-
close_time¶ DateTimeThe date/time when the Trade was fully closed. Only provided for Trades whose state is CLOSED.
-
client_extensions¶ ClientExtensionsThe client extensions of the Trade.
-
take_profit_order_id¶ OrderIDID of the Trade’s Take Profit Order, only provided if such an Order exists.
-
stop_loss_order_id¶ OrderIDID of the Trade’s Stop Loss Order, only provided if such an Order exists.
-
trailing_stop_loss_order_id¶ OrderIDID 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.ModelThe dynamic (calculated) state of an open Trade
-
unrealized_pl¶ AccountUnitsThe Trade’s unrealized profit/loss.
-