Skip to main content

Convert amount

Convert an amount from one currency to another using the chosen rate source.

Command in the Currency toolkit · id ooa.currency/convert · 10 inputs (3 required), 3 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
AmountNumberYesAmount to convert.
From currencyStringYesCurrency of the amount.
To currencyStringYesCurrency to convert into.
DecimalsNumberNo2Decimal places in the result.
SourceStringNoecbecb: European Central Bank daily reference rates (base EUR). json: a JSON rates service at 'url'. fixed: the 'rates' Dictionary.
Address (URL)StringNoFor json: the address returning the rates. For ecb: leave empty to use the ECB's public file.
Rates pathStringNoFor json: where the rates object sits in the answer, e.g. rates, $.data.rates or results[0].rates. Empty = the whole answer.
Base currencyStringNoCurrency the rates are quoted against (rate 1). ecb: always EUR. json: taken from the answer's 'base' field when empty. fixed: required.
RatesDictionaryNoFor fixed: currency code to rate against the base, e.g. {"USD": 1.08, "GBP": 0.85}.
DateDateTimeNoConvert at the rates of this past day: ecb uses its history (on a weekend or holiday the last working day before); json puts the day (yyyy-MM-dd) where {date} is in the url. Today's rates when empty.

Outputs​

OutputTypeWhat it is
amountNumberConverted amount, rounded to 'decimals'.
rateNumberRate used: units of the target currency for one unit of the source currency.
rate_dateStringDate of the rates when the source gives one, otherwise empty.