πŸŽ‰ Our Chrome Extension is here! Get live market prices right in your browser.Install Now
RealMarketAPI
πŸ“Š
Docs/Volatility API

Volatility API

3 endpoints Β· ATR time-series Β· Spike detection Β· Day Γ— Hour heatmap Β· Starter plan and above

VolatilitySpikesHeatmap
πŸ”‘

Starter plan and above

All volatility endpoints require an active paid plan β€” Free plan access is not supported. Authentication is via the apiKey query parameter.

GET

/api/v1/volatility

Starter+

Returns a time-series of four complementary volatility metrics for a given symbol and timeframe: raw ATR, ATR%, Bollinger Band Width, and Historical Volatility. Results are returned newest-first.

Query Parameters
NameTypeDescription
apiKey*stringYour API key.
symbolCode*stringSymbol identifier (e.g. BTCUSD, XAUUSD).
timeFrame*stringCandle interval: M1 Β· M5 Β· M15 Β· H1 Β· H4 Β· D1.
periodintegerLookback window for ATR, Band Width, and Historical Volatility. Range 2–500. Default: 14.
Response Fields β€” 200 OK
FieldTypeDescription
openTimeDateTimeOffsetCandle open timestamp (UTC).
atrdecimalAverage True Range β€” Wilder smoothed over period candles.
atrPercentdecimalATR as a percentage of closing price: ATR Γ· Close Γ— 100.
bandWidthdecimalBollinger Band Width: (Upper βˆ’ Lower) Γ· Middle Γ— 100 β€” proxy for price expansion.
historicalVolatilitydecimalRolling std dev of log returns over period candles, expressed as a percentage.

Request

GET /api/v1/volatility
GEThttps://api.realmarketapi.com/api/v1/volatility?apiKey=YOUR_API_KEY&symbolCode=BTCUSD&timeFrame=H1&period=14

Response β€” 200 OK

response.json
{
  "data": [
    {
      "openTime": "2025-06-01T08:00:00+00:00",
      "atr": 1234.560000,
      "atrPercent": 1.8432,
      "bandWidth": 7.2418,
      "historicalVolatility": 0.9751
    }
  ],
  "totalCount": 1
}

Code examples

volatility.js
const BASE    = "https://api.realmarketapi.com"
const API_KEY = "YOUR_API_KEY"
const PERIOD  = 14

const url = new URL("/api/v1/volatility", BASE)
url.searchParams.set("apiKey",     API_KEY)
url.searchParams.set("symbolCode", "BTCUSD")
url.searchParams.set("timeFrame",  "H1")
url.searchParams.set("period",     String(PERIOD))

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const { data } = await res.json()
for (const point of data) {
  console.log(point.openTime, "ATR:", point.atr, "HV:", point.historicalVolatility)
}
▢️

Try it live in the Playground

Run a live /api/v1/volatility request with your API key β€” see the real response instantly in your browser.

Open Playground
GET

/api/v1/volatility/spikes

Starter+

Scans the full ATR series and returns only the candles where ATR exceeded a given multiple of the series average. Useful for identifying unusual bursts of market activity β€” news events, liquidity gaps, or panic-driven moves.

πŸ’‘Only candles where atr β‰₯ spikeMultiplier Γ— atrAverage are included. The direction field tells you whether that spike candle closed as Bullish, Bearish, or Neutral. Results are returned newest-first.
Query Parameters
NameTypeDescription
apiKey*stringYour API key.
symbolCode*stringSymbol identifier (e.g. BTCUSD, XAUUSD).
timeFrame*stringCandle interval: M1 Β· M5 Β· M15 Β· H1 Β· H4 Β· D1.
periodintegerATR lookback period. Range 2–500. Default: 14.
spikeMultiplierdecimalMinimum ratio of candle ATR to series average ATR required to classify as a spike. Range 1.1–10.0. Default: 2.0.
Response Fields β€” 200 OK
FieldTypeDescription
openTimeDateTimeOffsetCandle open timestamp (UTC).
atrdecimalATR value at the spike candle.
atrAveragedecimalMean ATR across the entire series used for comparison.
multiplierReacheddecimalatr Γ· atrAverage β€” how many times above average the spike was.
directionstringCandle direction: "Bullish", "Bearish", or "Neutral".

Request

GET /api/v1/volatility/spikes
GEThttps://api.realmarketapi.com/api/v1/volatility/spikes?apiKey=YOUR_API_KEY&symbolCode=BTCUSD&timeFrame=H1&period=14&spikeMultiplier=2.0

Response β€” 200 OK

