XeCurrencyConverter Data Connector

The Xe.com Currency Converter Connector provides exchange rates between different currencies.

Constructor

XeCurrencyConverter(id, key) → {object}

We recommend that you create a Data Connector Configuration called "XeCurrencyConverter" via the Verj.io Runtime Environment's Administration Application.

An Xe.com Currency Converter Data Connector is then available at connectors.verjio.xecurrencyconverter using that configuration.

If you are unable to do that, you may use this constructor to create a new Xe.com Currency Converter Data Connector.

This method accepts an account ID and an API key.

Parameters:
Name Type Description
id string

Xe.com account ID.

key string

Xe.com API key.

See:
Returns:
object

The Xe.com Currency Converter Data Connector.

Functions

connector.getAccountInfo() → {object}

Retrieves account information including remaining requests and rate limit quotas.

Returns:
object

Details of the Xe.com account.

Example:
// {"id":"77bbe757-a8c5-4ba7-b03a-2059d8015e81","organization":"Example.com",
// "package":"FREETRIAL_DAILY_REAL_DATA","service_start_timestamp":"2024-04-30T00:00:00Z",
// "service_end_timestamp":"2024-05-08T00:00:00Z","package_limit":10000,
// "package_limit_remaining":9991}
connectors.verjio.xecurrencyconverter.getAccountInfo();

convertFrom(from, to, amount) → (nullable) {XeCurrencyConverter.ExchangeRates}

Convert a single currency to one or more destination currencies.

Parameters:
Name Type Description
from string

The currency code of the starting currency.

to string | Array.<string>

One or more currency codes represented as a string, a comma-separated string or an array.

amount number

The value of the from currency to convert.

Returns:
XeCurrencyConverter.ExchangeRates

Exchange rates for the specified to currency. Returns null if one or more parameters were invalid.

Examples:
// {"JPY":1963.2201001892}
var rates = connectors.verjio.xecurrencyconverter.convertTo('GBP', 'JPY', 10);
var conversion = rates['JPY'];
// Convert from $14.99 into GBP and EUR
// {"EUR":13.9900865562,"GBP":11.9352998938}
var rates = connectors.verjio.xecurrencyconverter.convertTo('USD', ['GBP', 'EUR'], 14.99);

convertTo(from, to, amount) → (nullable) {XeCurrencyConverter.ExchangeRates}

Convert one or more currencies to a single destination currency.

Parameters:
Name Type Description
from string | Array.<string>

One or more currency codes represented as a string, a comma-separated string or an array.

to string

The currency code of the destination currency.

amount number

The value of the from currencies to convert.

Returns:
XeCurrencyConverter.ExchangeRates

Exchange rates for the specified from currencies. Returns null if one or more parameters were invalid.

Example:
// {"GBP":0.0509367238}
var rates = connectors.verjio.xecurrencyconverter.convertTo('GBP', 'JPY', 10);
var conversion = rates['GBP'];

getCurrencyList() → {object}

Retrieve a list of supported currencies.

The returned data includes the ISO currency code and the full name of each currency.

Returns:
object

Details of available currencies.

Example:
// {"currencies":[{"iso":"AED","currency_name":"Emirati Dirham","is_obsolete":false}, ...]}
connectors.verjio.xecurrencyconverter.getCurrencyList();

Type definitions

ExchangeRates

An object containing one or more exchange rates. The property key is a 3-character country code, e.g. {"USD": 1}

Properties:
Name Type Description
ABC float

Exchange rate for country with the code ABC.

Copyright Ebase Technology 2024