# Oanda Forex Trading

## Links

- Product page URL: https://www.agentpmt.com/marketplace/oanda-forex-trading-2
- Product markdown URL: https://www.agentpmt.com/marketplace/oanda-forex-trading-2?format=agent-md
- Product JSON URL: https://www.agentpmt.com/marketplace/oanda-forex-trading-2?format=agent-json

## Overview

- Product ID: 695bcfa7fd8fabfb3ce3dd6a
- Vendor: Apoth3osis
- Type: connector
- Unit type: request
- Price: 200 credits
- Categories: Financial Modeling, Financial Data, Forex Trading & Data, Stock Market Data & Quotes, Cryptocurrency Trading & Data, Order Execution & Brokerage, Fundamental Analysis & Company Data, Backtesting & Strategy Development
- Generated at: 2026-04-15T18:28:05.281Z

### Page Description

OANDA Forex is a comprehensive foreign exchange trading interface that connects AI agents and automation workflows to OANDA's REST v20 API for real-time currency trading and market data access. It provides a simplified action-based abstraction over OANDA's trading platform, supporting both practice accounts for paper trading and live accounts for real money transactions. Market data capabilities include fetching real-time bid and ask prices with spread calculations for single or multiple currency pairs, as well as historical candlestick data across 21 granularities ranging from 5-second intervals to monthly bars with up to 5000 candles per request. Account management functions retrieve balance, margin, net asset value, unrealized and realized profit and loss, open trade counts, and pending order status. The trading engine supports market orders for immediate execution, limit orders for price-targeted entries, and stop orders for breakout or momentum strategies, all with optional take profit and stop loss levels attached at order creation. Position and order management includes viewing open positions and trades, modifying pending order parameters, canceling unfilled orders, and closing positions either by instrument or by individual trade ID.  It is highly recommended that you perform extensive testing with demo accounts before placing any live orders.

### Agent Description

Trade forex via OANDA. Real-time prices, historical candles, order management, positions. Supports demo and live accounts.

## Details Tab

### Details

OANDA Forex is a comprehensive foreign exchange trading interface that connects AI agents and automation workflows to OANDA's REST v20 API for real-time currency trading and market data access. It provides a simplified action-based abstraction over OANDA's trading platform, supporting both practice accounts for paper trading and live accounts for real money transactions. Market data capabilities include fetching real-time bid and ask prices with spread calculations for single or multiple currency pairs, as well as historical candlestick data across 21 granularities ranging from 5-second intervals to monthly bars with up to 5000 candles per request. Account management functions retrieve balance, margin, net asset value, unrealized and realized profit and loss, open trade counts, and pending order status. The trading engine supports market orders for immediate execution, limit orders for price-targeted entries, and stop orders for breakout or momentum strategies, all with optional take profit and stop loss levels attached at order creation. Position and order management includes viewing open positions and trades, modifying pending order parameters, canceling unfilled orders, and closing positions either by instrument or by individual trade ID.  It is highly recommended that you perform extensive testing with demo accounts before placing any live orders.

### Actions

- `get_price` (2 credits): Get current bid/ask pricing for one or more currency pairs. Returns bid, ask, spread, timestamp, and tradeability status.
- `get_candles` (2 credits): Get historical candlestick (OHLCV) data for a single instrument across 21 granularities from 5-second to monthly bars.
- `get_account_summary` (2 credits): Get account overview including balance, margin, NAV, unrealized/realized P&L, and open trade/position/order counts. Credentials provided automatically.
- `get_positions` (2 credits): Get all currently open positions with instrument, long/short units, average prices, and unrealized/realized P&L.
- `get_trades` (2 credits): Get all currently open trades with trade ID, instrument, units, entry price, unrealized/realized P&L, margin used, and attached order IDs.
- `get_pending_orders` (2 credits): Get all pending (unfilled) orders with order ID, type, instrument, units, price, time-in-force, and attached conditions.
- `place_market_order` (2 credits): Execute a trade immediately at the current market price. Positive units = buy/long, negative units = sell/short.
- `place_limit_order` (2 credits): Place an order to execute when price reaches a specified level or better. Remains active until filled or cancelled (GTC).
- `place_stop_order` (2 credits): Place an order that triggers when price reaches a specified level. Useful for breakout strategies. Remains active until triggered or cancelled (GTC).
- `modify_order` (2 credits): Modify a pending order's price, units, or trailing stop distance. Automatically detects order type and applies appropriate modification.
- `cancel_order` (2 credits): Cancel a pending (unfilled) order by its ID.
- `close_position` (2 credits): Close the entire position (both long and short sides) for a specific instrument. Returns details of closed sides and total P&L.
- `close_trade` (2 credits): Close a specific individual trade by its ID. Returns closing price, units closed, and realized P&L.

