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
| Input | Type | Required | Default | What it is |
|---|---|---|---|---|
| Amount | Number | Yes | Amount to convert. | |
| From currency | String | Yes | Currency of the amount. | |
| To currency | String | Yes | Currency to convert into. | |
| Decimals | Number | No | 2 | Decimal places in the result. |
| Source | String | No | ecb | ecb: European Central Bank daily reference rates (base EUR). json: a JSON rates service at 'url'. fixed: the 'rates' Dictionary. |
| Address (URL) | String | No | For json: the address returning the rates. For ecb: leave empty to use the ECB's public file. | |
| Rates path | String | No | For json: where the rates object sits in the answer, e.g. rates, $.data.rates or results[0].rates. Empty = the whole answer. | |
| Base currency | String | No | Currency the rates are quoted against (rate 1). ecb: always EUR. json: taken from the answer's 'base' field when empty. fixed: required. | |
| Rates | Dictionary | No | For fixed: currency code to rate against the base, e.g. {"USD": 1.08, "GBP": 0.85}. | |
| Date | DateTime | No | Convert 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
| Output | Type | What it is |
|---|---|---|
| amount | Number | Converted amount, rounded to 'decimals'. |
| rate | Number | Rate used: units of the target currency for one unit of the source currency. |
| rate_date | String | Date of the rates when the source gives one, otherwise empty. |