response.json
{
  "data": [
    {
      "openTime": "2025-05-12T14:00:00+00:00",
      "atr": 3512.880000,
      "atrAverage": 1204.320000,
      "multiplierReached": 2.92,
      "direction": "Bearish"
    }
  ],
  "totalCount": 1
}

Code examples

volatility-spikes.js
const BASE             = "https://api.realmarketapi.com"
const API_KEY          = "YOUR_API_KEY"
const PERIOD           = 14
const SPIKE_MULTIPLIER = 2.0

const url = new URL("/api/v1/volatility/spikes", BASE)
url.searchParams.set("apiKey",          API_KEY)
url.searchParams.set("symbolCode",      "BTCUSD")
url.searchParams.set("timeFrame",       "H1")
url.searchParams.set("period",          String(PERIOD))
url.searchParams.set("spikeMultiplier", String(SPIKE_MULTIPLIER))

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const { data, totalCount } = await res.json()
console.log(`Found ${totalCount} spike candle(s)`)
for (const spike of data) {
  console.log(spike.openTime, spike.direction, "Γ—" + spike.multiplierReached)
}
▢️

Try it live in the Playground

Run a live /api/v1/volatility/spikes request with your API key β€” see the real response instantly in your browser.

Open Playground
GET

/api/v1/volatility/heatmap

Starter+

Aggregates the true range of all available candles into a Day-of-Week Γ— Hour-of-Day grid. Each cell shows the average true range and a 0–1 normalised intensity for that time bucket, making it easy to identify when a symbol is typically most volatile. Uses all available historical candles β€” the more history on your plan, the more reliable the heatmap.

πŸ—“οΈResults are sorted by dayOfWeek then hour ascending. Buckets with no candles are omitted. An intensity of 1.0000 marks the single most volatile time slot across the entire dataset.
Query Parameters
NameTypeDescription
apiKey*stringYour API key.
symbolCode*stringSymbol identifier (e.g. XAUUSD, BTCUSD).
timeFrame*stringCandle interval: M1 Β· M5 Β· M15 Β· H1 Β· H4 Β· D1.
Response Fields β€” 200 OK
FieldTypeDescription
dayOfWeekstringDay name ("Monday" … "Sunday").
hourintegerHour of day in UTC (0–23).
avgRangedecimalMean true range across all candles that fell in this time bucket.
intensitydecimalavgRange Γ· max(avgRange) across all buckets β€” 1.0 marks the most volatile slot.

Request

GET /api/v1/volatility/heatmap
GEThttps://api.realmarketapi.com/api/v1/volatility/heatmap?apiKey=YOUR_API_KEY&symbolCode=XAUUSD&timeFrame=H1

Response β€” 200 OK

response.json
{
  "data": [
    {
      "dayOfWeek": "Monday",
      "hour": 9,
      "avgRange": 812.340000,
      "intensity": 0.6714
    },
    {
      "dayOfWeek": "Monday",
      "hour": 14,
      "avgRange": 1209.110000,
      "intensity": 1.0000
    }
  ],
  "totalCount": 2
}

Code examples

volatility-heatmap.js
const BASE    = "https://api.realmarketapi.com"
const API_KEY = "YOUR_API_KEY"

const url = new URL("/api/v1/volatility/heatmap", BASE)
url.searchParams.set("apiKey",     API_KEY)
url.searchParams.set("symbolCode", "XAUUSD")
url.searchParams.set("timeFrame",  "H1")

const res = await fetch(url.toString())
if (!res.ok) throw new Error("Request failed: " + res.status)

const { data } = await res.json()
// Print the top-3 most volatile time slots
const sorted = [...data].sort((a, b) => b.intensity - a.intensity).slice(0, 3)
for (const slot of sorted) {
  console.log(`${slot.dayOfWeek} ${String(slot.hour).padStart(2, "0")}:00 β€” intensity ${slot.intensity}`)
}
▢️

Try it live in the Playground

Run a live /api/v1/volatility/heatmap request with your API key β€” see the real response instantly in your browser.

Open Playground

Error Codes

Common Error Codes
CodeHTTPDescription
ERR_0001_DATA_NOT_FOUND400No market data available for the requested symbol / timeframe
ERR_0005_INVALID_API_KEY400API key is missing, inactive, or not found
ERR_0007_INVALID_TIME_FRAME400Requested timeframe is not available on your plan
ERR_0008_SYMBOL_NOT_SUPPORTED400Requested symbol is not available on your plan
ERR_0012_EMAIL_NOT_VERIFIED400Account email has not been verified
ERR_0014_INVALID_PLAN400Free plan is not permitted to access this endpoint
ERR_0017_REQUEST_QUOTA_EXCEEDED429Monthly request quota has been reached
Feedback