Getting started
Getting started
Authentication, best practices, timeframes, and supported symbols.
Overview
RealMarketAPI provides real-time and historical OHLCV (open, high, low, close, volume) data for forex, metals, crypto, commodities, indices and stocks.
- REST base URL
- https://api.realmarketapi.com
- WebSocket base URL
- wss://api.realmarketapi.com
- Authentication
- ?apiKey=YOUR_KEY
Available endpoints
| Endpoint | Type | Description |
|---|---|---|
| /api/v1/price | REST GET | Latest completed OHLCV candle |
| /api/v1/history | REST GET | Paginated historical candles with date range (up to 10 years on Business & Enterprise) |
| /api/v1/candle | REST GET | Recent candles, most-recent first |
| /api/v1/symbol | REST GET | All supported symbols (no auth required) |
| /api/v1/me | REST GET | Your plan, usage, and the symbols and timeframes your key can use |
| /api/v1/health | REST GET | API health status (no auth required) |
| /price | WebSocket | Live candle push stream (Plus and above) |
Authentication
Every REST and WebSocket request must include your
apiKey as a query parameter. Generate and manage keys from the dashboard.Keep your API key secret
Never expose it in publicly served front-end JavaScript, public repositories, or client-side code. For browser apps, proxy requests through your own back end.
Query parameters
| Name | Type | Description |
|---|---|---|
| apiKeyrequired | string | Your secret API key. Pass it on every REST and WebSocket request. |
Examples
auth.sh
curl "https://api.realmarketapi.com/api/v1/price?apiKey=rm_live_XXXXXXXX&symbolCode=XAUUSD&timeFrame=M1"auth.js
const API_KEY = "rm_live_XXXXXXXX"
const res = await fetch(
`https://api.realmarketapi.com/api/v1/price?apiKey=${API_KEY}&symbolCode=XAUUSD&timeFrame=M1`
)
const data = await res.json()auth.py
import requests
API_KEY = "rm_live_XXXXXXXX"
res = requests.get("https://api.realmarketapi.com/api/v1/price", params={
"apiKey": API_KEY,
"symbolCode": "XAUUSD",
"timeFrame": "M1",
})
data = res.json()Auth.cs
using System.Net.Http.Json;
using System.Text.Json;
const string apiKey = "rm_live_XXXXXXXX";
using var http = new HttpClient();
var url = $"https://api.realmarketapi.com/api/v1/price?apiKey={apiKey}&symbolCode=XAUUSD&timeFrame=M1";
var data = await http.GetFromJsonAsync<JsonElement>(url);Auth.java
import java.net.URI;
import java.net.http.*;
String apiKey = "rm_live_XXXXXXXX";
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create(
"https://api.realmarketapi.com/api/v1/price?apiKey=" + apiKey + "&symbolCode=XAUUSD&timeFrame=M1"
))
.GET().build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());auth.rb
require 'net/http'
require 'json'
API_KEY = 'rm_live_XXXXXXXX'
uri = URI("https://api.realmarketapi.com/api/v1/price")
uri.query = URI.encode_www_form(
apiKey: API_KEY,
symbolCode: 'XAUUSD',
timeFrame: 'M1'
)
response = Net::HTTP.get_response(uri)
data = JSON.parse(response.body)auth.dart
import 'dart:convert';
import 'package:http/http.dart' as http;
const apiKey = 'rm_live_XXXXXXXX';
final uri = Uri.https('api.realmarketapi.com', '/api/v1/price', {
'apiKey': apiKey,
'symbolCode': 'XAUUSD',
'timeFrame': 'M1',
});
final response = await http.get(uri);
final data = jsonDecode(response.body);Free calls when markets close
When a symbol's market is closed, requests for that symbol do not count toward your monthly quota. Run backtests, back-fill history or test your integration over the weekend without spending requests.
| Market | Open (counted) | Closed (free) |
|---|---|---|
| Forex, metals & commodities | Mon 00:00 to Fri 22:00 UTC | Fri 22:00 UTC to Mon 00:00 UTC (the whole weekend) |
| Indices & stocks | Mon–Fri 13:30 to 20:00 UTC | Every weekday outside 13:30–20:00 UTC, plus the whole weekend |
| Crypto | 24/7 | Never: crypto trades around the clock |
Which requests are free
Requests for a single symbol, made with a
symbolCode such as /api/v1/history, /api/v1/candle, /api/v1/price and the indicator endpoints, follow the market hours of that symbol. Requests that span many symbols at once, such as the screener or market-wide price lists, are always counted. Each symbol's market is the marketClass field returned by GET /api/v1/symbol.Best practices
Choosing between WebSocket and REST is the most impactful architectural decision for your integration. Use the guide below to pick the right transport for each use case.
Prefer WebSocket for all live price data
A single persistent WebSocket connection delivers every new candle the moment it closes, with no polling overhead and no extra rate-limit consumption. If you are polling
/api/v1/price on a timer, switch to WebSocket.WebSocket vs REST
| Use case | WebSocket | REST |
|---|---|---|
| Live price ticker / chart | Ideal: server pushes every candle | Works, but wastes quota on polling |
| Trading signal engine | Near-zero latency per candle | Latency gap between polls |
| Real-time bid/ask spread | Updated with every frame | Not suitable |
| Historical back-fill on startup | Not designed for bulk history | Use /history with pagination |
| One-off price snapshot | Overhead to open a connection | A single GET is simpler |
| Backtesting / research queries | Not applicable | Use /history with date ranges |
| Available symbols lookup | Not applicable | Use GET /api/v1/symbol |
Anti-patterns to avoid
- Polling /api/v1/price on a short timer. Every poll burns a request from your quota and adds HTTP round-trip latency compared with a push model.
- Opening a new WebSocket per request. Connect once per symbol/timeframe pair and keep the connection alive. Repeated open/close cycles exhaust rate limits.
- No reconnect logic in production. Networks drop. Always implement exponential back-off reconnection (see the WebSocket docs).
- Using WebSocket to fetch historical data. WebSocket streams live candles only. Use /api/v1/history for past data, then switch to WebSocket for live updates.
Recommended integration pattern
- 1.On app start, call /api/v1/history to back-fill the initial candle series.
- 2.Open a WebSocket connection per symbol + timeframe pair and keep it persistent.
- 3.Append each incoming WebSocket frame to your local candle series.
- 4.Implement exponential back-off reconnection for transient network failures.
- 5.Reserve /api/v1/price for one-off snapshots or server-side cron jobs.
Timeframes
Pass one of these values in the
timeFrame query parameter. Values are case-sensitive and always uppercase.| Code | Interval | Typical use |
|---|---|---|
| M1 | 1 Minute | Ultra-short-term scalping & HFT |
| M5 | 5 Minutes | Short-term scalping & intraday signals |
| M15 | 15 Minutes | Intraday trend confirmation & entries |
| H1 | 1 Hour | Session-level trend & momentum |
| H4 | 4 Hours | Swing setups with reduced noise |
| D1 | 1 Day | Higher-timeframe trend & macro direction |
Symbol codes
Pass one of these values in the
symbolCode parameter. All codes are uppercase. Availability depends on your plan: GET /api/v1/symbol lists every supported symbol (no key needed), and GET /api/v1/me returns the symbols and timeframes your key can use. Each code links to its symbol page with plan access and sample requests.Forex (12)
EURUSDEuro / US DollarGBPUSDBritish Pound / US DollarUSDJPYUS Dollar / YenGBPJPYBritish Pound / YenUSDVNDUS Dollar / Vietnamese DongAUDUSDAustralian Dollar / US DollarUSDCADUS Dollar / Canadian DollarNZDUSDNew Zealand Dollar / US DollarUSDHKDUS Dollar / Hong Kong DollarUSDMXNUS Dollar / Mexican PesoUSDSGDUS Dollar / Singapore DollarDXYUS Dollar Index
Crypto (9)
Commodities (5)
Indices (11)
Stocks (22)
AAPLApple Inc.TSLATesla Inc.NFLXNetflix Inc.MSFTMicrosoft CorporationAMZNAmazon.com Inc.AMDAdvanced Micro Devices Inc.NVDANVIDIA CorporationGOOGLAlphabet Inc. (Google)METAMeta Platforms Inc.BABoeing Co.ATVIActivision Blizzard Inc.AVGOBroadcom Inc.INTCIntel CorporationIBMIBM CorporationADBEAdobe Inc.ABTAbbott LaboratoriesBABAAlibaba GroupBACBank of America Corp.EBAYeBay Inc.EAElectronic Arts Inc.NKENike Inc.TMETencent Music Entertainment
Try it in the Playground
Query /api/v1/symbol in the Playground to see every supported symbol, or /api/v1/me for the ones your key can use.