OANDA · Schema
MarketOrder
A MarketOrder is an order that is filled immediately upon creation using the current market price.
ForexFX TradingCFD TradingFinancial ServicesTrading APIs
Properties
| Name | Type | Description |
|---|---|---|
| id | string | The Order's identifier, unique within the Order's Account. |
| createTime | string | The time when the Order was created. |
| state | string | The current state of the Order. |
| clientExtensions | object | |
| type | string | The type of the Order. Always set to "MARKET" for Market Orders. |
| instrument | string | The Market Order's Instrument. |
| units | string | The quantity requested to be filled by the Market Order. A posititive number of units results in a long Order, and a negative number of units results in a short Order. |
| timeInForce | string | The time-in-force requested for the Market Order. Restricted to FOK or IOC for a MarketOrder. |
| priceBound | string | The worst price that the client is willing to have the Market Order filled at. |
| positionFill | string | Specification of how Positions in the Account are modified when the Order is filled. |
| tradeClose | object | |
| longPositionCloseout | object | |
| shortPositionCloseout | object | |
| marginCloseout | object | |
| delayedTradeClose | object | |
| takeProfitOnFill | object | |
| stopLossOnFill | object | |
| trailingStopLossOnFill | object | |
| tradeClientExtensions | object | |
| fillingTransactionID | string | ID of the Transaction that filled this Order (only provided when the Order's state is FILLED) |
| filledTime | string | Date/time when the Order was filled (only provided when the Order's state is FILLED) |
| tradeOpenedID | string | 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) |
| tradeReducedID | string | 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) |
| tradeClosedIDs | array | 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) |
| cancellingTransactionID | string | ID of the Transaction that cancelled the Order (only provided when the Order's state is CANCELLED) |
| cancelledTime | string | Date/time when the Order was cancelled (only provided when the state of the Order is CANCELLED) |
JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MarketOrder",
"description": "A MarketOrder is an order that is filled immediately upon creation using the current market price.",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The Order's identifier, unique within the Order's Account.",
"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."
},
"createTime": {
"type": "string",
"description": "The time when the Order was created.",
"format": "The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places)."
},
"state": {
"type": "string",
"description": "The current state of the Order.",
"enum": [
"PENDING",
"FILLED",
"TRIGGERED",
"CANCELLED"
]
},
"clientExtensions": {
"$ref": "#/definitions/ClientExtensions"
},
"type": {
"type": "string",
"description": "The type of the Order. Always set to \"MARKET\" for Market Orders.",
"enum": [
"MARKET",
"LIMIT",
"STOP",
"MARKET_IF_TOUCHED",
"TAKE_PROFIT",
"STOP_LOSS",
"TRAILING_STOP_LOSS",
"FIXED_PRICE"
]
},
"instrument": {
"type": "string",
"description": "The Market Order's Instrument.",
"format": "A string containing the base currency and quote currency delimited by a \"_\"."
},
"units": {
"type": "string",
"description": "The quantity requested to be filled by the Market Order. A posititive number of units results in a long Order, and a negative number of units results in a short Order.",
"format": "A decimal number encoded as a string. The amount of precision provided depends on what the number represents."
},
"timeInForce": {
"type": "string",
"description": "The time-in-force requested for the Market Order. Restricted to FOK or IOC for a MarketOrder.",
"enum": [
"GTC",
"GTD",
"GFD",
"FOK",
"IOC"
]
},
"priceBound": {
"type": "string",
"description": "The worst price that the client is willing to have the Market Order filled at.",
"format": "A decimal number encodes as a string. The amount of precision provided depends on the Instrument."
},
"positionFill": {
"type": "string",
"description": "Specification of how Positions in the Account are modified when the Order is filled.",
"enum": [
"OPEN_ONLY",
"REDUCE_FIRST",
"REDUCE_ONLY",
"DEFAULT"
]
},
"tradeClose": {
"$ref": "#/definitions/MarketOrderTradeClose"
},
"longPositionCloseout": {
"$ref": "#/definitions/MarketOrderPositionCloseout"
},
"shortPositionCloseout": {
"$ref": "#/definitions/MarketOrderPositionCloseout"
},
"marginCloseout": {
"$ref": "#/definitions/MarketOrderMarginCloseout"
},
"delayedTradeClose": {
"$ref": "#/definitions/MarketOrderDelayedTradeClose"
},
"takeProfitOnFill": {
"$ref": "#/definitions/TakeProfitDetails"
},
"stopLossOnFill": {
"$ref": "#/definitions/StopLossDetails"
},
"trailingStopLossOnFill": {
"$ref": "#/definitions/TrailingStopLossDetails"
},
"tradeClientExtensions": {
"$ref": "#/definitions/ClientExtensions"
},
"fillingTransactionID": {
"type": "string",
"description": "ID of the Transaction that filled this Order (only provided when the Order's state is FILLED)",
"format": "String representation of the numerical OANDA-assigned TransactionID"
},
"filledTime": {
"type": "string",
"description": "Date/time when the Order was filled (only provided when the Order's state is FILLED)",
"format": "The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places)."
},
"tradeOpenedID": {
"type": "string",
"description": "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)",
"format": "The string representation of the OANDA-assigned TradeID. OANDA-assigned TradeIDs are positive integers, and are derived from the TransactionID of the Transaction that opened the Trade."
},
"tradeReducedID": {
"type": "string",
"description": "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)",
"format": "The string representation of the OANDA-assigned TradeID. OANDA-assigned TradeIDs are positive integers, and are derived from the TransactionID of the Transaction that opened the Trade."
},
"tradeClosedIDs": {
"type": "array",
"description": "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)",
"items": {
"type": "string",
"description": "The Trade's identifier, unique within the Trade's Account.",
"format": "The string representation of the OANDA-assigned TradeID. OANDA-assigned TradeIDs are positive integers, and are derived from the TransactionID of the Transaction that opened the Trade."
}
},
"cancellingTransactionID": {
"type": "string",
"description": "ID of the Transaction that cancelled the Order (only provided when the Order's state is CANCELLED)",
"format": "String representation of the numerical OANDA-assigned TransactionID"
},
"cancelledTime": {
"type": "string",
"description": "Date/time when the Order was cancelled (only provided when the state of the Order is CANCELLED)",
"format": "The RFC 3339 representation is a string conforming to https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a string representing the number of seconds since the Unix Epoch (January 1st, 1970 at UTC). The value is a fractional number, where the fractional part represents a fraction of a second (up to nine decimal places)."
}
}
}