# MetaTrader 5 Market Data API

> Index of every docs page as Markdown: [llms.txt](https://fxsocket.com/docs/llms.txt). All pages in one file: [llms-full.txt](https://fxsocket.com/llms-full.txt).

Source: https://fxsocket.com/docs/mt5/market-data

Pull MetaTrader 5 market data over REST: the broker's symbol list, latest quotes, full contract specifications, OHLC price history for any timeframe, and broker server time. For a continuous tick feed, use the WebSocket prices stream instead of polling.

## How market data works on MT5

- **Real volume where the broker has it.** For exchange instruments such as stocks and futures, MT5 can carry traded volume and a last price; realVolume and last are then filled. For forex they stay 0 and tickVolume is the figure to use.
- **Same nine timeframes as MT4.** The API serves M1, M5, M15, M30, H1, H4, D1, W1 and MN1 (or 5min, 1h, 1d) on both platforms. MT5's extra intermediate timeframes such as M2 or H6 are not exposed.

Base URL: `https://api.fxsocket.com/mt5/{account_id}`

### GET /mt5/{account_id}/symbols

Names of all symbols available in Market Watch. Use the returned names verbatim with /getQuote, /SymbolInfo, /PriceHistory, and /OrderSend. Many brokers suffix their symbols (EURUSD.sd, XAUUSD.r), so discover the exact spelling here instead of assuming plain names. A symbol not in Market Watch can't stream ticks until it's added; a getQuote call enables it on demand.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/mt5/{account_id}/symbols
```

Response:

```json
["EURUSD.sd", "GBPUSD.sd", "USDJPY.sd", "XAUUSD.sd", "..."]
```

### GET /mt5/{account_id}/getQuote

Latest tick for a symbol: the most recent bid, ask, last, volume, and broker server time. If the symbol isn't yet in Market Watch it's enabled on demand, which may add a small delay on the first call. For continuous ticks use the WebSocket prices topic instead.

Parameters:

- `symbol` (required): Symbol name as listed by /symbols (e.g. EURUSD, XAUUSD).

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/mt5/{account_id}/getQuote?symbol=EURUSD"
```

Response:

```json
{
  "symbol": "EURUSD",
  "bid": 1.15325,
  "ask": 1.15333,
  "time": "2026-06-11T08:55:56.728Z",
  "last": 0.0,
  "volume": 0
}
```

### GET /mt5/{account_id}/PriceHistory

OHLC bars for a symbol and timeframe: one candle per bar in the requested window. 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 window predates the broker's retained history or covers a closed market.

Parameters:

- `symbol` (required): Symbol name as listed by /symbols.
- `timeframe` (required): MT5 labels (M1, M5, M15, M30, H1, H4, D1, W1, MN1) or human forms (5min, 1h, 1d).
- `from`: Inclusive lower bound (broker server time). ISO-8601 or YYYY-MM-DD. Absent → epoch.
- `to`: Inclusive upper bound, same formats. Absent → now.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/mt5/{account_id}/PriceHistory?symbol=EURUSD&timeframe=H1&from=2026-01-01&to=2026-12-31"
```

Response:

```json
[{
  "time": "2026-06-11T08:00:00Z",
  "open": 1.15301,
  "high": 1.15348,
  "low": 1.15289,
  "close": 1.15330,
  "tickVolume": 1243,
  "realVolume": 0,
  "spread": 7
}]
```

### GET /mt5/{account_id}/SymbolInfo

Contract specification for a symbol: digits, point, spread, contract size, tick size/value, volume min/max/step, trade mode, swap rates, and base/quote/margin currencies. Call this before /OrderSend to validate volumes and round prices to the right precision.

Parameters:

- `symbol` (required): Symbol name as listed by /symbols.

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/mt5/{account_id}/SymbolInfo?symbol=EURUSD"
```

Response:

```json
{
  "symbol": "EURUSD",
  "description": "1 Lot= 100,000 EUR",
  "digits": 5,
  "point": 0.00001,
  "tickSize": 0.00001,
  "tickValue": 1.0,
  "contractSize": 100000.0,
  "volumeMin": 0.01,
  "volumeMax": 150000.0,
  "volumeStep": 0.01,
  "stopsLevel": 1,
  "freezeLevel": 0,
  "spread": 7,
  "tradeMode": "Full",
  "swapLong": -3.22,
  "swapShort": 1.1,
  "bid": 1.15324,
  "ask": 1.15331,
  "currencyBase": "EUR",
  "currencyProfit": "USD",
  "currencyMargin": "EUR"
}
```

### GET /mt5/{account_id}/ServerTimezone

Broker server time and its offset from UTC. Timestamps across the API are labelled Z but run on broker server time; use utcOffsetSeconds to translate them to real UTC (utc = serverTime − utcOffsetSeconds). Most MetaTrader brokers run on EET (UTC+2, UTC+3 with DST).

Example request:

```bash
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/mt5/{account_id}/ServerTimezone
```

Response:

```json
{
  "serverTime": "2026-06-11T08:55:57.000Z",
  "utcOffsetSeconds": 0
}
```

## Related

- [Trading](https://fxsocket.com/docs/mt5/trading.md)
- [WebSocket Streams](https://fxsocket.com/docs/mt5/websocket.md)
- [Account Data](https://fxsocket.com/docs/mt5/account-data.md)
