Skip to content

Order Models

OANDA Reference: Order Data Definitions

Models for creating, managing, and tracking orders across all order types and lifecycle states.


Order Request Models

MarketOrderRequest

Request to create a market order (immediate execution at current market price).

🔗 OANDA Definition: MarketOrderRequest

🔗 Source: MarketOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to MARKET)
instrument InstrumentName ✅ Trading instrument for the order
units Decimal ✅ Number of units to trade (positive for long, negative for short)
time_in_force TimeInForce âž– Order duration policy (restricted to "FOK" or "IOC" for market orders)
price_bound PriceValue âž– Worst acceptable fill price (slippage protection)
position_fill OrderPositionFill âž– How positions are modified when order is filled (OPEN_ONLY, REDUCE_FIRST, REDUCE_ONLY, DEFAULT)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details to be applied on fill
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details to be applied on fill
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details to be applied on fill
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details to be applied on fill
trade_client_extensions ClientExtensions âž– Client extensions for any trades created by this order

LimitOrderRequest

Request to create a limit order (execution at specific price or better).

🔗 OANDA Definition: LimitOrderRequest

🔗 Source: LimitOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to LIMIT)
instrument InstrumentName ✅ Trading instrument for the order
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Price threshold for order execution (string, equal to or better price required)
time_in_force TimeInForce âž– Order duration policy (GTC, GTD, GFD, FOK, IOC)
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
position_fill OrderPositionFill âž– How positions are modified when order is filled
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details to be applied on fill
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details to be applied on fill
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details to be applied on fill
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details to be applied on fill
trade_client_extensions ClientExtensions âž– Client extensions for any trades created by this order

StopOrderRequest

Request to create a stop order (market order triggered at specific price).

🔗 OANDA Definition: StopOrderRequest

🔗 Source: StopOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to STOP)
instrument InstrumentName ✅ Trading instrument for the order
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Stop price threshold (equal to or worse price triggers execution)
price_bound PriceValue âž– Worst acceptable fill price after trigger to prevent excessive slippage
time_in_force TimeInForce âž– Order duration policy
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
position_fill OrderPositionFill âž– How positions are modified when order is filled
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details to be applied on fill
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details to be applied on fill
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details to be applied on fill
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details to be applied on fill
trade_client_extensions ClientExtensions âž– Client extensions for any trades created by this order

TakeProfitOrderRequest

Request to create a take profit order linked to an open trade.

🔗 OANDA Definition: TakeProfitOrderRequest

🔗 Source: TakeProfitOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to TAKE_PROFIT)
trade_id TradeID ✅ Trade identifier to close
client_trade_id str âž– Client-provided trade identifier
price PriceValue ✅ Price threshold for order execution
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)

StopLossOrderRequest

Request to create a stop loss order linked to an open trade.

🔗 OANDA Definition: StopLossOrderRequest

🔗 Source: StopLossOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to STOP_LOSS)
trade_id TradeID ✅ Trade identifier to close
client_trade_id str âž– Client-provided trade identifier
price PriceValue âž– Price threshold for order execution (either price or distance required)
distance Decimal âž– Distance from current price (either price or distance required)
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
guaranteed bool âž– Guaranteed execution flag
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)

TrailingStopLossOrderRequest

Request to create a trailing stop loss order linked to an open trade.

🔗 OANDA Definition: TrailingStopLossOrderRequest

🔗 Source: TrailingStopLossOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to TRAILING_STOP_LOSS)
trade_id TradeID ✅ Trade identifier to close
client_trade_id str âž– Client-provided trade identifier
distance Decimal ✅ Trailing distance from current price
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)

GuaranteedStopLossOrderRequest

Request to create a guaranteed stop loss order linked to an open trade.

🔗 OANDA Definition: GuaranteedStopLossOrderRequest

🔗 Source: GuaranteedStopLossOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to GUARANTEED_STOP_LOSS)
trade_id TradeID ✅ Trade identifier to close
client_trade_id str âž– Client-provided trade identifier
price PriceValue âž– Price threshold for order execution (either price or distance required)
distance Decimal âž– Distance from current price (either price or distance required)
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)

MarketIfTouchedOrderRequest

Request to create a market-if-touched order (market order triggered at specific price).

🔗 OANDA Definition: MarketIfTouchedOrderRequest

