NewConnect Claude, Cursor, ChatGPT, and other AI agents to API Ninjas via our MCP server

Currency Volatility API

The Currency Volatility API measures how much a currency pair's exchange rate fluctuates over time. It provides realized (historical) volatility, EWMA (RiskMetrics, λ=0.94) and GARCH(1,1) volatility forecasts, volatility cones, and percentile/HV-rank context.

Volatility is computed from daily closing rates using the industry-standard method: the sample standard deviation of daily logarithmic returns, annualized by the square root of 252 trading days.

Supported Currencies
(4.3)

From 8,006 users

3,000+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
257ms305ms327ms634ms928ms

Didn't find what you were looking for? Suggest an improvement


/v1/currencyvolatility GETPremium Only

https://api.api-ninjas.com/v1/currencyvolatility

Returns the latest realized (or EWMA) volatility for a currency pair over a lookback window, together with a volatility cone across standard window lengths and HV rank / percentile context.

Parameters

  • pair  required

    Currency pair to query, in the form currency1_currency2 (e.g. EUR_USD).

  • window  optional

    Lookback window for the headline realized volatility, in trading days. Defaults to 30. Must be between 2 and 1000.

  • method  optional

    Volatility method: close_to_close (default) or ewma.

  • day_count  optional

    Annualization factor: 252 trading days (default) or 365 calendar days.

  • annualized  optional

    Whether to treat the annualized figure as the headline value. Defaults to true.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • pair

    The queried currency pair.

  • as_of_date

    Date of the most recent return used (YYYY-MM-DD).

  • annualized_volatility

    Annualized volatility as a decimal (e.g. 0.0785 = 7.85%). annualized_volatility_pct gives the same value as a percentage.

  • daily_volatility

    Daily volatility as a decimal. daily_volatility_pct gives the percentage form.

  • n_observations

    Number of returns used for the headline figure.

  • outliers_filtered

    Number of extreme returns (over 30%) excluded as data artifacts or regime breaks.

  • percentile_context

    Object with the HV rank and percentile of the current volatility within its trailing one-year distribution (current_percentile, hv_rank, min, median, max, lookback_years).

  • cone

    Volatility cone: an array with one entry per window length (10, 21, 63, 126, 252 trading days), each giving the historical min, p25, median, p75, max of rolling realized volatility plus the current reading and its current_percentile.

  • method, window_days, day_count, annualized

    Echo of the request configuration.

Sample Request Live Demo!

pair
window

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/currencyvolatility?pair=EUR_USD&window=30

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/currencyvolatility?pair=EUR_USD&window=30" \ -H "X-Api-Key: YOUR_API_KEY"

/v1/currencyvolatilityhistorical GETPremium Only

https://api.api-ninjas.com/v1/currencyvolatilityhistorical

Returns a daily time series of trailing rolling volatility for a currency pair over a date range, with each point tagged by its percentile rank, plus a volatility cone snapshot as of the end date.

Parameters

  • pair  required

    Currency pair to query, in the form currency1_currency2 (e.g. EUR_USD).

  • window  optional

    Rolling window for volatility, in trading days. Defaults to 30.

  • method  optional

    Volatility method: close_to_close (default) or ewma.

  • days  optional

    Length of the trailing date range in calendar days, ending today. Defaults to 90. Maximum 1825. Mutually exclusive with start_date/end_date.

  • start_date, end_date  optional

    Explicit date range in YYYY-MM-DD form. Provide both together instead of days. The range cannot exceed 1825 days.

  • day_count, annualized  optional

    Annualization factor (252 default or 365) and headline-value toggle, as in the /v1/currencyvolatility endpoint.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • series

    Array of daily points, each with a date, annualized_volatility, daily_volatility, and percentile (rank of that day's volatility within its trailing one-year distribution).

  • cone

    Volatility cone as of the end date — same structure as in the /v1/currencyvolatility endpoint.

  • n_points, outliers_filtered

    Number of series points returned and the count of extreme returns excluded.

  • pair, method, window_days, day_count, annualized, start_date, end_date

    Echo of the request configuration and resolved date range.

Sample Request Live Demo!

pair
window
days

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/currencyvolatilityhistorical?pair=EUR_USD&window=30&days=90

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/currencyvolatilityhistorical?pair=EUR_USD&window=30&days=90" \ -H "X-Api-Key: YOUR_API_KEY"

/v1/currencyvolatilityforecast GETPremium Only

https://api.api-ninjas.com/v1/currencyvolatilityforecast

Returns forward-looking volatility estimates for a currency pair using EWMA (RiskMetrics) or GARCH(1,1). GARCH adds mean reversion toward a long-run volatility level; if the GARCH fit does not converge the response falls back to EWMA. These are model-based estimates, not predictions.

Parameters

  • pair  required

    Currency pair to query, in the form currency1_currency2 (e.g. GBP_JPY).

  • method  optional

    Forecast method: garch_11 (default) or ewma.

  • lambda  optional

    EWMA decay factor, used only when method=ewma. Defaults to 0.94 (RiskMetrics). Must be between 0.80 and 0.99.

  • horizon  optional

    Comma-separated list of forecast horizons in trading days (e.g. 1,5,21,63). Defaults to 1,5,21,63.

  • day_count  optional

    Annualization factor: 252 trading days (default) or 365 calendar days.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • current_conditional_vol_annualized

    The model's current one-step-ahead annualized volatility.

  • forecast

    Array of forecasts, each with a horizon_days, vol_annualized, and vol_daily.

  • parameters

    Fitted model parameters. For garch_11: omega, alpha, beta, persistence, long_run_var, long_run_vol_annualized, and fitted_on. For ewma: lambda and fitted_on.

  • fallback

    true when a requested GARCH fit did not converge and an EWMA estimate was returned instead.

  • pair, as_of_date, method, day_count, outliers_filtered

    Echo of the request and the date of the most recent return used.

Sample Request Live Demo!

pair
horizon

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/currencyvolatilityforecast?pair=GBP_JPY&method=garch_11&horizon=1%2C5%2C21%2C63

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/currencyvolatilityforecast?pair=GBP_JPY&method=garch_11" \ -H "X-Api-Key: YOUR_API_KEY"

If your programming language is not listed in the Code Examples above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.