Trade Definitions


Type string
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.
Example 1523

Value Description
OPEN The Trade is currently open
CLOSED The Trade has been fully closed
CLOSE_WHEN_TRADEABLE The Trade will be closed as soon as the trade’s instrument becomes tradeable

Value Description
OPEN The Trades that are currently open
CLOSED The Trades that have been fully closed
CLOSE_WHEN_TRADEABLE The Trades that will be closed as soon as the trades’ instrument becomes tradeable
ALL The Trades that are in any of the possible states listed above.

Type string
Format Either the Trade’s OANDA-assigned TradeID or the Trade’s client-provided ClientID prefixed by the “@” symbol
Example @my_trade_id

Trade is an application/json object with the following Schema:

{
    # 
    # The Trade’s identifier, unique within the Trade’s Account.
    # 
    id : (TradeID),

    # 
    # The Trade’s Instrument.
    # 
    instrument : (InstrumentName),

    # 
    # The execution price of the Trade.
    # 
    price : (PriceValue),

    # 
    # The date/time when the Trade was opened.
    # 
    openTime : (DateTime),

    # 
    # The current state of the Trade.
    # 
    state : (TradeState),

    # 
    # The initial size of the Trade. Negative values indicate a short Trade,
    # and positive values indicate a long Trade.
    # 
    initialUnits : (DecimalNumber),

    # 
    # 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.
    # 
    initialMarginRequired : (AccountUnits),

    # 
    # The number of units currently open for the Trade. This value is reduced
    # to 0.0 as the Trade is closed.
    # 
    currentUnits : (DecimalNumber),

    # 
    # The total profit/loss realized on the closed portion of the Trade.
    # 
    realizedPL : (AccountUnits),

    # 
    # The unrealized profit/loss on the open portion of the Trade.
    # 
    unrealizedPL : (AccountUnits),

    # 
    # Margin currently used by the Trade.
    # 
    marginUsed : (AccountUnits),

    # 
    # The average closing price of the Trade. Only present if the Trade has
    # been closed or reduced at least once.
    # 
    averageClosePrice : (PriceValue),

    # 
    # The IDs of the Transactions that have closed portions of this Trade.
    # 
    closingTransactionIDs : (Array[TransactionID]),

    # 
    # The financing paid/collected for this Trade.
    # 
    financing : (AccountUnits),

    # 
    # The dividend adjustment paid for this Trade.
    # 
    dividendAdjustment : (AccountUnits),

    # 
    # The date/time when the Trade was fully closed. Only provided for Trades
    # whose state is CLOSED.
    # 
    closeTime : (DateTime),

    # 
    # The client extensions of the Trade.
    # 
    clientExtensions : (ClientExtensions),

    # 
    # Full representation of the Trade’s Take Profit Order, only provided if
    # such an Order exists.
    # 
    takeProfitOrder : (TakeProfitOrder),

    # 
    # Full representation of the Trade’s Stop Loss Order, only provided if such
    # an Order exists.
    # 
    stopLossOrder : (StopLossOrder),

    # 
    # Full representation of the Trade’s Trailing Stop Loss Order, only
    # provided if such an Order exists.
    # 
    trailingStopLossOrder : (TrailingStopLossOrder)
}

TradeSummary is an application/json object with the following Schema:

{
    # 
    # The Trade’s identifier, unique within the Trade’s Account.
    # 
    id : (TradeID),

    # 
    # The Trade’s Instrument.
    # 
    instrument : (InstrumentName),

    # 
    # The execution price of the Trade.
    # 
    price : (PriceValue),

    # 
    # The date/time when the Trade was opened.
    # 
    openTime : (DateTime),

    # 
    # The current state of the Trade.
    # 
    state : (TradeState),

    # 
    # The initial size of the Trade. Negative values indicate a short Trade,
    # and positive values indicate a long Trade.
    # 
    initialUnits : (DecimalNumber),

    # 
    # 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.
    # 
    initialMarginRequired : (AccountUnits),

    # 
    # The number of units currently open for the Trade. This value is reduced
    # to 0.0 as the Trade is closed.
    # 
    currentUnits : (DecimalNumber),

    # 
    # The total profit/loss realized on the closed portion of the Trade.
    # 
    realizedPL : (AccountUnits),

    # 
    # The unrealized profit/loss on the open portion of the Trade.
    # 
    unrealizedPL : (AccountUnits),

    # 
    # Margin currently used by the Trade.
    # 
    marginUsed : (AccountUnits),

    # 
    # The average closing price of the Trade. Only present if the Trade has
    # been closed or reduced at least once.
    # 
    averageClosePrice : (PriceValue),

    # 
    # The IDs of the Transactions that have closed portions of this Trade.
    # 
    closingTransactionIDs : (Array[TransactionID]),

    # 
    # The financing paid/collected for this Trade.
    # 
    financing : (AccountUnits),

    # 
    # The dividend adjustment paid for this Trade.
    # 
    dividendAdjustment : (AccountUnits),

    # 
    # The date/time when the Trade was fully closed. Only provided for Trades
    # whose state is CLOSED.
    # 
    closeTime : (DateTime),

    # 
    # The client extensions of the Trade.
    # 
    clientExtensions : (ClientExtensions),

    # 
    # ID of the Trade’s Take Profit Order, only provided if such an Order
    # exists.
    # 
    takeProfitOrderID : (OrderID),

    # 
    # ID of the Trade’s Stop Loss Order, only provided if such an Order exists.
    # 
    stopLossOrderID : (OrderID),

    # 
    # ID of the Trade’s Guaranteed Stop Loss Order, only provided if such an
    # Order exists.
    # 
    guaranteedStopLossOrderID : (OrderID),

    # 
    # ID of the Trade’s Trailing Stop Loss Order, only provided if such an
    # Order exists.
    # 
    trailingStopLossOrderID : (OrderID)
}

CalculatedTradeState is an application/json object with the following Schema:

{
    # 
    # The Trade’s ID.
    # 
    id : (TradeID),

    # 
    # The Trade’s unrealized profit/loss.
    # 
    unrealizedPL : (AccountUnits),

    # 
    # Margin currently used by the Trade.
    # 
    marginUsed : (AccountUnits)
}

Value Description
POSITIVE An open Trade currently has a positive (profitable) unrealized P/L, or a closed Trade realized a positive amount of P/L.
NEGATIVE An open Trade currently has a negative (losing) unrealized P/L, or a closed Trade realized a negative amount of P/L.
ZERO An open Trade currently has unrealized P/L of zero (neither profitable nor losing), or a closed Trade realized a P/L amount of zero.