🔗 Source: MarketIfTouchedOrderRequest

Field Type Required Description
type OrderType âž– Order type identifier (automatically set to MARKET_IF_TOUCHED)
instrument InstrumentName ✅ Trading instrument for the order
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Price threshold that triggers market execution
price_bound PriceValue âž– Worst acceptable fill price after trigger to prevent excessive slippage
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (required when time_in_force is "GTD")
position_fill OrderPositionFill âž– How positions are modified when order is filled
trigger_condition OrderTriggerCondition âž– Price component used for triggering (DEFAULT, INVERSE, BID, ASK)
client_extensions ClientExtensions âž– Client extensions for the order (not available for MT4 accounts)
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details to be applied on fill
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details to be applied on fill
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details to be applied on fill
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details to be applied on fill
trade_client_extensions ClientExtensions âž– Client extensions for any trades created by this order

Order Response Models

MarketOrder

Market order that executes immediately at current market price.

🔗 OANDA Definition: MarketOrder

🔗 Source: MarketOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "MARKET" (default)
instrument InstrumentName ✅ Trading instrument
units Decimal ✅ Number of units to trade (positive for long, negative for short)
time_in_force TimeInForce ✅ Order duration policy
price_bound PriceValue âž– Worst acceptable fill price
position_fill OrderPositionFill ✅ Position modification behavior
trade_close MarketOrderTradeClose âž– Trade close details (conditional)
long_position_closeout MarketOrderPositionCloseout âž– Long position closeout details
short_position_closeout MarketOrderPositionCloseout âž– Short position closeout details
margin_closeout MarketOrderMarginCloseout âž– Margin closeout details
delayed_trade_close MarketOrderDelayedTradeClose âž– Delayed trade close details
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details
trade_client_extensions ClientExtensions âž– Client extensions for any trades created
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)

LimitOrder

Limit order that executes only at specified price or better.

🔗 OANDA Definition: LimitOrder

🔗 Source: LimitOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "LIMIT" (default)
instrument InstrumentName ✅ Trading instrument
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Price threshold for order execution
time_in_force TimeInForce ✅ Order duration policy
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
position_fill OrderPositionFill ✅ Position modification behavior
trigger_condition OrderTriggerCondition ✅ Price component used for triggering
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details
trade_client_extensions ClientExtensions âž– Client extensions for any trades created
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– ID of the order being replaced
replaced_by_order_id OrderID âž– ID of the order that replaced this one

StopOrder

Stop order that becomes a market order when price threshold is reached.

🔗 OANDA Definition: StopOrder

🔗 Source: StopOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "STOP" (default)
instrument InstrumentName ✅ Trading instrument
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Price threshold for order execution
price_bound PriceValue âž– Worst acceptable fill price
time_in_force TimeInForce ✅ Order duration policy
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
position_fill OrderPositionFill ✅ Position modification behavior
trigger_condition OrderTriggerCondition ✅ Price component used for triggering
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details
trade_client_extensions ClientExtensions âž– Client extensions for any trades created
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– ID of the order being replaced
replaced_by_order_id OrderID âž– ID of the order that replaced this one

GuaranteedStopLossOrder

Guaranteed stop loss order linked to an open trade with guaranteed execution.

🔗 OANDA Definition: GuaranteedStopLossOrder

🔗 Source: GuaranteedStopLossOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "GUARANTEED_STOP_LOSS" (default)
trade_id TradeID ✅ Trade to close
client_trade_id str âž– Client-provided trade identifier
price PriceValue ✅ Price threshold for order execution
distance Decimal âž– Distance from current price
time_in_force TimeInForce ✅ Order duration policy
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
trigger_condition OrderTriggerCondition ✅ Price component used for triggering
guaranteed_execution_premium Decimal ✅ Premium charged for guaranteed execution
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– ID of the order being replaced
replaced_by_order_id OrderID âž– ID of the order that replaced this one

TakeProfitOrder

A Take Profit Order linked to an open Trade and created with a price threshold.

🔗 OANDA Definition: TakeProfitOrder

🔗 Source: TakeProfitOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "TAKE_PROFIT"
trade_id TradeID ✅ Trade to close
client_trade_id str âž– Client-provided trade identifier
price PriceValue ✅ Trigger price
time_in_force TimeInForce ✅ Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
trigger_condition OrderTriggerCondition ✅ Price component used for triggering (default: DEFAULT)
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– ID of the order being replaced
replaced_by_order_id OrderID âž– ID of the order that replaced this one

