MetaTrader 4 APIMarket Data

For AI agents: this page is also available as Markdown at /docs/mt4/market-data.md. The index of every docs page is /docs/llms.txt.

MetaTrader 4 Market Data API

Pull MetaTrader 4 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 MT4

  • Tick volume only. MT4 records how many price changes a bar had, not traded volume: realVolume in /PriceHistory is always 0, and tickVolume is the number to use.
  • Quotes carry no last price. In /getQuote, last is always 0, and volume is the tick count of the current M1 bar.
  • Symbols must actually quote. A symbol that shows no bid or ask within about half a second is rejected instead of returning zeros. That usually means the plain name (EURUSD) on a broker that only quotes a suffixed one (EURUSD.sd); look the name up in /symbols.
  • Broker-dependent contract fields. In /SymbolInfo, the base, profit and margin currencies and the description come from the broker's MT4 symbol settings and can be empty.
GET /mt4/{account_id}/symbols

Names of all symbols available in Market Watch. Use the returned names verbatim with /getQuote, /SymbolInfo, /PriceHistory, and /OrderSend, since 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, but a getQuote call enables it on demand.

Example request
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/mt4/{account_id}/symbols
Response
["EURUSD.sd", "GBPUSD.sd", "USDJPY.sd", "XAUUSD.sd", "..."]
GET /mt4/{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. On MT4, last is always 0 and volume is the tick count of the current M1 bar. A symbol that shows no live quote within about half a second is rejected, typically an unsuffixed name such as EURUSD on a broker that only quotes EURUSD.sd. For continuous ticks use the WebSocket prices topic instead.

  • symbol (required): Symbol name as listed by /symbols (e.g. EURUSD, XAUUSD).
Example request
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/mt4/{account_id}/getQuote?symbol=EURUSD"
Response
{
  "symbol": "EURUSD",
  "bid": 1.15325,
  "ask": 1.15333,
  "time": "2026-06-11T08:55:56.728Z",
  "last": 0.0,
  "volume": 37
}
GET /mt4/{account_id}/PriceHistory

OHLC bars for a symbol and timeframe: one candle per bar in the requested window. MT4 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. realVolume is always 0 on MT4, which only records tick volume.

  • symbol (required): Symbol name as listed by /symbols.
  • timeframe (required): MT4 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
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/mt4/{account_id}/PriceHistory?symbol=EURUSD&timeframe=H1&from=2026-01-01&to=2026-12-31"
Response
[{
  "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 /mt4/{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. On MT4 the base, profit and margin currencies and the description come from the broker's symbol settings and can be empty on some brokers.

  • symbol (required): Symbol name as listed by /symbols.
Example request
curl -H "X-API-Key: fxs_live_..." \
  "https://api.fxsocket.com/mt4/{account_id}/SymbolInfo?symbol=EURUSD"
Response
{
  "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 /mt4/{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
curl -H "X-API-Key: fxs_live_..." \
  https://api.fxsocket.com/mt4/{account_id}/ServerTimezone
Response
{
  "serverTime": "2026-06-11T08:55:57.000Z",
  "utcOffsetSeconds": 0
}