Investment calculators are one of the most-embedded widget types on personal-finance content sites, and the math behind them is simple enough that you shouldn't need a third-party SDK for it. Here's exactly how the /financenamespace's SIP and compound interest endpoints work, and how to wire them into a widget.
SIP future value
A Systematic Investment Plan (SIP) is a fixed monthly contribution that compounds over time. The /sip endpoint takes monthly_investment, annual_rate, and years, and computes:
future_value = monthly × ((1+r)^n − 1) / r × (1+r)
where r = annual_rate / 12 / 100 (monthly rate)
n = years × 12 (number of contributions)fetch("https://aplicious.com/api/v1/finance/sip?monthly_investment=5000&annual_rate=12&years=10", {
headers: { "X-API-Key": "lapi_live_••••" },
});The response includes future_value, total_invested, total_gains, and a wealth_ratio(future value ÷ total invested — a quick way to show “your money grew Nx”), plus a year-by-year breakdown array for charting.
Compound interest, with compounding frequency
/compound-interest handles the more general case: a lump-sum principal, an optional additional monthly contribution, and a configurable compounding frequency — annually, semi_annually, quarterly, monthly, or daily. This is the endpoint to use for savings accounts and fixed deposits, where compounding frequency materially changes the result and SIP's fixed monthly-compounding assumption doesn't fit.
fetch("https://aplicious.com/api/v1/finance/compound-interest?principal=100000&annual_rate=7&years=15&frequency=quarterly", {
headers: { "X-API-Key": "lapi_live_••••" },
});Building the widget
Both endpoints return the same kind of shape, so a single chart component can render either:
async function getGrowthChart(type: "sip" | "compound", params: Record<string, string>) {
const query = new URLSearchParams(params).toString();
const res = await fetch(`https://aplicious.com/api/v1/finance/${type === "sip" ? "sip" : "compound-interest"}?${query}`, {
headers: { "X-API-Key": process.env.APLICIOUS_KEY! },
});
const { data } = await res.json();
return data.yearly_breakdown; // array of { year, invested, value }
}Both calculators are pure computation — no upstream dependency, no caching needed, and the same input always returns the same output. That makes them safe to call on every keystroke of an interactive slider without worrying about rate limits or stale data.