81trust / 100

Compound Interest

by Compound interest in Markets & finance

x402 APIPassing, checked 4 h ago

Compute future value of a principal under compound interest. Returns future value, total interest earned, and the effective annual rate (APY) given the compounding frequency. Matches Excel's FV(rate, nper, 0, -principal) and the classic (1+r/n)^(nt) textbook formula.

POST https://agent402.tools/api/compound-interest

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
200 ms typical, 200 ms slowest 5%
Last check
4 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/compound-interest" \
  -H "content-type: application/json" \
  -d '{"annualRate":0.05,"compoundingPerYear":12,"principal":1000,"years":10}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fcompound-interest
const res = await pay("https://agent402.tools/api/compound-interest", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"annualRate":0.05,"compoundingPerYear":12,"principal":1000,"years":10}),
});
console.log(await res.json());

Example input

{
  "annualRate": 0.05,
  "compoundingPerYear": 12,
  "principal": 1000,
  "years": 10
}

Example output

{
  "effectiveAnnualRate": 0.051162,
  "futureValue": 1647.01,
  "periods": 120,
  "totalInterest": 647.01
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
4 h agoPassed402200 ms$0.002