{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "OrderCancelTransaction",
  "description": "An OrderCancelTransaction represents the cancellation of an Order in the client's Account.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The Transaction's Identifier.",
      "format": "String representation of the numerical OANDA-assigned TransactionID"
    },
    "time": {
      "type": "string",
      "description": "The date/time when the Transaction 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)."
    },
    "userID": {
      "type": "integer",
      "description": "The ID of the user that initiated the creation of the Transaction."
    },
    "accountID": {
      "type": "string",
      "description": "The ID of the Account the Transaction was created for.",
      "format": "\"-\"-delimited string with format \"{siteID}-{divisionID}-{userID}-{accountNumber}\""
    },
    "batchID": {
      "type": "string",
      "description": "The ID of the \"batch\" that the Transaction belongs to. Transactions in the same batch are applied to the Account simultaneously.",
      "format": "String representation of the numerical OANDA-assigned TransactionID"
    },
    "requestID": {
      "type": "string",
      "description": "The Request ID of the request which generated the transaction."
    },
    "type": {
      "type": "string",
      "description": "The Type of the Transaction. Always set to \"ORDER_CANCEL\" for an OrderCancelTransaction.",
      "enum": [
        "CREATE",
        "CLOSE",
        "REOPEN",
        "CLIENT_CONFIGURE",
        "CLIENT_CONFIGURE_REJECT",
        "TRANSFER_FUNDS",
        "TRANSFER_FUNDS_REJECT",
        "MARKET_ORDER",
        "MARKET_ORDER_REJECT",
        "FIXED_PRICE_ORDER",
        "LIMIT_ORDER",
        "LIMIT_ORDER_REJECT",
        "STOP_ORDER",
        "STOP_ORDER_REJECT",
        "MARKET_IF_TOUCHED_ORDER",
        "MARKET_IF_TOUCHED_ORDER_REJECT",
        "TAKE_PROFIT_ORDER",
        "TAKE_PROFIT_ORDER_REJECT",
        "STOP_LOSS_ORDER",
        "STOP_LOSS_ORDER_REJECT",
        "TRAILING_STOP_LOSS_ORDER",
        "TRAILING_STOP_LOSS_ORDER_REJECT",
        "ORDER_FILL",
        "ORDER_CANCEL",
        "ORDER_CANCEL_REJECT",
        "ORDER_CLIENT_EXTENSIONS_MODIFY",
        "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT",
        "TRADE_CLIENT_EXTENSIONS_MODIFY",
        "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT",
        "MARGIN_CALL_ENTER",
        "MARGIN_CALL_EXTEND",
        "MARGIN_CALL_EXIT",
        "DELAYED_TRADE_CLOSURE",
        "DAILY_FINANCING",
        "RESET_RESETTABLE_PL"
      ]
    },
    "orderID": {
      "type": "string",
      "description": "The ID of the Order cancelled",
      "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."
    },
    "clientOrderID": {
      "type": "string",
      "description": "The client ID of the Order cancelled (only provided if the Order has a client Order ID).",
      "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."
    },
    "reason": {
      "type": "string",
      "description": "The reason that the Order was cancelled.",
      "enum": [
        "INTERNAL_SERVER_ERROR",
        "ACCOUNT_LOCKED",
        "ACCOUNT_NEW_POSITIONS_LOCKED",
        "ACCOUNT_ORDER_CREATION_LOCKED",
        "ACCOUNT_ORDER_FILL_LOCKED",
        "CLIENT_REQUEST",
        "MIGRATION",
        "MARKET_HALTED",
        "LINKED_TRADE_CLOSED",
        "TIME_IN_FORCE_EXPIRED",
        "INSUFFICIENT_MARGIN",
        "FIFO_VIOLATION",
        "BOUNDS_VIOLATION",
        "CLIENT_REQUEST_REPLACED",
        "INSUFFICIENT_LIQUIDITY",
        "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_IN_PAST",
        "TAKE_PROFIT_ON_FILL_LOSS",
        "LOSING_TAKE_PROFIT",
        "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST",
        "STOP_LOSS_ON_FILL_LOSS",
        "STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED",
        "STOP_LOSS_ON_FILL_REQUIRED",
        "STOP_LOSS_ON_FILL_GUARANTEED_REQUIRED",
        "STOP_LOSS_ON_FILL_GUARANTEED_NOT_ALLOWED",
        "STOP_LOSS_ON_FILL_GUARANTEED_MINIMUM_DISTANCE_NOT_MET",
        "STOP_LOSS_ON_FILL_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED",
        "STOP_LOSS_ON_FILL_GUARANTEED_HEDGING_NOT_ALLOWED",
        "STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID",
        "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID",
        "TAKE_PROFIT_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED",
        "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST",
        "CLIENT_TRADE_ID_ALREADY_EXISTS",
        "POSITION_CLOSEOUT_FAILED",
        "OPEN_TRADES_ALLOWED_EXCEEDED",
        "PENDING_ORDERS_ALLOWED_EXCEEDED",
        "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS",
        "STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS",
        "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS",
        "POSITION_SIZE_EXCEEDED",
        "HEDGING_GSLO_VIOLATION",
        "ACCOUNT_POSITION_VALUE_LIMIT_EXCEEDED",
        "INSTRUMENT_BID_REDUCE_ONLY",
        "INSTRUMENT_ASK_REDUCE_ONLY",
        "INSTRUMENT_BID_HALTED",
        "INSTRUMENT_ASK_HALTED",
        "STOP_LOSS_ON_FILL_GUARANTEED_BID_HALTED",
        "STOP_LOSS_ON_FILL_GUARANTEED_ASK_HALTED"
      ]
    },
    "replacedByOrderID": {
      "type": "string",
      "description": "The ID of the Order that replaced this Order (only provided if this Order was cancelled for replacement).",
      "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."
    }
  }
}