API ReferenceMid market rates

Gets an average rate over the specified time period, as well various additional statistics such as the standard deviation and volatility.

GET
/v1/stats

The stats endpoint returns average rates for a single base currency and one or more counter currencies over the time period you specify in your API query. Note that, unlike the monthly_average endpoint, you specify exact start and end dates, which provides a heightened level of control. This can be quite useful if you want statistics for bi-monthly averages or any other intervals of time.

This endpoint also provides several other statistics: the highest and lowest rate over the period (and their respective timestamps), the average rate, the standard deviation, volatility, and the number of data points over this period.

To provide some background to how we obtain our statistics, volatility is measured by applying the standard deviation of the logarithmic daily returns, expressed in a percentage score. We calculate daily returns using the values of two consecutive days and measure the gain or loss of a currency pair (for live rate frequency packages this comparison is done at 00:00 UTC; daily rate frequency packages will compute stats based on the rate lock-in time specified on the account). Then, we apply a logarithm to the ratio between those two values (Ex: ln (valueDay2 / valueDay1) is the logarithmic return between day2 and day1). As for the standard deviation, we apply it to the daily logarithmic returns we calculated during the given time period. When applicable, values are expressed as a percentage so they are already multiplied by 100.

Authorization

AuthorizationBearer <token>

API key created on your Xe Currency Data account's API page, sent as a Bearer token in the Authorization header.

In: header

Query Parameters

from?string

OPTIONAL – Currency you want to convert from ISO code. Note if this parameter is omitted, default is USD.

to*string

Comma separated list of to currencies based on ISO 4217 codes. This will limit the data returned to only those currencies that are specified.

start_date?string

OPTIONAL – ISO 8601 timestamp in the format yyyy-mm-dd giving the UTC date of the start of the period for which you would like to compute the volatility from. Note if this parameter is omitted, the start date will default to today.

end_date?string

OPTIONAL – ISO 8601 timestamp in the format yyyy-mm-dd giving the UTC date of the end of the period for which you would like to compute the volatility to. Note if this parameter is omitted, the end date will default to today.

obsolete?boolean

OPTIONAL – If ‘true’ then endpoint will display rates for currencies that are obsolete. If ‘false’ then obsolete currencies are replaced by their successor currency.

decimal_places?number

OPTIONAL – This parameter can be used to specify the number of decimal places included in the output. Example 1 USD to EUR = 0.874852 with decimal_places=3, the output returned will be EUR = 0.875

daysInPeriod?number

OPTIONAL – This parameter can be used to specify the number of days in the period that we are considering.

crypto?boolean

OPTIONAL – If 'true' then this endpoint will return data for the following crypto currencies: ADA, ARB, AVAX, BCH, BNB, BTC, DAI, DOGE, DOT, ETH, EURC, LINK, LTC, LUNA, POL, SOL, TRX, UNI, USDC, USDP, USDT, XLM and XRP.

Response Body

application/json

application/json

application/json

application/json

application/json

text/plain

curl -X GET "https://example.com/v1/stats?to=string"
{  "terms": "https://www.xe.com/legal",  "privacy": "https://www.xe.com/privacy",  "from": "USD",  "stats": [    {      "to": "EUR",      "high": 0.8745684278,      "low": 0.8560159877,      "average": 0.8635891576,      "standardDeviation": 0.0051467066,      "volatility": 0.2196459934,      "highTimestamp": "2026-09-23T03:00:00Z",      "lowTimestamp": "2026-08-24T03:00:00Z",      "dataPoints": 31    },    {      "to": "GBP",      "high": 0.7505032122,      "low": 0.7326068831,      "average": 0.7405660819,      "standardDeviation": 0.0046295646,      "volatility": 0.2322828624,      "highTimestamp": "2026-09-23T03:00:00Z",      "lowTimestamp": "2026-08-24T03:00:00Z",      "dataPoints": 31    }  ]}
{  "code": 12,  "message": "Date range error: start date 2026-01-01T00:00:00Z is after end date 2020-01-01T00:00:00Z",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
{  "code": 1,  "message": "Bad credentials",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
{  "code": 3,  "message": "Monthly rate limit exceeded.",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
{  "code": 4,  "message": "Current interval rate limit exceeded.",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
"An unexpected error occurred"
Get help