Free and open source · Apache-2.0
Economics and finance models you can read, run and cite.
50 free models with their formulas, sources and tested values, and 171 data series, for students, analysts and developers. Run them here, or from Python, the command line, a REST API or your AI assistant.
Install the Python package: pip install --pre pyeconomics
This is a preview of version 1.0 (1.0.0rc1). Get an email when 1.0 ships.
Time value of money
Try it: Time value of money
Present and future values of sums, annuities and perpetuities, the five-key solve, NPV, IRR, XNPV, XIRR and amortization schedules.
The calculator starts from the model's example. Change any value and press Run: the result comes from the same API, with the same bytes, as Python and the command line give.
The model's page: every formula, its variables, citations and tests.
Loading the calculator…
Where to start
Models
50 models, from bond duration to policy rules. Filter by domain, evidence or the data they read.
Data
171 series from 17 sources, from unemployment and inflation to interest rates and yield curves, each with its licence and attribution. Chart them, and download them as CSV or Excel.
Documentation
Tutorials, how-to guides and the reference for the Python package, the command line and the API.
The same model from code
Install the package, then run any model by its id. Every result carries its inputs, units, warnings and a manifest: the model's version, the hashes of its inputs and result, and where each value came from.
pip install --pre pyeconomics
import pyeconomics
inputs = {
"calculation": "present_value",
"due": False,
"future_value": 0,
"growth": 0,
"payment": 500,
"periods": 240,
"rate": 0.006666666666666667,
}
result = pyeconomics.run("foundations.time_value", inputs)
print(result.to_json())
pyeconomics models run foundations.time_value --inputs - <<'JSON'
{
"calculation": "present_value",
"due": false,
"future_value": 0,
"growth": 0,
"payment": 500,
"periods": 240,
"rate": 0.006666666666666667
}
JSON
- REST API
- Every model is an endpoint:
POST /v1/models/foundations.time_value/runwith its inputs as JSON. - MCP server
- Give your AI assistant every model as a tool:
uvx --prerelease allow --from "pyeconomics[mcp]" pyeconomics mcp. The toolrun_modelruns any model by its id, and 16 models have a tool of their own, such asfoundations_time_value. Connect your assistant - Reproducibility
- Download any result with its manifest, or as a bundle that runs it again. What a result holds
How every model is checked
Cited
193 citations across the 50 models: the papers, textbooks and official documents each formula follows, on its page. See Time value of money's.
Tested
354 cited reference values, at least three per model, 160 properties that must always hold, and a check against an independent library where one exists. See a model's evidence.
Open
All the code, tests and history are public. The repository on GitHub. Who runs this site.
Clear about data
Every series says who publishes it and on what terms. The data sources.
Domains
Every model, with filters · Search · What the catalog covers
- Foundations5 models
- Econometrics3 models
- Macroeconomics8 models
- International1 model
- Microeconomicscoming later
- Accounting2 models
- Corporate finance3 models
- Equity4 models
- Fixed income8 models
- Derivatives5 models
- Alternativescoming later
- Portfolio4 models
- Asset pricing2 models
- Risk2 models
- Performance3 models