StopLossOrder

A Stop Loss Order linked to an open Trade and created with a price threshold.

🔗 OANDA Definition: StopLossOrder

🔗 Source: StopLossOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "STOP_LOSS"
guaranteed_execution_premium Decimal âž– Premium charged for guaranteed execution (when guaranteed is True)
trade_id TradeID ✅ Trade to close
client_trade_id str âž– Client-provided trade identifier
price PriceValue âž– Trigger price
distance Decimal âž– Distance from current price (alternative to price)
time_in_force TimeInForce ✅ Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
trigger_condition OrderTriggerCondition ✅ Price component used for triggering (default: DEFAULT)
guaranteed bool âž– Guaranteed execution flag
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– ID of the order being replaced
replaced_by_order_id OrderID âž– ID of the order that replaced this one

TrailingStopLossOrder

A Trailing Stop Loss Order linked to an open Trade with a dynamic price distance.

🔗 OANDA Definition: TrailingStopLossOrder

🔗 Source: TrailingStopLossOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "TRAILING_STOP_LOSS" (default)
trade_id TradeID ✅ Trade to close
client_trade_id str âž– Client-provided trade identifier
distance Decimal ✅ Trailing distance
time_in_force TimeInForce ✅ Order duration policy
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
trigger_condition OrderTriggerCondition ✅ Price component used for triggering
trailing_stop_value PriceValue âž– Current trailing stop price
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– ID of the order being replaced
replaced_by_order_id OrderID âž– ID of the order that replaced this one

MarketIfTouchedOrder

A Market-If-Touched Order created with a price threshold.

🔗 OANDA Definition: MarketIfTouchedOrder

🔗 Source: MarketIfTouchedOrder

Field Type Required Description
id OrderID ✅ Order's identifier, unique within Account
create_time DateTime ✅ Time when Order was created
state OrderState ✅ Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "MARKET_IF_TOUCHED"
instrument InstrumentName ✅ Trading instrument
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Trigger price threshold
price_bound PriceValue âž– Worst acceptable fill price
time_in_force TimeInForce ✅ Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
position_fill OrderPositionFill ✅ Position modification behavior (default: DEFAULT)
trigger_condition OrderTriggerCondition ✅ Price component used for triggering (default: DEFAULT)
initial_market_price PriceValue âž– Initial market price when order was created
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details
trade_client_extensions ClientExtensions âž– Client extensions for created trades
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] ✅ Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)
replaces_order_id OrderID âž– Replaced order ID
replaced_by_order_id OrderID âž– Replacing order ID

FixedPriceOrder

A Fixed Price Order filled immediately at specified price.

🔗 OANDA Definition: FixedPriceOrder

Note: Fixed price orders are typically created by OANDA for specific circumstances (e.g., dividend adjustments). They cannot be directly created via API requests.

Field Type Required Description
id OrderID âž– Order's identifier, unique within Account
create_time DateTime âž– Time when Order was created
state OrderState âž– Current state of the Order
client_extensions ClientExtensions âž– Client extensions (not for MT4 accounts)
type str âž– Always "FIXED_PRICE"
instrument InstrumentName ✅ Trading instrument
units Decimal ✅ Number of units to trade (positive for long, negative for short)
price PriceValue ✅ Exact fill price
position_fill OrderPositionFill âž– Position modification behavior (default: DEFAULT)
trade_state str ✅ Resulting trade state
take_profit_on_fill TakeProfitDetails âž– Take profit order creation details
stop_loss_on_fill StopLossDetails âž– Stop loss order creation details
guaranteed_stop_loss_on_fill GuaranteedStopLossDetails âž– Guaranteed stop loss order creation details
trailing_stop_loss_on_fill TrailingStopLossDetails âž– Trailing stop loss order creation details
trade_client_extensions ClientExtensions âž– Client extensions for created trades
filling_transaction_id TransactionID âž– Fill transaction ID (when FILLED)
filled_time DateTime âž– Fill timestamp (when FILLED)
trade_opened_id TradeID âž– Opened trade ID (when FILLED)
trade_reduced_id TradeID âž– Reduced trade ID (when FILLED)
trade_closed_ids list[TradeID] âž– Closed trade IDs (when FILLED)
cancelling_transaction_id TransactionID âž– Cancel transaction ID (when CANCELLED)
cancelled_time DateTime âž– Cancel timestamp (when CANCELLED)

