# Interest accrual compute

`interest-accrual-compute` · version 1.0.0 · Financial calculations · free, no key needed

Simple or compound (periodic or continuous) interest over a term in years or a dated span with a day-count basis.

**Use when you need to: simple interest on a principal · compound interest calculator · continuous compounding interest.**

## Decide before calling

Read the [versioned contract](/v1/tools/interest-accrual-compute/versions/1.0.0) and the supported scope below. Reuse `interest-accrual-compute@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `interest-accrual-compute@1.0.0` for simple interest on a principal. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- simple interest on a principal
- compound interest calculator
- continuous compounding interest
- interest for a number of days actual/360
- future value of a lump sum with compounding
- interest accrued between two dates
- how much interest on a deposit at an annual rate
- ending balance after compound interest
- חישוב ריבית פשוטה או דריבית על סכום

## Not supported

- annuities, loan payments or level-payment schedules (use tvm-solve)
- converting a rate between compounding conventions without an amount
- bond accrued interest with coupon periods
- act-act-icma and 30e-360-isda day counts
- tax, withholding or fees

## Behavior

- Decimal strings only: principal > 0 (up to 20 integer and 20 fractional digits) and annual_rate a decimal fraction with -1 < annual_rate <= 100 (0.05 means 5 percent; "5" means 500 percent). A JSON number for a decimal field is invalid_input.
- Time is either years (decimal from 0 to 1000) or start_date, end_date and convention together (dates ISO, years 1900 to 2200, start_date <= end_date); both forms, neither, or a partial date group is invalid_input. Date conventions are 30-360-isda, 30-360-us, 30e-360, act-360, act-365f, act-act-isda and nl-365 with the exact rules of daycount-year-fraction; t is that exact rational.
- method simple: interest = principal * annual_rate * t, exact; compounding must be absent. method compound requires compounding: an integer m from 1 to 365 or "continuous". Periodic: ending = principal * (1 + annual_rate/m)^(m*t) with a fractional exponent m*t allowed; continuous: ending = principal * e^(annual_rate*t).
- interest and ending_amount are each rounded once from the exact values (interest = exact ending - principal), so ending_amount can differ from principal plus the rounded interest by one unit in the last place under directed rounding. Fractional exponents and continuous compounding use a 40-digit BigInt engine accurate to better than 1e-35 relative before rounding.
- effective_annual_rate = (1 + annual_rate/m)^m - 1 (periodic, exact), e^annual_rate - 1 (continuous), null for simple; year_fraction is t. Defaults when omitted: scale 2, rate_scale 10, rounding half-up (half away from zero); the other modes are half-even, half-down, up, down, ceiling, floor. Outputs never contain -0.
- A periodic term with m*t above 100000 is limit_exceeded (checked before computing); an exact ending amount of 1e20 or more is not_computable with details.reason overflow. Any string over 64 UTF-8 bytes is limit_exceeded, checked before parsing.
- Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice.

## Input

- `principal` (string, required): max length 64; pattern `^(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `annual_rate` (string, required): max length 64; pattern `^-?(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `method` (one of "simple", "compound", required)
- `compounding` (integer or one of "continuous", optional)
- `years` (string, optional): max length 64; pattern `^(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `start_date` (string, optional): max length 10; pattern `^[0-9]{4}-[0-9]{2}-[0-9]{2}$`
- `end_date` (string, optional): max length 10; pattern `^[0-9]{4}-[0-9]{2}-[0-9]{2}$`
- `convention` (one of "30-360-isda", "30-360-us", "30e-360", "act-360", "act-365f", "act-act-isda", "nl-365", optional)
- `scale` (integer, optional): min 0; max 12
- `rate_scale` (integer, optional): min 0; max 12
- `rounding` (one of "half-up", "half-even", "half-down", "up", "down", "ceiling", "floor", optional)

## Output

- `interest` (string, required): max length 64; pattern `^-?(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `ending_amount` (string, required): max length 64; pattern `^-?(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `year_fraction` (string, required): max length 64; pattern `^(0|[1-9][0-9]*)(\.[0-9]+)?$`
- `effective_annual_rate` (string or null, required): pattern `^-?(0|[1-9][0-9]*)(\.[0-9]+)?$`

## Limits

- max string bytes: 64
- max compounding periods: 100000
- max years: 1000

## Example

Request input:

```json
{
  "principal": "1500",
  "annual_rate": "0.043",
  "method": "compound",
  "compounding": 4,
  "years": "6"
}
```

Response:

```json
{
  "result": {
    "interest": "438.84",
    "ending_amount": "1938.84",
    "year_fraction": "6.0000000000",
    "effective_annual_rate": "0.0436983575"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "interest-accrual-compute",
  "version": "1.0.0",
  "input": {
    "principal": "1500",
    "annual_rate": "0.043",
    "method": "compound",
    "compounding": 4,
    "years": "6"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/interest-accrual-compute/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"principal":"1500","annual_rate":"0.043","method":"compound","compounding":4,"years":"6"}'
```

The machine-readable contract is at [/v1/tools/interest-accrual-compute/versions/1.0.0](/v1/tools/interest-accrual-compute/versions/1.0.0).

### CLI

```sh
node cli.mjs run interest-accrual-compute 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Bond cashflow schedule](/tools/bond-cashflow-schedule): Coupon dates, coupons remaining, accrued days and accrued interest for a regular fixed-coupon bond (Excel COUP* rules).
- [Cashflow xnpv](/tools/cashflow-xnpv): NPV of dated cash flows with the Excel XNPV 365-day exponent and an explicit valuation date.
- [Growth cagr compute](/tools/growth-cagr-compute): CAGR from start and end values or a total return over years or dates, with a sub-year warning.
- [Cashflow mirr](/tools/cashflow-mirr): MIRR of periodic cash flows from a finance rate and a reinvestment rate, with compounded and discounted totals.
- [Loan amortization schedule](/tools/loan-amortization-schedule): Cent-exact level-payment loan schedule with per-period rounding, extra payments, dates and a row window.
- [Tvm solve](/tools/tvm-solve): Solve periods, annual rate, present value, payment or future value of a level annuity with timing and compounding.
