API v2Trading API

Market

Quotes, OHLC bars, symbol contract specs.

OHLC bars for a symbol and timeframe.

Returns one candle per bar in the requested window. Fields: time (bar open, server time), open, high, low, close, tickVolume, realVolume, spread.

MT5 fetches missing history from the broker on demand, so wide ranges on small timeframes can take several seconds. An empty response is normal when the requested window predates the broker's retained history or covers a closed market.

GET
/PriceHistory
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Query Parameters

symbolstring

Symbol name as listed by /symbols (e.g. EURUSD).

timeframestring

Bar timeframe. MT5 labels (M1, M5, M15, M30, H1, H4, D1, W1, MN1) or human forms (5min, 1h, 1d).

from?string | null

Inclusive lower bound (broker server time). ISO-8601 or YYYY-MM-DD. Empty/absent → epoch.

to?string | null

Inclusive upper bound (broker server time). Same formats as from. Empty/absent → now.

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/PriceHistory?symbol=string&timeframe=string&from=string&to=string"
[
  {
    "close": 0.1,
    "high": 0.1,
    "low": 0.1,
    "open": 0.1,
    "realVolume": 0,
    "spread": 0,
    "tickVolume": 0,
    "time": "string"
  }
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Contract specification for a symbol.

Returns broker-side contract specs: digits, point, spread, contractSize, tickSize, tickValue, swap rates, volumeMin / volumeMax / volumeStep, tradeMode, base/quote/ profit currencies. Call this before /OrderSend to validate volumes and round prices to the right precision.

With symbols=A,B,C instead of symbol it answers for all of them in one call — {symbols: [...], errors: [{symbol, error, message}]} — and puts them all into Market Watch first, like /SymbolSelect.

GET
/SymbolInfo
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Query Parameters

symbol?string | null

Symbol name as listed by /symbols (e.g. EURUSD).

symbols?string | null

Several symbols, comma-separated (EURUSD,GBPUSD), instead of symbol — at most 100. The reply is then a SymbolInfoBulk.

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/SymbolInfo?symbol=string&symbols=string"
{
  "ask": 0.1,
  "bid": 0.1,
  "commissions": [
    {
      "chargeMode": "string",
      "currency": "string",
      "directionMode": "string",
      "entryMode": "string",
      "profitMode": "string",
      "rangeMode": "string",
      "tiers": [
        {
          "currency": "string",
          "maxValue": 0.1,
          "minValue": 0.1,
          "mode": "string",
          "rangeFrom": 0.1,
          "rangeTo": 0.1,
          "value": 0.1,
          "volumeType": "string"
        }
      ]
    }
  ],
  "contractSize": 0.1,
  "currencyBase": "string",
  "currencyMargin": "string",
  "currencyProfit": "string",
  "description": "string",
  "digits": 0,
  "expirationModes": [
    "string"
  ],
  "fillingModes": [
    "string"
  ],
  "freezeLevel": 0,
  "orderModes": [
    "string"
  ],
  "point": 0.1,
  "sessions": [
    {
      "day": "string",
      "from": "string",
      "to": "string"
    }
  ],
  "spread": 0,
  "stopsLevel": 0,
  "swapLong": 0.1,
  "swapShort": 0.1,
  "symbol": "string",
  "tickSize": 0.1,
  "tickValue": 0.1,
  "tradeMode": "string",
  "volumeMax": 0.1,
  "volumeMin": 0.1,
  "volumeStep": 0.1
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Put symbols into Market Watch, ready to trade.

A symbol outside Market Watch gets no quotes, so the first order or /SymbolInfo on it waits for its first tick. Selecting the symbols a client will trade ahead of time (a copier: its masters' symbols on every follower, at start) moves that wait out of the first trade. All symbols are selected in one pass, which then waits up to 1 s, once, for the fresh ones to quote. They stay selected.

A bulk /SymbolInfo warms symbols up the same way.

POST
/SymbolSelect
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

symbolsarray<string>

Symbol names as listed by /symbols — at most 100.

Response Body

curl -X POST "https://api.api2trade.com/v2/{account_id}/SymbolSelect" \  -H "Content-Type: application/json" \  -d '{    "symbols": [      "string"    ]  }'
[
  {
    "quoting": true,
    "selected": true,
    "symbol": "string"
  }
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Latest tick for a symbol.

Returns the most recent bid, ask, last, volume, and broker server time for symbol. If the symbol isn't yet in Market Watch it is enabled on demand, which may add a small delay on the first call.

For continuous tick streaming use the WebSocket prices topic.

GET
/getQuote
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Query Parameters

symbolstring

Symbol name as listed by /symbols (e.g. EURUSD, XAUUSD).

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/getQuote?symbol=string"
{
  "ask": 0.1,
  "bid": 0.1,
  "last": 0.1,
  "symbol": "string",
  "time": "string",
  "volume": 0
}
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}

Every symbol the broker offers — the whole catalog, not just Market Watch

Symbols with trading disabled are left out.

Use the returned names verbatim with /getQuote, /SymbolInfo, /PriceHistory, and /OrderSend. A symbol outside Market Watch has no quotes until it is added — /SymbolSelect adds several at once and waits until they quote.

GET
/symbols
X-API-Key<token>

Account owner's API key — full, or read-only (read-only keys get 403 on the trading endpoints). The ?api_key= query parameter is accepted too (WebSocket clients have no other option).

In: header

Response Body

curl -X GET "https://api.api2trade.com/v2/{account_id}/symbols"
[
  "string"
]
{
  "command_id": 0,
  "error": "string",
  "message": "string"
}