Readable financial models. Practical valuation tools. Python performance with Numba.
FinancePy is an open-source Python library for the valuation and risk analysis of financial securities and derivatives. It covers instruments across fixed income, equities, foreign exchange and credit, with an emphasis on code that can be inspected, understood and extended.
FinancePy is designed for quantitative analysts, risk managers, traders, educators and students who want to explore how financial instruments are priced and risk-managed. It is an excellent starting point for researchers wishing to test and extend existing models or to develop new models. It is a work-in-progress and contributions are welcome.
- Broad product coverage — work with bonds, options, swaps and other financial derivatives.
- Transparent implementations — inspect pricing logic written in Python.
- Performance-oriented — Numba accelerates computationally intensive models where used.
- Product-first organization — start from the instrument you want to value, then choose a model and market inputs.
- Learn by example — explore scripts, notebooks and API documentation.
A Simple Core idea:
Valuation = Product + Model + Market Data
FinancePy is available on PyPI:
python -m pip install financepyTo upgrade:
python -m pip install --upgrade financepyfrom financepy.utils import Date
settlement_date = Date(19, 2, 2026)
print(settlement_date.add_days(2))
# 21-FEB-2026Note: The first use of some models can take longer while Numba compiles and caches optimized code. Subsequent runs can be faster.
Start with the ready-to-run example scripts or Jupyter notebooks. These illustrate how to construct products, provide market data, select models and calculate valuations.
| Area | Examples of functionality |
|---|---|
| Fixed income | Bonds, interest-rate curves, swaps and swaptions |
| Equity derivatives | Equity options and associated pricing models |
| Foreign exchange | FX derivatives and volatility surfaces |
| Credit | Credit instruments and credit curves |
| Market data | Discount curves, price inputs and volatility structures |
| Financial utilities | Dates, calendars, day counts and schedules |
Coverage varies by product and model. Consult the API documentation and examples for the supported interfaces.
The library separates the instrument, the pricing model and the market inputs so that each can be examined independently.
financepy/
├── products/ # Financial instruments and their valuation interfaces
├── models/ # Low-level analytical and Monte Carlo pricing and valuation models
├── market/ # Curves, volatility and other market data
└── utils/ # Dates, calendars, schedules and general mathematics
This product-oriented design helps users find the instrument they need without first navigating every available mathematical model.
| Resource | Description |
|---|---|
| API reference | Classes, functions and method documentation |
| Quick-start guides | Introductions to major product areas |
| Example scripts | Runnable examples for products and models |
| Jupyter notebooks | Interactive experiments and tutorials |
| Changelog | Changes across releases |
FinancePy aims to balance clarity, coverage and speed:
- Keep financial calculations understandable to readers with working Python knowledge.
- Make model implementations inspectable rather than hiding them behind compiled extensions.
- Use Numba to improve performance where appropriate.
- Organize functionality around financial products and practical valuation tasks.
- Provide examples and tests that help users verify results and learn the models.
Numerical results can differ from those of other financial systems because of conventions, curve construction, interpolation choices or model assumptions. Validate inputs and outputs for your own use case.
Contributions from developers and finance practitioners are welcome. You can help by fixing bugs, improving documentation, adding tests, extending examples or proposing new products and models.
Before beginning a substantial change, open an issue or comment on an existing one to coordinate work.
For more information see contributing
FinancePy is an open-source project. If you find a defect, need a feature or want to suggest a valuation example, please create an issue with enough detail to reproduce or evaluate the request.
Disclaimer: FinancePy is provided without warranty. Financial calculations should be independently checked before being used for trading, investment or risk-management decisions.
FinancePy was created by Dominic O'Kane, drawing on experience in quantitative finance, industry and academia.
FinancePy is licensed under GPL-3.0-or-later. See the LICENSE file for details.
Explore the models · Learn from the examples · Contribute to open quantitative finance
