x402AgentTools

๐Ÿ’ ROI Calculator

Calculate return on investment: profit (or loss) and the percentage return relative to the initial amount invested.

Worked examples

10,000 โ†’ 12,500

GET /api/v1/finance/roi-calculator?initial=10000&final=12500

Result: 25%

Losing trade: 5,000 โ†’ 4,200

GET /api/v1/finance/roi-calculator?initial=5000&final=4200

Result: -16%

House flip: 300,000 โ†’ 371,000

GET /api/v1/finance/roi-calculator?initial=300000&final=371000

Result: 23.67%

Machine API (x402)

$0.001 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol โ€” no accounts, no API keys.

GET /api/v1/finance/roi-calculator?initial=10000&final=12500 HTTP/1.1
Host: agenttools-hub.vercel.app

โ†’ 402 (payment required, instructions in headers)
โ†’ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "finance/roi-calculator",
  "input": {"initial":10000,"final":12500},
  "result": { "value": 25, "answer": "25%" }
}

Agent docs: /llms.txt ยท OpenAPI spec ยท integration guide

About this tool

ROI expresses an investment's profit as a percentage of what you put in โ€” the simplest way to compare deals of different sizes. Negative results are losses; pair with CAGR to account for time.

ROI % = (final โˆ’ initial) รท initial ร— 100

Frequently asked questions

Why is ROI misleading across different timeframes?

A 50% ROI in one year beats 50% over ten years, but ROI ignores time. Use the CAGR calculator to annualize returns before comparing.

Does ROI include fees?

Only if you subtract them yourself โ€” use the net final value (after fees, taxes and costs) for an honest number.

Related tools