Convert to or from RON
convertCalculate amounts from or to RON using BNR reference rates with exact single rounding and selectable rate rules for invoices or payments.
Instructions
An amount converted to or from RON at BNR's reference rate, computed exactly and rounded once: to RON is amount x rate / multiplier, from RON amount x multiplier / rate. rate_rule picks the fixing: in_force (the day's, or the last banking day's before it, as rate answers) or last_before (the last one strictly before the day, the rule for an invoice in a foreign currency). Answers the result with the rate, its multiplier and the date BNR published it, so the conversion can be stated. One side must be RON; for two other currencies, convert twice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | The currency wanted: RON, or the currency to convert RON to. ISO 4217; case ignored. | |
| date | No | The day of the conversion, YYYY-MM-DD in Bucharest (an invoice's date, a payment's); default today. | |
| from | Yes | The amount's currency: RON, or the currency to convert to RON. ISO 4217; case ignored. | |
| amount | Yes | The amount, as a decimal string: "1250.50", "-75". Never a number. | |
| places | No | Digits after the point in the result. | |
| rounding | No | How the result is rounded, once: half-up (halves away from zero, as invoices round) or half-even (banker's). | half-up |
| rate_rule | No | in_force: the rate in force on the day; last_before: the last rate published before the day. | in_force |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| to | Yes | ||
| date | Yes | ||
| from | Yes | ||
| note | No | ||
| rate | Yes | BNR's exact text, RON per `multiplier` units | |
| amount | Yes | The amount converted, as given | |
| places | Yes | ||
| result | Yes | The converted amount, computed exactly and rounded once | |
| source | Yes | ||
| meaning | Yes | ||
| rounding | Yes | ||
| rate_rule | Yes | ||
| multiplier | Yes | ||
| published_on | Yes | The date of the fixing the conversion used |