Convert currency
convert_currencyConvert an amount between currencies at the OpenExchangeRates rate for a date (the same dated rate find_candidate_transactions matches with). Returns {amount, from, to, converted, rate, ratedate}; ratedate is the day the rate is for (a future date uses today's). Pass target (an amount in the to currency, e.g. a bill's outstanding balance) to also get within_tolerance: whether the converted amount lands within tolerance of it (a fraction, default and maximum 0.03 = the 3% cross-currency matching band). No rate for that date returns {error true, reason no-rate}. READ-ONLY: it converts, never records anything.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ISO currency code to convert into (e.g. ZAR). | |
| date | No | The date whose rate to use (YYYY-MM-DD). Defaults to today; a future date uses today's rate. | |
| from | Yes | ISO currency code of the amount (e.g. GBP). | |
| amount | Yes | The amount to convert, in the `from` currency. | |
| target | No | Optional amount in the `to` currency to test the converted amount against (e.g. a bill's outstanding balance). | |
| tolerance | No | Optional band for `target`, as a fraction (0.03 = 3%). Must be above 0 and at most 0.03; defaults to 0.03, the cross-currency matching band. |