interfaces:
  - module_name: "Accounts"
    description: "Interface for Oanda accounts."
    docs_link: "https://developer.oanda.com/rest-live-v20/account-ep/"
    functions:
      - function_name: "list"
        description: "Get a list of accounts."
        http_method: "GET"
        path: "/accounts"
        response_schema: "ListAccounts"
      - function_name: "find"
        description: "Fetch an account."
        http_method: "GET"
        path: "/accounts/:account_id"
        response_schema: "FindAccount"
        arguments:
          - name: "account_id"
            type: "string"
      - function_name: "summary"
        description: "Get a summary of an account."
        http_method: "GET"
        path: "/accounts/:account_id/summary"
        response_schema: "AccountSummary"
        arguments:
          - name: "account_id"
            type: "string"
      - function_name: "list_instruments"
        description: "Get a list of tradeable instruments for the given account."
        http_method: "GET"
        path: "/accounts/:account_id/instruments"
        response_schema: "AccountInstruments"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "instruments"
            type: "string"
            doc: "A comma separated list of instrument names."
      - function_name: "update"
        description: "Update an account."
        http_method: "PATCH"
        path: "/accounts/:account_id/configuration"
        request_schema: "UpdateAccount"
        response_schema: "UpdateAccount"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "body"
            type: "map"
      - function_name: "list_changes"
        description: "Get a list of changes to an account."
        http_method: "GET"
        path: "/accounts/:account_id/changes"
        response_schema: "AccountChanges"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "since_transaction_id"
            type: "string"
            doc: "ID of the Transaction to get Account changes since."
            required: true
  - module_name: "Instruments"
    description: "Interface for Oanda instruments."
    docs_link: "https://developer.oanda.com/rest-live-v20/instrument-ep/"
    functions:
      - function_name: "list_candles"
        description: "Get candlestick data for an instrument."
        http_method: "GET"
        path: "/instruments/:instrument/candles"
        response_schema: "ListCandles"
        arguments:
          - name: "instrument"
            type: "string"
        parameters:
          - name: "price"
            type: "string"
            doc: "The Price component(s) to get candlestick data for."
            default: "M"
          - name: "granularity"
            type: "string"
            doc: "The granularity of the candlesticks to fetch."
            default: "S5"
          - name: "count"
            type: "non_neg_integer"
            doc: "The number of candles to return, maximum 5000."
            default: 500
          - name: "from"
            type: "string"
            doc: "The start of the time range to fetch candlesticks for using either RFC 3339 or Unix format."
          - name: "to"
            type: "string"
            doc: "The end of the time range to fetch candlesticks for using either RFC 3339 or Unix format."
          - name: "smooth"
            type: "boolean"
            doc: "A flag that controls whether the candlestick is smoothed or not."
            default: false
          - name: "include_first"
            type: "boolean"
            doc: "A flag that controls whether the candlestick that is covered by the from time should be included in the results."
            default: true
          - name: "daily_alignment"
            type: "non_neg_integer"
            doc: "The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23."
            default: 17
          - name: "alignment_timezone"
            type: "string"
            doc: "The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC."
            default: "America/New_York"
          - name: "weekly_alignment"
            type: "string"
            doc: "The day of the week used for granularities that have weekly alignment."
            default: "Friday"
  - module_name: "Orders"
    description: "Interface for Oanda orders."
    docs_link: "https://developer.oanda.com/rest-live-v20/order-ep/"
    functions:
      - function_name: "create"
        description: "Create an order for an account."
        http_method: "POST"
        path: "/accounts/:account_id/orders"
        request_schema: "CreateOrder"
        response_schema: "CreateOrder"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "body"
            type: "map"
      - function_name: "list"
        description: "Get a list of orders for an account."
        http_method: "GET"
        path: "/accounts/:account_id/orders"
        response_schema: "ListOrders"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "ids"
            type: "string"
            doc: "List of Order IDs to retrieve."
          - name: "state"
            type: "string"
            doc: "The state to filter the requested Orders by."
          - name: "instrument"
            type: "string"
            doc: "The instrument to filter the requested orders by."
          - name: "count"
            type: "non_neg_integer"
            doc: "The maximum number of Orders to return."
            default: 50
          - name: "before_id"
            type: "string"
            doc: "The maximum Order ID to return. If not provided the most recent Orders in the Account are returned."
      - function_name: "list_pending"
        description: "Get a list of pending orders for an account."
        http_method: "GET"
        path: "/accounts/:account_id/pendingOrders"
        response_schema: "ListPendingOrders"
        arguments:
          - name: "account_id"
            type: "string"
      - function_name: "find"
        description: "Get details for a single order in an account."
        http_method: "GET"
        path: "/accounts/:account_id/orders/:order_id"
        response_schema: "FindOrder"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "order_id"
            type: "string"
      - function_name: "replace"
        description: "Replace an order in an account by simultaneously cancelling it and creating a replacement order."
        http_method: "PUT"
        path: "/accounts/:account_id/orders/:order_id"
        request_schema: "ReplaceOrder"
        response_schema: "ReplaceOrder"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "order_id"
            type: "string"
          - name: "body"
            type: "map"
      - function_name: "cancel"
        description: "Cancel a pending order in an account."
        http_method: "PUT"
        path: "/accounts/:account_id/orders/:order_id/cancel"
        response_schema: "CancelOrder"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "order_id"
            type: "string"
      - function_name: "modify_client_extensions"
        description: "Update the Client Extensions for an Order in an Account. Do not set, modify, or delete clientExtensions if your account is associated with MT4."
        http_method: "PUT"
        path: "/accounts/:account_id/orders/:order_id/clientExtensions"
        request_schema: "OrderModifyClientExtensions"
        response_schema: "OrderModifyClientExtensions"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "order_id"
            type: "string"
          - name: "body"
            type: "map"
  - module_name: "Trades"
    description: "Interface for Oanda trades."
    docs_link: "https://developer.oanda.com/rest-live-v20/trade-ep/"
    functions:
      - function_name: "list"
        description: "Get a list of trades for an account."
        http_method: "GET"
        path: "/accounts/:account_id/trades"
        response_schema: "ListTrades"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "ids"
            type: "string"
            doc: "List of Trade IDs to retrieve."
          - name: "state"
            type: "string"
            doc: "The state to filter the requested Trades by."
          - name: "instrument"
            type: "string"
            doc: "The instrument to filter the requested trades by."
          - name: "count"
            type: "non_neg_integer"
            doc: "The maximum number of Trades to return."
            default: 50
          - name: "before_id"
            type: "string"
            doc: "The maximum Trade ID to return. If not provided the most recent Trades in the Account are returned."
      - function_name: "list_open"
        description: "Get a list of open trades for an account."
        http_method: "GET"
        path: "/accounts/:account_id/openTrades"
        response_schema: "ListTrades"
        arguments:
          - name: "account_id"
            type: "string"
      - function_name: "find"
        description: "Get details for a single trade in an account."
        http_method: "GET"
        path: "/accounts/:account_id/trades/:trade_id"
        response_schema: "FindTrade"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "trade_id"
            type: "string"
      - function_name: "close"
        description: "Close (partially or fully) a specific open Trade in an Account."
        http_method: "PUT"
        path: "/accounts/:account_id/trades/:trade_id/close"
        request_schema: "CloseTrade"
        response_schema: "CloseTrade"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "trade_id"
            type: "string"
          - name: "body"
            type: "map"
      - function_name: "modify_client_extensions"
        description: "Update the Client Extensions for a Trade. Do not set, modify, or delete clientExtensions if your account is associated with MT4."
        http_method: "PUT"
        path: "/accounts/:account_id/trades/:trade_id/clientExtensions"
        request_schema: "TradeModifyClientExtensions"
        response_schema: "TradeModifyClientExtensions"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "trade_id"
            type: "string"
          - name: "body"
            type: "map"
      - function_name: "update"
        description: "Create, replace and cancel a Trade's dependent Orders (Take Profit, Stop Loss and Trailing Stop Loss) through the Trade itself."
        http_method: "PUT"
        path: "/accounts/:account_id/trades/:trade_id/orders"
        request_schema: "UpdateTrade"
        response_schema: "UpdateTrade"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "trade_id"
            type: "string"
          - name: "body"
            type: "map"
  - module_name: "Positions"
    description: "Interface for Oanda positions."
    docs_link: "https://developer.oanda.com/rest-live-v20/position-ep/"
    functions:
      - function_name: "list"
        description: "Get a list of positions for an account."
        http_method: "GET"
        path: "/accounts/:account_id/positions"
        response_schema: "ListPositions"
        arguments:
          - name: "account_id"
            type: "string"
      - function_name: "list_open"
        description: "Get a list of open positions for an account."
        http_method: "GET"
        path: "/accounts/:account_id/openPositions"
        response_schema: "ListPositions"
        arguments:
          - name: "account_id"
            type: "string"
      - function_name: "find"
        description: "Get the details of a single instrument's position in an account."
        http_method: "GET"
        path: "/accounts/:account_id/positions/:instrument"
        response_schema: "ListPositions"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "instrument"
            type: "string"
      - function_name: "close"
        description: "Closeout the open Position for a specific instrument in an Account."
        http_method: "PUT"
        path: "/accounts/:account_id/positions/:instrument/close"
        request_schema: "ClosePosition"
        response_schema: "ClosePosition"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "instrument"
            type: "string"
          - name: "body"
            type: "string"
  - module_name: "Transactions"
    description: "Interface for Oanda transactions."
    docs_link: "https://developer.oanda.com/rest-live-v20/transaction-ep/"
    functions:
      - function_name: "list"
        description: "Get a list of transactions for an account."
        http_method: "GET"
        path: "/accounts/:account_id/transactions"
        response_schema: "ListTransactions"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "from"
            type: "string"
            doc: "The starting time (inclusive) of the time range for the Transactions being queried. Defaults to account creation time."
          - name: "to"
            type: "string"
            doc: "The ending time (inclusive) of the time range for the Transactions being queried. Defaults to current time."
          - name: "page_size"
            type: "non_neg_integer"
            doc: "The number of Transactions to include in each page. [default=100, maximum=1000]."
            default: 100
          - name: "type"
            type: "string"
            doc: "A filter for restricting the types of Transactions to retrieve."
      - function_name: "find"
        description: "Get the details of a single transaction in an account."
        http_method: "GET"
        path: "/accounts/:account_id/transactions/:transaction_id"
        response_schema: "FindTransaction"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "transaction_id"
            type: "string"
      - function_name: "list_id_range"
        description: "Get a list of transactions for an account within a specific TransactionID range."
        http_method: "GET"
        path: "/accounts/:account_id/transactions/idrange"
        response_schema: "ListTransactionsIdRange"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "from"
            type: "string"
            doc: "The starting TransactionID (inclusive) to fetch."
          - name: "to"
            type: "string"
            doc: "The ending TransactionID (inclusive) to fetch."
          - name: "type"
            type: "string"
            doc: "A filter for restricting the types of Transactions to retrieve."
      - function_name: "list_since_id"
        description: "Get a list of transactions for an account since a specific TransactionID."
        http_method: "GET"
        path: "/accounts/:account_id/transactions/sinceid"
        response_schema: "ListTransactionsIdRange"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "transaction_id"
            type: "string"
        parameters:
          - name: "type"
            type: "string"
            doc: "A filter for restricting the types of Transactions to retrieve."
  - module_name: "Pricing"
    description: "Interface for Oanda pricing."
    docs_link: "https://developer.oanda.com/rest-live-v20/pricing-ep/"
    functions:
      - function_name: "list_latest"
        description: "Get most recently completed candles within an account for specified combinations of instrument, granularity and price component."
        http_method: "GET"
        path: "/accounts/:account_id/candles/latest"
        response_schema: "LatestCandles"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "candle_specifications"
            type: "string"
            doc: "The specification of the candles to fetch."
            required: true
          - name: "units"
            type: "string"
            doc: "The number of units used to calculate the volume-weighted average bid and ask prices."
            default: 1
          - name: "smooth"
            type: "boolean"
            doc: "A flag that controls whether the candlestick is smoothed or not."
            default: false
          - name: "daily_alignment"
            type: "non_neg_integer"
            doc: "The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23."
            default: 17
          - name: "alignment_timezone"
            type: "string"
            doc: "The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC."
            default: "America/New_York"
          - name: "weekly_alignment"
            type: "string"
            doc: "The day of the week used for granularities that have weekly alignment."
            default: "Friday"
      - function_name: "list"
        description: "Get pricing information for a list of instruments."
        http_method: "GET"
        path: "/accounts/:account_id/pricing"
        response_schema: "ListPricing"
        arguments:
          - name: "account_id"
            type: "string"
        parameters:
          - name: "instruments"
            type: "string"
            doc: "A comma separated list of instrument names."
            required: true
          - name: "since"
            type: "string"
            doc: "The time of the snapshot to fetch using either RFC 3339 or Unix format. If not specified, then the most recent snapshot is fetched."
          - name: "include_units_available"
            type: "boolean"
            doc: "Flag that enables the inclusion of the unitsAvailable field in the returned Price objects."
            default: false
          - name: "include_home_conversion"
            type: "boolean"
            doc: "Flag that enables the inclusion of the homeConversions field in the returned response."
            default: false
      - function_name: "list_candles"
        description: "Fetch candlestick data for an instrument."
        http_method: "GET"
        path: "/accounts/:account_id/instruments/:instrument/candles"
        response_schema: "ListCandles"
        arguments:
          - name: "account_id"
            type: "string"
          - name: "instrument"
            type: "string"
        parameters:
          - name: "price"
            type: "string"
            doc: "The Price component(s) to get candlestick data for."
            default: "M"
          - name: "granularity"
            type: "string"
            doc: "The granularity of the candlesticks to fetch."
            default: "S5"
          - name: "count"
            type: "non_neg_integer"
            doc: "The number of candles to return, maximum 5000."
            default: 500
          - name: "from"
            type: "string"
            doc: "The start of the time range to fetch candlesticks for using either RFC 3339 or Unix format."
          - name: "to"
            type: "string"
            doc: "The end of the time range to fetch candlesticks for using either RFC 3339 or Unix format."
          - name: "smooth"
            type: "boolean"
            doc: "A flag that controls whether the candlestick is smoothed or not."
            default: false
          - name: "include_first"
            type: "boolean"
            doc: "A flag that controls whether the candlestick that is covered by the from time should be included in the results."
            default: true
          - name: "daily_alignment"
            type: "non_neg_integer"
            doc: "The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23."
            default: 17
          - name: "alignment_timezone"
            type: "string"
            doc: "The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC."
            default: "America/New_York"
          - name: "weekly_alignment"
            type: "string"
            doc: "The day of the week used for granularities that have weekly alignment."
            default: "Friday"
          - name: "units"
            type: "string"
            doc: "The number of units used to calculate the volume-weighted average bid and ask prices."
            default: 1
