TotalFinance
Open-source TypeScript finance with explicit units, honest assumptions and diagnostics you can read. Built by InsiderFinance.
TotalFinance is a TypeScript library for financial computation: options and strategies, volatility, technical analysis, portfolios and performance, risk, valuation, fixed income, FX, commodities, crypto and backtesting. It runs in Node.js and in the browser, has no runtime dependencies, and never fetches market data on its own. You supply the data; it computes, and tells you exactly how.
import { blackScholes } from '@insiderfinance/totalfinance/options';
const price = blackScholes.price({
type: 'call',
spot: 100,
strike: 105,
timeToExpiryYears: 0.25,
volatility: 0.2,
riskFreeRate: 0.04,
});
console.log(price.toFixed(4)); // 2.3909What makes it different
- Units are explicit. Rates and volatilities are decimals, times are year fractions or epoch milliseconds, and field names say which. No percent-or-decimal guessing.
- Answers explain themselves. Add
.explain()to a facade and the result carries its assumptions (day count, compounding, model) and diagnostics (method, convergence, warnings). - Errors teach. Invalid input throws a typed error that names the field and the fix, never a
stray
TypeErroror a silentNaN. - Nothing is invented. No hidden market data, no silent financial defaults, no lookahead in backtests, no warmup values pretending to be signals.
- Built for agents too. Every operation in the registry is available to AI agents through an MCP server, the CLI and a local HTTP API, and every page of these docs has a Markdown twin.
Where to go next
Install
One package, every domain, tree-shakeable subpaths.
Quickstart
The first calls, and what comes back.
Core concepts
Units, explain envelopes, errors and API levels.
Calculators
Ten live calculators that run the library in your browser.
API reference
Every entry point and export, generated from the source.
For agents
MCP server, operation catalog and LLM-ready docs.