Order Details Models

TakeProfitDetails

Details for creating a Take Profit Order on fill.

🔗 OANDA Definition: TakeProfitDetails

🔗 Source: TakeProfitDetails

Field Type Required Description
price PriceValue ✅ Take profit trigger price
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
client_extensions ClientExtensions âž– Client extensions for the take profit order

StopLossDetails

Details for creating a Stop Loss Order on fill.

🔗 OANDA Definition: StopLossDetails

🔗 Source: StopLossDetails

Field Type Required Description
price PriceValue âž– Stop loss trigger price (either price or distance required)
distance Decimal âž– Distance from fill price (either price or distance required)
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
guaranteed bool âž– Guaranteed execution flag (default: False)
client_extensions ClientExtensions âž– Client extensions for the stop loss order

TrailingStopLossDetails

Details for creating a Trailing Stop Loss Order on fill.

🔗 OANDA Definition: TrailingStopLossDetails

🔗 Source: TrailingStopLossDetails

Field Type Required Description
distance Decimal ✅ Trailing distance from fill price
time_in_force TimeInForce âž– Order duration policy (default: GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp (when time_in_force is "GTD")
client_extensions ClientExtensions âž– Client extensions for the trailing stop loss order

ClientExtensions

Client-provided metadata for Orders and Trades.

🔗 OANDA Definition: ClientExtensions

🔗 Source: ClientExtensions

Field Type Required Description
id str âž– Client-provided identifier (max 64 characters)
tag str âž– Client-provided tag (max 255 characters)
comment str âž– Client-provided comment (max 255 characters)

GuaranteedStopLossDetails

Details for guaranteed stop loss orders that ensure execution at guaranteed price.

🔗 OANDA Definition: GuaranteedStopLossDetails

🔗 Source: GuaranteedStopLossDetails

Field Type Required Description
distance Decimal âž– Distance from current price to guaranteed stop loss price
price PriceValue âž– Price threshold for guaranteed stop loss execution
time_in_force TimeInForce âž– Order duration policy (defaults to GTC)
gtd_time DateTime âž– Good-till-date expiration timestamp
client_extensions ClientExtensions âž– Client extensions for the order
guaranteed_execution_premium AccountUnits âž– Premium charged for guaranteed execution

DynamicOrderState

The dynamic state of an order, including current calculations and trigger information.

🔗 OANDA Definition: DynamicOrderState

🔗 Source: DynamicOrderState

Field Type Required Description
id str ✅ Order identifier
trailing_stop_value PriceValue âž– Current trailing stop value for trailing stop orders
trigger_distance Decimal âž– Current trigger distance for distance-based orders
is_trigger_distance_exact bool âž– Whether the trigger distance is exact or approximate

Order Support Models

MarketOrderTradeClose

Details for closing specific trades with market orders.

🔗 OANDA Definition: MarketOrderTradeClose

🔗 Source: MarketOrderTradeClose

Field Type Required Description
trade_id TradeID ✅ Trade to close
client_trade_id str âž– Client-provided trade identifier
units Decimal ✅ Number of units to close (ALL or partial amount)

MarketOrderPositionCloseout

Details for position closeout via market order.

🔗 OANDA Definition: MarketOrderPositionCloseout

🔗 Source: MarketOrderPositionCloseout

Field Type Required Description
instrument InstrumentName ✅ Instrument to close position for
units Decimal ✅ Number of units to close (ALL or partial amount)

MarketOrderMarginCloseout

Details for margin closeout market order.

🔗 OANDA Definition: MarketOrderMarginCloseout

🔗 Source: MarketOrderMarginCloseout

Field Type Required Description
reason str ✅ Reason for margin closeout

MarketOrderDelayedTradeClose

Details for delayed trade close market order.

🔗 OANDA Definition: MarketOrderDelayedTradeClose

🔗 Source: MarketOrderDelayedTradeClose

Field Type Required Description
trade_id TradeID ✅ Trade to close
client_trade_id str âž– Client-provided trade identifier
source_transaction_id TransactionID ✅ Transaction that initiated the delay