About pyeconomics
pyeconomics is a free, open-source library of economics and finance models, and this website is one way to use it. Every model shows its formula, cites where the formula comes from and is tested against published values.
What it is
50 models and 171 data series from 17 sources, under the Apache-2.0 licence. The same models run here in the browser, from Python, from the command line, over a REST API and as tools for an AI assistant, and each gives the same result, byte for byte. Nothing on this site needs an account, and the models are free to use, to read and to change.
Browse the models, explore the data, or read the documentation.
Who runs it
pyeconomics.dev is operated by Nathan Ramos, the project's maintainer. Write to nathan.ramos.github@gmail.com.
The code, its tests and the whole history of both are public in the repository on GitHub, where anyone can report an error, ask a question in Discussions or propose a model. The legal pages hold the terms of use, the privacy policy and the disclaimers.
Where the formulas come from
Each model cites the papers, textbooks and official documents its formulas follow: 193 citations across the 50 models, listed on each model's page with a link where the source has one. See Time value of money's citations.
Every model also declares how far its method is accepted, so a rule of thumb is never passed off as settled theory:
- standard (41 models): Textbook consensus, such as bond duration or the CAPM formula.
- practitioner (7 models): A widely used rule of thumb or convention.
- contested (2 models): Under active academic or policy debate.
- rejected (0 models): Failed out of sample; kept for history and teaching.
- historical (0 models): A superseded methodology, kept for reproducibility.
How each model is tested
- Against published values. 354 reference values, at least three for each model, each taken from a cited source and reproduced within a stated tolerance.
- Against properties that must always hold. 160 of them, each tried on many generated inputs: a bond's price falls when its yield rises, for one.
- Against independent software, where a well-known library computes the same thing.
- Across every way of running it. The website, Python, the command line, the REST API and the assistant tools must return identical bytes for the same inputs.
The tests run on every change, in public: the reference values and the runs are in the repository. Each result also carries a manifest, the model's version and the hashes of its inputs and result, so anyone can run it again and compare.
Where the data comes from
From the bodies that publish it: statistical offices, central banks and researchers. Every series names its publisher, its licence and its terms, and this site serves only what those terms allow. The data sources lists each one.
What it is not
pyeconomics is a tool for learning, research and analysis, offered as is. It is not investment advice, and a model's output is only as good as its inputs and its assumptions, which each model's page states. The disclaimers say more.