Functional Weave
Code in Python

banking.savings-aer@1.0.0

vectors.json

1,511 bytes · view raw

[
 {
  "name": "Practice Note worked example 5: 5.8% paid monthly is 5.96% AER",
  "args": [
   580,
   12
  ],
  "expect": 596
 },
 {
  "name": "Practice Note worked example 1: interest paid once a year, AER equals the gross rate",
  "args": [
   600,
   1
  ],
  "expect": 600
 },
 {
  "name": "paid half-yearly",
  "args": [
   500,
   2
  ],
  "expect": 506
 },
 {
  "name": "paid quarterly",
  "args": [
   500,
   4
  ],
  "expect": 509
 },
 {
  "name": "paid monthly at 12% is 12.68%",
  "args": [
   1200,
   12
  ],
  "expect": 1268
 },
 {
  "name": "paid daily",
  "args": [
   450,
   365
  ],
  "expect": 460
 },
 {
  "name": "paid weekly",
  "args": [
   450,
   52
  ],
  "expect": 460
 },
 {
  "name": "zero rate",
  "args": [
   0,
   12
  ],
  "expect": 0
 },
 {
  "name": "a tiny rate still rounds to a whole basis point",
  "args": [
   1,
   12
  ],
  "expect": 1
 },
 {
  "name": "a very high rate",
  "args": [
   10000,
   12
  ],
  "expect": 16130
 },
 {
  "name": "4.5% paid monthly is 4.59%, not 4.60%",
  "args": [
   450,
   12
  ],
  "expect": 459
 },
 {
  "name": "a negative rate is refused",
  "args": [
   -10,
   12
  ],
  "expectError": "grossRateBasisPoints must be between 0 and 100000"
 },
 {
  "name": "zero payments a year is refused",
  "args": [
   500,
   0
  ],
  "expectError": "paymentsPerYear must be between 1 and 365"
 },
 {
  "name": "more than daily is refused",
  "args": [
   500,
   366
  ],
  "expectError": "paymentsPerYear must be between 1 and 365"
 }
]