### Use Cases

Forex trading automation, currency trading bot, FX trading API, OANDA API integration, foreign exchange automation, algorithmic forex trading, automated currency trading, forex market data, real-time forex prices, currency pair quotes, bid ask spread, EUR USD trading, GBP JPY trading, forex candlestick data, OHLC data retrieval, historical forex data, forex price history, candlestick charting data, forex account management, trading account balance, margin monitoring, unrealized PnL tracking, open position monitoring, trade management, pending order management, market order execution, limit order placement, stop order trading, take profit automation, stop loss automation, forex risk management, close forex position, close trade by ID, cancel pending order, modify order price, paper trading forex, practice account trading, live forex trading, forex backtesting data, currency pair analysis, forex spread monitoring, multi-currency pricing, forex portfolio tracking, margin available check, forex transaction history, AI forex trading, LLM trading integration, automated FX strategy, forex webhook automation, currency arbitrage data

### Workflows Using This Tool

No public workflows currently reference this product.

### Related Content

No related content is currently linked to this product.

## Advanced Tab

### DynamicMCP

- Setup page URL: https://www.agentpmt.com/dynamic-mcp
- Claude setup guide: https://www.agentpmt.com/dynamic-mcp?platform=claude#videos
- ChatGPT setup guide: https://www.agentpmt.com/dynamic-mcp?platform=chatgpt#videos
- Cursor setup guide: https://www.agentpmt.com/dynamic-mcp?platform=cursor#videos
- Windsurf setup guide: https://www.agentpmt.com/dynamic-mcp?platform=windsurf#videos

STDIO connector for Claude Code, Codex, Cursor, Zed, and other LLMs that require STDIO or custom connections. This lightweight connector routes requests to `https://api.agentpmt.com/mcp`. All tool execution happens in the cloud and the server cannot edit any files on your computer.

```bash
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

### REST API

The live page renders cURL, Python, JavaScript, and Node.js examples. Logged-in users see those examples prefilled with their own API and budget credentials.

- Purchase endpoint: https://api.agentpmt.com/products/purchase
- Authorization format: `Bearer <base64(apiKey:budgetKey)>`

```bash
curl -X POST "https://api.agentpmt.com/products/purchase" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eW91ci1hcGkta2V5LWhlcmU6eW91ci1idWRnZXQta2V5LWhlcmU=" \
  -d '{
    "product_id": "695bcfa7fd8fabfb3ce3dd6a",
    "parameters": {
      "action": "get_price"
    }
  }'
