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.
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
Currency pair in ABC_DEF form (e.g. EUR_USD). Both must be supported fiat currency codes; ZWG, BTC, and XAG are not supported.
Lookback window for realized volatility, in trading days. Defaults to 30. Must be between 2 and 1000. (Default: 30)
Volatility method: close_to_close (default) or ewma. (Allowed: close_to_close, ewma) (Default: close_to_close)
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 (YYYY-MM-DD) for a range query. Use with end_date instead of days.
End date (YYYY-MM-DD) for a range query. Use with start_date instead of days.
Annualization factor: 252 trading days (default) or 365 calendar days. (Allowed: 252, 365) (Default: 252)
Whether to treat the annualized figure as the headline value. Defaults to true. (Default: True)