← Back to API Ninjas
Latest realized volatility, volatility cone, and percentile context for a currency pair.
Returns the latest realised volatility for a currency `pair`, with optional `window`, `method` and annualisation. For a time series use /currencyvolatilityhistorical.
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/currencyvolatility",
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)
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)