```

### Autonomous Agents

Do not use the abbreviated instructions in this product markdown for wallet-based invocation. Retrieve the full External Agent API markdown document instead.

- External Agent API page URL: https://www.agentpmt.com/external-agent-api
- External Agent API markdown URL: https://www.agentpmt.com/external-agent-api?format=agent-md

### Schema

#### Credentials

These runtime credentials should be provided under `parameters._credentials` when required.

- OANDA API Key (`oanda-api-key`, api_key, required)
  Help: Create a key in your OANDA account settings (choose the one that matches your selected environment).
  Connection ID: 695bf7f30b303aa9db0412c3
- OANDA Account Number (`oanda-account-number`, text, required)
  Help: Your OANDA account number for the selected environment.
  Connection ID: 695bf7f30b303aa9db0412c3
- Environment (`oanda-environment`, select, required)
  Help: Choose whether to connect to the practice or live environment.
  Connection ID: 695bf7f30b303aa9db0412c3

#### Parameters

- Schema type: actions

```json
{
  "actions": {
    "get_price": {
      "description": "Get current bid/ask pricing for one or more currency pairs. Returns bid, ask, spread, timestamp, and tradeability status.",
      "properties": {
        "instrument": {
          "type": "string",
          "description": "Single trading instrument/currency pair in OANDA format (e.g., 'EUR_USD', 'GBP_JPY'). Provide instrument or instruments.",
          "required": false
        },
        "instruments": {
          "type": "array",
          "description": "List of trading instruments for batch pricing (e.g., ['EUR_USD', 'GBP_USD', 'USD_JPY']). Provide instrument or instruments.",
          "required": false,
          "items": {
            "type": "string"
          }
        }
      }
    },
    "get_candles": {
      "description": "Get historical candlestick (OHLCV) data for a single instrument across 21 granularities from 5-second to monthly bars.",
      "properties": {
        "instrument": {
          "type": "string",
          "description": "Currency pair in OANDA format (e.g., 'EUR_USD').",
          "required": true
        },
        "granularity": {
          "type": "string",
          "description": "Candle time granularity. Seconds: S5, S10, S15, S30. Minutes: M1, M2, M4, M5, M10, M15, M30. Hours: H1, H2, H3, H4, H6, H8, H12. Other: D (daily), W (weekly), M (monthly).",
          "required": true,
          "enum": [
            "S5",
            "S10",
            "S15",
            "S30",
            "M1",
            "M2",
            "M4",
            "M5",
            "M10",
            "M15",
            "M30",
            "H1",
            "H2",
            "H3",
            "H4",
            "H6",
            "H8",
            "H12",
            "D",
            "W",
            "M"
          ]
        },
        "count": {
          "type": "integer",
          "description": "Number of candles to retrieve (default: 100, max: 5000).",
          "required": false,
          "default": 100,
          "minimum": 1,
          "maximum": 5000
        }
      }
    },
    "get_account_summary": {
      "description": "Get account overview including balance, margin, NAV, unrealized/realized P&L, and open trade/position/order counts. Credentials provided automatically."
    },
    "get_positions": {
      "description": "Get all currently open positions with instrument, long/short units, average prices, and unrealized/realized P&L."
    },
    "get_trades": {
      "description": "Get all currently open trades with trade ID, instrument, units, entry price, unrealized/realized P&L, margin used, and attached order IDs."
    },
    "get_pending_orders": {
      "description": "Get all pending (unfilled) orders with order ID, type, instrument, units, price, time-in-force, and attached conditions."
    },
    "place_market_order": {
      "description": "Execute a trade immediately at the current market price. Positive units = buy/long, negative units = sell/short.",
      "properties": {
        "instrument": {
          "type": "string",
          "description": "Currency pair (e.g., 'EUR_USD').",
          "required": true
        },
        "units": {
          "type": "integer",
          "description": "Number of units to trade. Positive = buy/long, negative = sell/short. Example: 10000 to buy, -5000 to sell.",
          "required": true
        },
        "take_profit_price": {
          "type": "number",
          "description": "Take profit price level. Automatically creates a take profit order on fill.",
          "required": false
        },
        "stop_loss_price": {
          "type": "number",
          "description": "Stop loss price level. Cannot be used with stop_loss_distance.",
          "required": false
        },
        "stop_loss_distance": {
          "type": "number",
          "description": "Stop loss as price distance instead of absolute price. Cannot be used with stop_loss_price.",
          "required": false
        }
      }
    },
    "place_limit_order": {
      "description": "Place an order to execute when price reaches a specified level or better. Remains active until filled or cancelled (GTC).",
      "properties": {
        "instrument": {
          "type": "string",
          "description": "Currency pair (e.g., 'EUR_USD').",
          "required": true
        },
        "units": {
          "type": "integer",
          "description": "Number of units. Positive = buy, negative = sell.",
          "required": true
        },
        "price": {
          "type": "number",
          "description": "The limit price at which to execute.",
          "required": true
        },
        "take_profit_price": {
          "type": "number",
          "description": "Take profit price to attach on fill.",
          "required": false
        },
        "stop_loss_price": {
          "type": "number",
          "description": "Stop loss price to attach on fill. Cannot be used with stop_loss_distance.",
          "required": false
        },
        "stop_loss_distance": {
          "type": "number",
          "description": "Stop loss distance to attach on fill. Cannot be used with stop_loss_price.",
          "required": false
        }
      }
    },
    "place_stop_order": {
      "description": "Place an order that triggers when price reaches a specified level. Useful for breakout strategies. Remains active until triggered or cancelled (GTC).",
      "properties": {
        "instrument": {
          "type": "string",
          "description": "Currency pair (e.g., 'USD_JPY').",
          "required": true
        },
        "units": {
          "type": "integer",
          "description": "Number of units. Positive = buy, negative = sell.",
          "required": true
        },
        "price": {
          "type": "number",
          "description": "The trigger price for the stop order.",
          "required": true
        },
        "take_profit_price": {
          "type": "number",
          "description": "Take profit price to attach on fill.",
          "required": false
        },
        "stop_loss_price": {
          "type": "number",
          "description": "Stop loss price to attach on fill. Cannot be used with stop_loss_distance.",
          "required": false
        },
        "stop_loss_distance": {
          "type": "number",
          "description": "Stop loss distance to attach on fill. Cannot be used with stop_loss_price.",
          "required": false
        }
      }
    },
    "modify_order": {
      "description": "Modify a pending order's price, units, or trailing stop distance. Automatically detects order type and applies appropriate modification.",
      "properties": {
        "order_id": {
          "type": "string",
          "description": "The order ID to modify (get from get_pending_orders).",
          "required": true
        },
        "price": {
          "type": "number",
          "description": "New price level for limit/stop/take-profit/stop-loss orders.",
          "required": false
        },
        "units": {
          "type": "integer",
          "description": "New unit amount for limit/stop orders.",
          "required": false
        },
        "trailing_stop_distance": {
          "type": "number",
          "description": "New trailing distance for trailing stop loss orders.",
          "required": false
        },
        "stop_loss_distance": {
          "type": "number",
          "description": "New stop loss distance for stop loss orders. Cannot be used with price for stop loss modifications.",
          "required": false
        }
      }
    },
    "cancel_order": {
      "description": "Cancel a pending (unfilled) order by its ID.",
      "properties": {
        "order_id": {
          "type": "string",
          "description": "The order ID to cancel (get from get_pending_orders).",
          "required": true
        }
      }
    },
    "close_position": {
      "description": "Close the entire position (both long and short sides) for a specific instrument. Returns details of closed sides and total P&L.",
      "properties": {
        "instrument": {
          "type": "string",
          "description": "Currency pair to close (e.g., 'EUR_USD').",
          "required": true
        }
      }
    },
    "close_trade": {
      "description": "Close a specific individual trade by its ID. Returns closing price, units closed, and realized P&L.",
      "properties": {
        "trade_id": {
          "type": "string",
          "description": "The trade ID to close (get from get_trades).",
          "required": true
        }
      }
    }
  },
  "properties": {}
}
```

### Usage Instructions

# Oanda Forex Trading - Tool Instructions

## Overview

Trade forex currencies and access real-time market data through the OANDA platform. This tool supports live and practice trading environments, covering market data retrieval, account management, order placement, and position/trade management. Credentials are provided automatically when connected.

## Instrument Format

Currency pairs use underscore-separated format: `EUR_USD`, `GBP_JPY`, `USD_CAD`, `AUD_NZD`, etc.

---

## Actions

### get_price

Get current bid/ask pricing for one or more currency pairs.

**Required fields (at least one):**
- `instrument` (string) - Single currency pair, e.g. `EUR_USD`
- `instruments` (array of strings) - Multiple currency pairs for batch pricing

Returns bid, ask, spread, timestamp, and whether the instrument is currently tradeable.

**Example:**
```json
{
  "action": "get_price",
  "instruments": ["EUR_USD", "GBP_USD", "USD_JPY"]
}
```

---

### get_candles

Get historical candlestick (OHLCV) data for a single instrument.

**Required fields:**
- `instrument` (string) - Currency pair, e.g. `EUR_USD`
- `granularity` (string) - Time interval per candle. Options: `S5`, `S10`, `S15`, `S30` (seconds), `M1`, `M2`, `M4`, `M5`, `M10`, `M15`, `M30` (minutes), `H1`, `H2`, `H3`, `H4`, `H6`, `H8`, `H12` (hours), `D` (daily), `W` (weekly), `M` (monthly)

**Optional fields:**
- `count` (integer) - Number of candles to retrieve. Default: 100. Range: 1-5000.

Returns open, high, low, close, volume, and timestamp for each candle.

**Example:**
```json
{
  "action": "get_candles",
  "instrument": "EUR_USD",
  "granularity": "H1",
  "count": 50
}
```

---

### get_account_summary

Get account overview including balance, margin, and profit/loss information.

**Required fields:** None (credentials are provided automatically).

Returns balance, NAV, unrealized P&L, realized P&L, margin used, margin available, open trade count, open position count, and pending order count.

**Example:**
```json
{
  "action": "get_account_summary"
}
```

---

### get_positions

Get all currently open positions.

**Required fields:** None.

Returns a list of open positions with instrument, long/short units, average prices, and unrealized/realized P&L for each side.

**Example:**
```json
{
  "action": "get_positions"
}
```

---

### get_trades

Get all currently open trades with details.

**Required fields:** None.

Returns trade ID, instrument, units, entry price, unrealized/realized P&L, margin used, open time, and any attached take-profit or stop-loss order IDs.

**Example:**
```json
{
  "action": "get_trades"
}
```

---

### get_pending_orders

Get all pending (unfilled) orders.

**Required fields:** None.

Returns order ID, type, instrument, units, price, time-in-force, and any attached take-profit or stop-loss conditions.

**Example:**
```json
{
  "action": "get_pending_orders"
}
```

---

### place_market_order

Execute a trade immediately at the current market price.

**Required fields:**
- `instrument` (string) - Currency pair, e.g. `EUR_USD`
- `units` (integer) - Number of units. Positive = buy/long, negative = sell/short. Example: `10000` to buy, `-5000` to sell.

**Optional fields:**
- `take_profit_price` (number) - Automatically attach a take-profit order at this price
- `stop_loss_price` (number) - Automatically attach a stop-loss order at this price
- `stop_loss_distance` (number) - Stop loss as a price distance instead of absolute price (cannot use both stop_loss_price and stop_loss_distance)

**Example - Buy with risk management:**
```json
{
  "action": "place_market_order",
  "instrument": "EUR_USD",
  "units": 10000,
  "take_profit_price": 1.0950,
  "stop_loss_price": 1.0850
}
```

**Example - Sell (short):**
```json
{
  "action": "place_market_order",
  "instrument": "GBP_USD",
  "units": -5000
}
```

---

### place_limit_order

Place an order to execute when the price reaches a specified level or better. The order remains active until filled or cancelled.

**Required fields:**
- `instrument` (string) - Currency pair
- `units` (integer) - Positive = buy, negative = sell
- `price` (number) - The limit price at which to execute

**Optional fields:**
- `take_profit_price` (number) - Take-profit price to attach on fill
- `stop_loss_price` (number) - Stop-loss price to attach on fill
- `stop_loss_distance` (number) - Stop-loss distance to attach on fill

**Example:**
```json
{
  "action": "place_limit_order",
  "instrument": "EUR_USD",
  "units": 10000,
  "price": 1.0800,
  "take_profit_price": 1.0900,
  "stop_loss_price": 1.0750
}
```

---

### place_stop_order

Place an order that triggers when the price reaches a specified level. Useful for breakout strategies. The order remains active until triggered or cancelled.

**Required fields:**
- `instrument` (string) - Currency pair
- `units` (integer) - Positive = buy, negative = sell
- `price` (number) - The trigger price

**Optional fields:**
- `take_profit_price` (number) - Take-profit price to attach on fill
- `stop_loss_price` (number) - Stop-loss price to attach on fill
- `stop_loss_distance` (number) - Stop-loss distance to attach on fill

**Example:**
```json
{
  "action": "place_stop_order",
  "instrument": "USD_JPY",
  "units": 5000,
  "price": 150.50,
  "stop_loss_distance": 0.50
}
```

---

### modify_order

Modify the price, units, or trailing stop distance of an existing pending order. The tool automatically detects the order type and applies the appropriate modification.

**Required fields:**
- `order_id` (string) - The order ID to modify (get from `get_pending_orders`)

**Optional fields (at least one required for limit/stop/market-if-touched orders):**
- `price` (number) - New price level
- `units` (integer) - New unit amount

**For trailing stop loss orders:**
- `trailing_stop_distance` (number) - New trailing distance (required)

**For stop loss orders:**
- `price` (number) - New stop loss price, OR
- `stop_loss_distance` (number) - New stop loss distance

**Example:**
```json
{
  "action": "modify_order",
  "order_id": "12345",
  "price": 1.0825
}
```

---

### cancel_order

Cancel a pending order.

**Required fields:**
- `order_id` (string) - The order ID to cancel (get from `get_pending_orders`)

**Example:**
```json
{
  "action": "cancel_order",
  "order_id": "12345"
}
```

---

### close_position

Close the entire position (both long and short sides) for a specific instrument.

**Required fields:**
- `instrument` (string) - Currency pair to close, e.g. `EUR_USD`

Returns details of closed long/short sides and total profit/loss.

**Example:**
```json
{
  "action": "close_position",
  "instrument": "EUR_USD"
}
```

---

### close_trade

Close a specific individual trade by its ID.

**Required fields:**
- `trade_id` (string) - The trade ID to close (get from `get_trades`)

Returns the closing price, units closed, and realized profit/loss.

**Example:**
```json
{
  "action": "close_trade",
  "trade_id": "67890"
}
```

---

## Common Workflows

**Check prices then trade:**
1. `get_price` to see current bid/ask for your target pair
2. `place_market_order` to enter at market, or `place_limit_order` to set a target entry

**Monitor and manage positions:**
1. `get_account_summary` to check overall account health
2. `get_positions` to see all open positions
3. `get_trades` to see individual trade details and IDs
4. `close_trade` or `close_position` to exit

**Manage pending orders:**
1. `get_pending_orders` to list all unfilled orders
2. `modify_order` to adjust price or size
3. `cancel_order` to remove an order

**Technical analysis:**
1. `get_candles` with desired granularity and count to pull historical OHLCV data
2. Analyze trends, support/resistance, or other patterns

## Important Notes

- **Units direction:** Positive units = buy/long, negative units = sell/short
- **Stop loss options:** Use either `stop_loss_price` (absolute price) or `stop_loss_distance` (relative distance), never both
- **Practice vs Live:** The environment is configured through your connected credentials. Practice uses simulated funds; live uses real money.
- **Market hours:** Forex markets are open 24/5 (Sunday evening to Friday evening UTC). Prices may not be tradeable outside these hours.
- **Order persistence:** Limit and stop orders use Good-Til-Cancelled (GTC) by default and remain active until filled or manually cancelled.
- **Price values:** All prices must be positive numbers.

### About The Developer

- Vendor name: Apoth3osis
- Website: apoth3osis.io

We build tools that enable AI agents to excel in the mathematical realm.

Our small team develops experimental and unique solutions in the AI arena, with a strong focus on modular computing for agentic applications and custom model deployment. We have handled projects for a variety of applications across many sectors, from algorithmic trading and financial analysis, to molecular simulations and predictions, to habitat and biodiversity monitoring and wildlife conservation.

### Frequently Asked Questions

No linked FAQs are currently available.

### Dependencies

This product has no public dependency products.