BondLens
$0.25/callYield, duration, convexity & loan amortization.
POST /api/agent-services/bond/analyzeWhat it does
Deterministic fixed-income & loan analytics. Bond mode: solve price<->yield-to-maturity, current yield, Macaulay & modified duration, and convexity from the bond's terms. Loan mode (send principal + annualRate + termMonths): level-payment amortization with monthly payment, total interest/paid, and the full schedule. Pure math from caller-supplied terms — no market-data feed, no fabrication.
- Price ↔ yield-to-maturity
- Macaulay & modified duration, convexity
- Level-payment loan amortization schedules
Example request
POST /api/agent-services/bond/analyze
{
"faceValue": 1000,
"couponRate": 0.05,
"periods": 10,
"frequency": 2,
"yield": 0.06
}Example response (HTTP 200)
Deterministic — the same inputs always return the same audited output.
{
"service": "bondlens",
"requestId": "bl-8e084b70",
"type": "bond",
"bond": {
"price": 957.348986,
"yieldToMaturity": 0.06,
"currentYield": 0.052228,
"couponPerPeriod": 25,
"totalCoupons": 250,
"macaulayDurationYears": 4.471679,
"modifiedDurationYears": 4.341436,
"convexityYears": 22.304728,
"priceValuation": "discount"
},
"loan": null,
"findings": [
{
"rule": "bond-valuation",
"severity": "info",
"why": "Whether the bond trades above (premium), below (discount), or at par.",
"evidence": "price=957.348986 face=1000 -> discount",
"fix": null
}
]
}Input schema
Top-level request fields. Nested shapes are shown in the example above and the OpenAPI spec.
| Field | Type | Required | Description |
|---|---|---|---|
| type | string | — | Optional explicit mode: 'bond' or 'loan'. Auto-detected as loan when principal is present. |
| faceValue | number | — | Bond face/par value (default 1000). |
| couponRate | number | — | Bond annual coupon rate as a fraction, e.g. 0.05 for 5%. |
| periods | number | — | Bond periods to maturity (integer). |
| frequency | number | — | Bond coupon payments per year (default 2 = semiannual). |
| price | number | — | Bond clean price; supply to solve yield-to-maturity. |
| yield | number | — | Bond annual yield; supply to solve price. Provide exactly one of price or yield. |
| principal | number | — | Loan principal (presence selects loan mode). |
| annualRate | number | — | Loan annual interest rate as a fraction, e.g. 0.06. |
| termMonths | number | — | Loan term in months (integer). |
How to call it over x402
- 1. Send the request. The first unpaid call returns HTTP 402 with an x402 payment challenge — $0.25, USDC on Base, and the recipient.
- 2. Pay per call. Your x402 client signs the USDC payment and retries automatically — no API key, no account, no subscription. New to x402?
- 3. Read the result. HTTP 200 returns the computed values plus evidence-backed findings.
With the x402 fetch client (Node / TypeScript)
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.AGENT_WALLET_KEY);
const pay = wrapFetchWithPayment(fetch, account); // USDC on Base
const res = await pay("https://hermesplant.com/api/agent-services/bond/analyze", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"faceValue": 1000,
"couponRate": 0.05,
"periods": 10,
"frequency": 2,
"yield": 0.06
}),
});
const result = await res.json();Inspect the 402 with curl
curl -i -X POST https://hermesplant.com/api/agent-services/bond/analyze \
-H "content-type: application/json" \
-d '{"faceValue":1000,"couponRate":0.05,"periods":10,"frequency":2,"yield":0.06}'
# → HTTP/1.1 402 Payment Required (x402 challenge: price, USDC asset, Base network, recipient)
# → sign the USDC-on-Base payment and retry to receive HTTP 200Prefer zero code? This endpoint is also exposed as a tool on the Hermes Plant MCP server, so an MCP-capable agent can call it with its own x402 wallet.
Other agent services
NPV, IRR, XIRR & DCF valuation in a single call.
LP/GP distribution waterfalls, solved exactly.
Black-Scholes option pricing with the full Greeks.
Portfolio risk scored straight from holdings.
Wallet AML & compliance risk screening.
Full deal underwriting — DCF, returns, sensitivity & waterfall in one call.
Score an MCP server before your agent installs it.
Catch destructive agent commands before they run.
Route risky agent actions to human approval.
Deterministic email & contact data validation.
Need a calculator that isn’t here yet? contact@hermesplant.com