Order Definitions
Orders
The specification of all Orders supported by the platform.
Implemented by: MarketOrder, FixedPriceOrder, LimitOrder, StopOrder, MarketIfTouchedOrder, TakeProfitOrder, StopLossOrder, GuaranteedStopLossOrder, TrailingStopLossOrder
Order is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions)
}
MarketOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “MARKET” for Market Orders.
#
type : (OrderType, default=MARKET),
#
# The Market Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Market Order. A positive
# number of units results in a long Order, and a negative number of units
# results in a short Order.
#
units : (DecimalNumber, required),
#
# The time-in-force requested for the Market Order. Restricted to FOK or
# IOC for a MarketOrder.
#
timeInForce : (TimeInForce, required, default=FOK),
#
# The worst price that the client is willing to have the Market Order
# filled at.
#
priceBound : (PriceValue),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Details of the Trade requested to be closed, only provided when the
# Market Order is being used to explicitly close a Trade.
#
tradeClose : (MarketOrderTradeClose),
#
# Details of the long Position requested to be closed out, only provided
# when a Market Order is being used to explicitly closeout a long Position.
#
longPositionCloseout : (MarketOrderPositionCloseout),
#
# Details of the short Position requested to be closed out, only provided
# when a Market Order is being used to explicitly closeout a short
# Position.
#
shortPositionCloseout : (MarketOrderPositionCloseout),
#
# Details of the Margin Closeout that this Market Order was created for
#
marginCloseout : (MarketOrderMarginCloseout),
#
# Details of the delayed Trade close that this Market Order was created for
#
delayedTradeClose : (MarketOrderDelayedTradeClose),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime)
}
FixedPriceOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “FIXED_PRICE” for Fixed Price
# Orders.
#
type : (OrderType, default=FIXED_PRICE),
#
# The Fixed Price Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Fixed Price Order. A positive
# number of units results in a long Order, and a negative number of units
# results in a short Order.
#
units : (DecimalNumber, required),
#
# The price specified for the Fixed Price Order. This price is the exact
# price that the Fixed Price Order will be filled at.
#
price : (PriceValue, required),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# The state that the trade resulting from the Fixed Price Order should be
# set to.
#
tradeState : (string, required),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime)
}
LimitOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “LIMIT” for Limit Orders.
#
type : (OrderType, default=LIMIT),
#
# The Limit Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Limit Order. A positive number
# of units results in a long Order, and a negative number of units results
# in a short Order.
#
units : (DecimalNumber, required),
#
# The price threshold specified for the Limit Order. The Limit Order will
# only be filled by a market price that is equal to or better than this
# price.
#
price : (PriceValue, required),
#
# The time-in-force requested for the Limit Order.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the Limit Order will be cancelled if its timeInForce
# is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
StopOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “STOP” for Stop Orders.
#
type : (OrderType, default=STOP),
#
# The Stop Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Stop Order. A positive number
# of units results in a long Order, and a negative number of units results
# in a short Order.
#
units : (DecimalNumber, required),
#
# The price threshold specified for the Stop Order. The Stop Order will
# only be filled by a market price that is equal to or worse than this
# price.
#
price : (PriceValue, required),
#
# The worst market price that may be used to fill this Stop Order. If the
# market gaps and crosses through both the price and the priceBound, the
# Stop Order will be cancelled instead of being filled.
#
priceBound : (PriceValue),
#
# The time-in-force requested for the Stop Order.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the Stop Order will be cancelled if its timeInForce is
# “GTD”.
#
gtdTime : (DateTime),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
MarketIfTouchedOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “MARKET_IF_TOUCHED” for Market If
# Touched Orders.
#
type : (OrderType, default=MARKET_IF_TOUCHED),
#
# The MarketIfTouched Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the MarketIfTouched Order. A
# positive number of units results in a long Order, and a negative number
# of units results in a short Order.
#
units : (DecimalNumber, required),
#
# The price threshold specified for the MarketIfTouched Order. The
# MarketIfTouched Order will only be filled by a market price that crosses
# this price from the direction of the market price at the time when the
# Order was created (the initialMarketPrice). Depending on the value of the
# Order’s price and initialMarketPrice, the MarketIfTouchedOrder will
# behave like a Limit or a Stop Order.
#
price : (PriceValue, required),
#
# The worst market price that may be used to fill this MarketIfTouched
# Order.
#
priceBound : (PriceValue),
#
# The time-in-force requested for the MarketIfTouched Order. Restricted to
# “GTC”, “GFD” and “GTD” for MarketIfTouched Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the MarketIfTouched Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The Market price at the time when the MarketIfTouched Order was created.
#
initialMarketPrice : (PriceValue),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
TakeProfitOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “TAKE_PROFIT” for Take Profit
# Orders.
#
type : (OrderType, default=TAKE_PROFIT),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price threshold specified for the TakeProfit Order. The associated
# Trade will be closed by a market price that is equal to or better than
# this threshold.
#
price : (PriceValue, required),
#
# The time-in-force requested for the TakeProfit Order. Restricted to
# “GTC”, “GFD” and “GTD” for TakeProfit Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the TakeProfit Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
StopLossOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “STOP_LOSS” for Stop Loss Orders.
#
type : (OrderType, default=STOP_LOSS),
#
# The premium that will be charged if the Stop Loss Order is guaranteed and
# the Order is filled at the guaranteed price. It is in price units and is
# charged for each unit of the Trade.
#
#
# Deprecated: Will be removed in a future API update.
#
guaranteedExecutionPremium : (DecimalNumber, deprecated),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price threshold specified for the Stop Loss Order. The associated
# Trade will be closed by a market price that is equal to or worse than
# this threshold.
#
price : (PriceValue, required),
#
# Specifies the distance (in price units) from the Account’s current price
# to use as the Stop Loss Order price. If the Trade is short the
# Instrument’s bid price is used, and for long Trades the ask is used.
#
distance : (DecimalNumber),
#
# The time-in-force requested for the StopLoss Order. Restricted to “GTC”,
# “GFD” and “GTD” for StopLoss Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the StopLoss Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# Flag indicating that the Stop Loss Order is guaranteed. The default value
# depends on the GuaranteedStopLossOrderMode of the account, if it is
# REQUIRED, the default will be true, for DISABLED or ENABLED the default
# is false.
#
#
# Deprecated: Will be removed in a future API update.
#
guaranteed : (boolean, deprecated),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
GuaranteedStopLossOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “GUARANTEED_STOP_LOSS” for
# Guaranteed Stop Loss Orders.
#
type : (OrderType, default=GUARANTEED_STOP_LOSS),
#
# The premium that will be charged if the Guaranteed Stop Loss Order is
# filled at the guaranteed price. It is in price units and is charged for
# each unit of the Trade.
#
guaranteedExecutionPremium : (DecimalNumber),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price threshold specified for the Guaranteed Stop Loss Order. The
# associated Trade will be closed at this price.
#
price : (PriceValue, required),
#
# Specifies the distance (in price units) from the Account’s current price
# to use as the Guaranteed Stop Loss Order price. If the Trade is short the
# Instrument’s bid price is used, and for long Trades the ask is used.
#
distance : (DecimalNumber),
#
# The time-in-force requested for the GuaranteedStopLoss Order. Restricted
# to “GTC”, “GFD” and “GTD” for GuaranteedStopLoss Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the GuaranteedStopLoss Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
TrailingStopLossOrder is an application/json object with the following Schema:
{
#
# The Order’s identifier, unique within the Order’s Account.
#
id : (OrderID),
#
# The time when the Order was created.
#
createTime : (DateTime),
#
# The current state of the Order.
#
state : (OrderState),
#
# The client extensions of the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# The type of the Order. Always set to “TRAILING_STOP_LOSS” for Trailing
# Stop Loss Orders.
#
type : (OrderType, default=TRAILING_STOP_LOSS),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price distance (in price units) specified for the TrailingStopLoss
# Order.
#
distance : (DecimalNumber, required),
#
# The time-in-force requested for the TrailingStopLoss Order. Restricted to
# “GTC”, “GFD” and “GTD” for TrailingStopLoss Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the StopLoss Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The trigger price for the Trailing Stop Loss Order. The trailing stop
# value will trail (follow) the market price by the TSL order’s configured
# “distance” as the market price moves in the winning direction. If the
# market price moves to a level that is equal to or worse than the trailing
# stop value, the order will be filled and the Trade will be closed.
#
trailingStopValue : (PriceValue),
#
# ID of the Transaction that filled this Order (only provided when the
# Order’s state is FILLED)
#
fillingTransactionID : (TransactionID),
#
# Date/time when the Order was filled (only provided when the Order’s state
# is FILLED)
#
filledTime : (DateTime),
#
# Trade ID of Trade opened when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was opened as a result of the
# fill)
#
tradeOpenedID : (TradeID),
#
# Trade ID of Trade reduced when the Order was filled (only provided when
# the Order’s state is FILLED and a Trade was reduced as a result of the
# fill)
#
tradeReducedID : (TradeID),
#
# Trade IDs of Trades closed when the Order was filled (only provided when
# the Order’s state is FILLED and one or more Trades were closed as a
# result of the fill)
#
tradeClosedIDs : (Array[TradeID]),
#
# ID of the Transaction that cancelled the Order (only provided when the
# Order’s state is CANCELLED)
#
cancellingTransactionID : (TransactionID),
#
# Date/time when the Order was cancelled (only provided when the state of
# the Order is CANCELLED)
#
cancelledTime : (DateTime),
#
# The ID of the Order that was replaced by this Order (only provided if
# this Order was created as part of a cancel/replace).
#
replacesOrderID : (OrderID),
#
# The ID of the Order that replaced this Order (only provided if this Order
# was cancelled as part of a cancel/replace).
#
replacedByOrderID : (OrderID)
}
Order Requests
The request specification of all Orders supported by the platform. These objects are used by the API client to create Orders on the platform.
Implemented by: MarketOrderRequest, LimitOrderRequest, StopOrderRequest, MarketIfTouchedOrderRequest, TakeProfitOrderRequest, StopLossOrderRequest, GuaranteedStopLossOrderRequest, TrailingStopLossOrderRequest
MarketOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “MARKET” when creating a
# Market Order.
#
type : (OrderType, default=MARKET),
#
# The Market Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Market Order. A positive
# number of units results in a long Order, and a negative number of units
# results in a short Order.
#
units : (DecimalNumber, required),
#
# The time-in-force requested for the Market Order. Restricted to FOK or
# IOC for a MarketOrder.
#
timeInForce : (TimeInForce, required, default=FOK),
#
# The worst price that the client is willing to have the Market Order
# filled at.
#
priceBound : (PriceValue),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions)
}
LimitOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “LIMIT” when creating a
# Market Order.
#
type : (OrderType, default=LIMIT),
#
# The Limit Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Limit Order. A positive number
# of units results in a long Order, and a negative number of units results
# in a short Order.
#
units : (DecimalNumber, required),
#
# The price threshold specified for the Limit Order. The Limit Order will
# only be filled by a market price that is equal to or better than this
# price.
#
price : (PriceValue, required),
#
# The time-in-force requested for the Limit Order.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the Limit Order will be cancelled if its timeInForce
# is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions)
}
StopOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “STOP” when creating a
# Stop Order.
#
type : (OrderType, default=STOP),
#
# The Stop Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the Stop Order. A positive number
# of units results in a long Order, and a negative number of units results
# in a short Order.
#
units : (DecimalNumber, required),
#
# The price threshold specified for the Stop Order. The Stop Order will
# only be filled by a market price that is equal to or worse than this
# price.
#
price : (PriceValue, required),
#
# The worst market price that may be used to fill this Stop Order. If the
# market gaps and crosses through both the price and the priceBound, the
# Stop Order will be cancelled instead of being filled.
#
priceBound : (PriceValue),
#
# The time-in-force requested for the Stop Order.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the Stop Order will be cancelled if its timeInForce is
# “GTD”.
#
gtdTime : (DateTime),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions)
}
MarketIfTouchedOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “MARKET_IF_TOUCHED” when
# creating a Market If Touched Order.
#
type : (OrderType, default=MARKET_IF_TOUCHED),
#
# The MarketIfTouched Order’s Instrument.
#
instrument : (InstrumentName, required),
#
# The quantity requested to be filled by the MarketIfTouched Order. A
# positive number of units results in a long Order, and a negative number
# of units results in a short Order.
#
units : (DecimalNumber, required),
#
# The price threshold specified for the MarketIfTouched Order. The
# MarketIfTouched Order will only be filled by a market price that crosses
# this price from the direction of the market price at the time when the
# Order was created (the initialMarketPrice). Depending on the value of the
# Order’s price and initialMarketPrice, the MarketIfTouchedOrder will
# behave like a Limit or a Stop Order.
#
price : (PriceValue, required),
#
# The worst market price that may be used to fill this MarketIfTouched
# Order.
#
priceBound : (PriceValue),
#
# The time-in-force requested for the MarketIfTouched Order. Restricted to
# “GTC”, “GFD” and “GTD” for MarketIfTouched Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the MarketIfTouched Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of how Positions in the Account are modified when the Order
# is filled.
#
positionFill : (OrderPositionFill, required, default=DEFAULT),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions),
#
# TakeProfitDetails specifies the details of a Take Profit Order to be
# created on behalf of a client. This may happen when an Order is filled
# that opens a Trade requiring a Take Profit, or when a Trade’s dependent
# Take Profit Order is modified directly through the Trade.
#
takeProfitOnFill : (TakeProfitDetails),
#
# StopLossDetails specifies the details of a Stop Loss Order to be created
# on behalf of a client. This may happen when an Order is filled that opens
# a Trade requiring a Stop Loss, or when a Trade’s dependent Stop Loss
# Order is modified directly through the Trade.
#
stopLossOnFill : (StopLossDetails),
#
# GuaranteedStopLossDetails specifies the details of a Guaranteed Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Guaranteed Stop Loss, or when a
# Trade’s dependent Guaranteed Stop Loss Order is modified directly through
# the Trade.
#
guaranteedStopLossOnFill : (GuaranteedStopLossDetails),
#
# TrailingStopLossDetails specifies the details of a Trailing Stop Loss
# Order to be created on behalf of a client. This may happen when an Order
# is filled that opens a Trade requiring a Trailing Stop Loss, or when a
# Trade’s dependent Trailing Stop Loss Order is modified directly through
# the Trade.
#
trailingStopLossOnFill : (TrailingStopLossDetails),
#
# Client Extensions to add to the Trade created when the Order is filled
# (if such a Trade is created). Do not set, modify, or delete
# tradeClientExtensions if your account is associated with MT4.
#
tradeClientExtensions : (ClientExtensions)
}
TakeProfitOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “TAKE_PROFIT” when
# creating a Take Profit Order.
#
type : (OrderType, default=TAKE_PROFIT),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price threshold specified for the TakeProfit Order. The associated
# Trade will be closed by a market price that is equal to or better than
# this threshold.
#
price : (PriceValue, required),
#
# The time-in-force requested for the TakeProfit Order. Restricted to
# “GTC”, “GFD” and “GTD” for TakeProfit Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the TakeProfit Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions)
}
StopLossOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “STOP_LOSS” when creating
# a Stop Loss Order.
#
type : (OrderType, default=STOP_LOSS),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price threshold specified for the Stop Loss Order. The associated
# Trade will be closed by a market price that is equal to or worse than
# this threshold.
#
price : (PriceValue, required),
#
# Specifies the distance (in price units) from the Account’s current price
# to use as the Stop Loss Order price. If the Trade is short the
# Instrument’s bid price is used, and for long Trades the ask is used.
#
distance : (DecimalNumber),
#
# The time-in-force requested for the StopLoss Order. Restricted to “GTC”,
# “GFD” and “GTD” for StopLoss Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the StopLoss Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# Flag indicating that the Stop Loss Order is guaranteed. The default value
# depends on the GuaranteedStopLossOrderMode of the account, if it is
# REQUIRED, the default will be true, for DISABLED or ENABLED the default
# is false.
#
#
# Deprecated: Will be removed in a future API update.
#
guaranteed : (boolean, deprecated),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions)
}
GuaranteedStopLossOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “GUARANTEED_STOP_LOSS”
# when creating a Guaranteed Stop Loss Order.
#
type : (OrderType, default=GUARANTEED_STOP_LOSS),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price threshold specified for the Guaranteed Stop Loss Order. The
# associated Trade will be closed at this price.
#
price : (PriceValue, required),
#
# Specifies the distance (in price units) from the Account’s current price
# to use as the Guaranteed Stop Loss Order price. If the Trade is short the
# Instrument’s bid price is used, and for long Trades the ask is used.
#
distance : (DecimalNumber),
#
# The time-in-force requested for the GuaranteedStopLoss Order. Restricted
# to “GTC”, “GFD” and “GTD” for GuaranteedStopLoss Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the GuaranteedStopLoss Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions)
}
TrailingStopLossOrderRequest is an application/json object with the following Schema:
{
#
# The type of the Order to Create. Must be set to “TRAILING_STOP_LOSS” when
# creating a Trailing Stop Loss Order.
#
type : (OrderType, default=TRAILING_STOP_LOSS),
#
# The ID of the Trade to close when the price threshold is breached.
#
tradeID : (TradeID, required),
#
# The client ID of the Trade to be closed when the price threshold is
# breached.
#
clientTradeID : (ClientID),
#
# The price distance (in price units) specified for the TrailingStopLoss
# Order.
#
distance : (DecimalNumber, required),
#
# The time-in-force requested for the TrailingStopLoss Order. Restricted to
# “GTC”, “GFD” and “GTD” for TrailingStopLoss Orders.
#
timeInForce : (TimeInForce, required, default=GTC),
#
# The date/time when the StopLoss Order will be cancelled if its
# timeInForce is “GTD”.
#
gtdTime : (DateTime),
#
# Specification of which price component should be used when determining if
# an Order should be triggered and filled. This allows Orders to be
# triggered based on the bid, ask, mid, default (ask for buy, bid for sell)
# or inverse (ask for sell, bid for buy) price depending on the desired
# behaviour. Orders are always filled using their default price component.
# This feature is only provided through the REST API. Clients who choose to
# specify a non-default trigger condition will not see it reflected in any
# of OANDA’s proprietary or partner trading platforms, their transaction
# history or their account statements. OANDA platforms always assume that
# an Order’s trigger condition is set to the default value when indicating
# the distance from an Order’s trigger price, and will always provide the
# default trigger condition when creating or modifying an Order. A special
# restriction applies when creating a Guaranteed Stop Loss Order. In this
# case the TriggerCondition value must either be “DEFAULT”, or the
# “natural” trigger side “DEFAULT” results in. So for a Guaranteed Stop
# Loss Order for a long trade valid values are “DEFAULT” and “BID”, and for
# short trades “DEFAULT” and “ASK” are valid.
#
triggerCondition : (OrderTriggerCondition, required, default=DEFAULT),
#
# The client extensions to add to the Order. Do not set, modify, or delete
# clientExtensions if your account is associated with MT4.
#
clientExtensions : (ClientExtensions)
}
Order-related Definitions
| Type | string |
|---|---|
| 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. |
| Example | 1523 |
| Value | Description |
|---|---|
| MARKET | A Market Order |
| LIMIT | A Limit Order |
| STOP | A Stop Order |
| MARKET_IF_TOUCHED | A Market-if-touched Order |
| TAKE_PROFIT | A Take Profit Order |
| STOP_LOSS | A Stop Loss Order |
| GUARANTEED_STOP_LOSS | A Guaranteed Stop Loss Order |
| TRAILING_STOP_LOSS | A Trailing Stop Loss Order |
| FIXED_PRICE | A Fixed Price Order |
| Value | Description |
|---|---|
| LIMIT | A Limit Order |
| STOP | A Stop Order |
| MARKET_IF_TOUCHED | A Market-if-touched Order |
| TAKE_PROFIT | A Take Profit Order |
| STOP_LOSS | A Stop Loss Order |
| GUARANTEED_STOP_LOSS | A Guaranteed Stop Loss Order |
| TRAILING_STOP_LOSS | A Trailing Stop Loss Order |
| Value | Description |
|---|---|
| PENDING | The Order is currently pending execution |
| FILLED | The Order has been filled |
| TRIGGERED | The Order has been triggered |
| CANCELLED | The Order has been cancelled |
| Value | Description |
|---|---|
| PENDING | The Orders that are currently pending execution |
| FILLED | The Orders that have been filled |
| TRIGGERED | The Orders that have been triggered |
| CANCELLED | The Orders that have been cancelled |
| ALL | The Orders that are in any of the possible states listed above |
OrderIdentifier is an application/json object with the following Schema:
{
#
# The OANDA-assigned Order ID
#
orderID : (OrderID),
#
# The client-provided client Order ID
#
clientOrderID : (ClientID)
}
| Type | string |
|---|---|
| Format | Either the Order’s OANDA-assigned OrderID or the Order’s client-provided ClientID prefixed by the “@” symbol |
| Example | 1523 |
| Value | Description |
|---|---|
| GTC | The Order is “Good unTil Cancelled” |
| GTD | The Order is “Good unTil Date” and will be cancelled at the provided time |
| GFD | The Order is “Good For Day” and will be cancelled at 5pm New York time |
| FOK | The Order must be immediately “Filled Or Killed” |
| IOC | The Order must be “Immediately partially filled Or Cancelled” |
| Value | Description |
|---|---|
| OPEN_ONLY | When the Order is filled, only allow Positions to be opened or extended. |
| REDUCE_FIRST | When the Order is filled, always fully reduce an existing Position before opening a new Position. |
| REDUCE_ONLY | When the Order is filled, only reduce an existing Position. |
| DEFAULT | When the Order is filled, use REDUCE_FIRST behaviour for non-client hedging Accounts, and OPEN_ONLY behaviour for client hedging Accounts. |
| Value | Description |
|---|---|
| DEFAULT | Trigger an Order the “natural” way: compare its price to the ask for long Orders and bid for short Orders. |
| INVERSE | Trigger an Order the opposite of the “natural” way: compare its price the bid for long Orders and ask for short Orders. |
| BID | Trigger an Order by comparing its price to the bid regardless of whether it is long or short. |
| ASK | Trigger an Order by comparing its price to the ask regardless of whether it is long or short. |
| MID | Trigger an Order by comparing its price to the midpoint regardless of whether it is long or short. |
DynamicOrderState is an application/json object with the following Schema:
{
#
# The Order’s ID.
#
id : (OrderID),
#
# The Order’s calculated trailing stop value.
#
trailingStopValue : (PriceValue),
#
# The distance between the Trailing Stop Loss Order’s trailingStopValue and
# the current Market Price. This represents the distance (in price units)
# of the Order from a triggering price. If the distance could not be
# determined, this value will not be set.
#
triggerDistance : (PriceValue),
#
# True if an exact trigger distance could be calculated. If false, it means
# the provided trigger distance is a best estimate. If the distance could
# not be determined, this value will not be set.
#
isTriggerDistanceExact : (boolean)
}
UnitsAvailableDetails is an application/json object with the following Schema:
{
#
# The units available for long Orders.
#
long : (DecimalNumber),
#
# The units available for short Orders.
#
short : (DecimalNumber)
}
UnitsAvailable is an application/json object with the following Schema:
{
#
# The number of units that are available to be traded using an Order with a
# positionFill option of “DEFAULT”. For an Account with hedging enabled,
# this value will be the same as the “OPEN_ONLY” value. For an Account
# without hedging enabled, this value will be the same as the
# “REDUCE_FIRST” value.
#
default : (UnitsAvailableDetails),
#
# The number of units that may are available to be traded with an Order
# with a positionFill option of “REDUCE_FIRST”.
#
reduceFirst : (UnitsAvailableDetails),
#
# The number of units that may are available to be traded with an Order
# with a positionFill option of “REDUCE_ONLY”.
#
reduceOnly : (UnitsAvailableDetails),
#
# The number of units that may are available to be traded with an Order
# with a positionFill option of “OPEN_ONLY”.
#
openOnly : (UnitsAvailableDetails)
}
GuaranteedStopLossOrderEntryData is an application/json object with the following Schema:
{
#
# The minimum distance allowed between the Trade’s fill price and the
# configured price for guaranteed Stop Loss Orders created for this
# instrument. Specified in price units.
#
minimumDistance : (DecimalNumber),
#
# The amount that is charged to the account if a guaranteed Stop Loss Order
# is triggered and filled. The value is in price units and is charged for
# each unit of the Trade.
#
premium : (DecimalNumber),
#
# The guaranteed Stop Loss Order level restriction for this instrument.
#
levelRestriction : (GuaranteedStopLossOrderLevelRestriction)
}