LanguageValues and typesStandard typesMoney and banking
InterestRate
On this page
A yearly rate of interest, and the basis it is quoted on: 5.5% APR.
Use it for savings and loan rates. It keeps APR and AER from being confused. For a plain percentage, use Percentage.
Shape
| Field | Type | Required? |
|---|---|---|
rate |
Percentage |
Yes |
basis |
InterestRateBasis |
Yes |
Example
InterestRate { rate: 5.5% basis: InterestRateBasis.apr }Good to know
- The rate can be below 0%, as central banks' have been.
==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"rate":"5.5%","basis":"apr"}{"rate":"4.75%","basis":"aer"}{"rate":"-0.5%","basis":"aer"}
Details
Text form, storage, how it is shown, and operations
InterestRate is in the group Money and banking, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
It is stored in 2 columns, each named for the field, _ and its suffix. This is {"rate":"-0.5%","basis":"aer"}:
| Column | Type | Holds |
|---|---|---|
<field>_rate |
numeric |
-0.005 |
<field>_basis |
text |
'aer' |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"rate":"5.5%","basis":"apr"} |
5.5% APR |
{"rate":"4.75%","basis":"aer"} |
4.75% AER |
{"rate":"-0.5%","basis":"aer"} |
-0.5% AER |
{"rate":"3%","basis":"flat"} |
3% flat |
Operations
It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-interest-rate.md.Built from Jadpo main at aee2e8f.