← Back to API Ninjas
GET/v1/currencyvolatilityhistorical

Historical time series of rolling volatility for a currency pair.

Returns a realised volatility time series for a currency `pair` across a date range or `days` lookback. For the latest single value use /currencyvolatility.

API Ninjas·$0.001 per call

Example code

// Using @orth/sdk - The simplest way to call APIs // Install: npm install @orth/sdk import Orthogonal from "@orth/sdk"; const orthogonal = new Orthogonal({ apiKey: process.env.ORTHOGONAL_API_KEY, }); const output = await orthogonal.run({ api: "api-ninjas", path: "/v1/currencyvolatilityhistorical", query: { "pair": "example" } }); console.log(output);

Query parameters

pairrequired
string

Currency pair in ABC_DEF form (e.g. EUR_USD). Both must be supported fiat currency codes; ZWG, BTC, and XAG are not supported.

window
number

Lookback window for realized volatility, in trading days. Defaults to 30. Must be between 2 and 1000. (Default: 30)

method
string

Volatility method: close_to_close (default) or ewma. (Allowed: close_to_close, ewma) (Default: close_to_close)

days
number

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

start_date
string

Start date (YYYY-MM-DD) for a range query. Use with end_date instead of days.

end_date
string

End date (YYYY-MM-DD) for a range query. Use with start_date instead of days.

day_count
number

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

annualized
boolean

Whether to treat the annualized figure as the headline value. Defaults to true. (Default: True)

    Orthogonal - Giving AI agents the tools they need.