Fixed-income analytics, pricing helpers, and worked examples.
Project description
fuggers-py
fuggers-py is a Python library for fixed-income pricing, spread, risk, and portfolio calculations. It includes bond, curve, rates, funding, credit, inflation, and portfolio packages that you can use directly from scripts or notebooks. Coverage is broad, but not complete; model-heavy paths are checked against small saved reference cases, and the docs call out the limits that still matter.
Install
pip install fuggers-py
pip install "fuggers-py[dev]"
pip install "fuggers-py[engine]"
pip install "fuggers-py[examples]"
Units And Quoting
- Rates and spreads are usually raw decimals, so
0.045means 4.5%. - Bond clean and dirty prices are usually quoted in percent of par, so
101.25means 101.25% of face value. - Accrued interest, coupon cash, repo cash, and PV outputs are currency amounts unless the API says otherwise.
- Settlement dates are economic settlement dates used for accrual, discounting, and pricing.
DiscountMarginCalculatorapplies DM as a continuously compounded spread over ACT/365 settlement-to-cash-flow times.OASCalculatorprices callable bonds with call schedules only and rejects puttable bonds.
Fixed-Income Example
from decimal import Decimal
from fuggers_py.analytics import calculate_modified_duration, yield_to_maturity
from fuggers_py.analytics.yields import current_yield_from_bond
from fuggers_py.bonds import FixedBondBuilder
from fuggers_py.core import Currency, Date, Frequency, Price
settlement = Date.from_ymd(2026, 1, 15)
clean_price = Decimal("101.25")
bond = (
FixedBondBuilder.new()
.with_issue_date(Date.from_ymd(2024, 1, 15))
.with_maturity_date(Date.from_ymd(2031, 1, 15))
.with_coupon_rate(Decimal("0.0450"))
.with_frequency(Frequency.SEMI_ANNUAL)
.with_currency(Currency.USD)
.build()
)
price = Price.new(clean_price, Currency.USD)
ytm = yield_to_maturity(bond, price, settlement)
duration = calculate_modified_duration(bond, ytm, settlement)
current_yield = current_yield_from_bond(bond, clean_price)
assert ytm.value() > Decimal("0")
assert duration > 0
assert current_yield > Decimal("0")
Curve And Engine Example
from decimal import Decimal
from fuggers_py.core import Date
from fuggers_py.curves import DiscountCurveBuilder, ForwardCurve
from fuggers_py.data import MarketDataProvider, ReferenceDataProvider
from fuggers_py.engine import PricingEngineBuilder
settlement = Date.from_ymd(2026, 3, 13)
curve = (
DiscountCurveBuilder(reference_date=settlement)
.add_zero_rate(1.0, Decimal("0.0350"))
.add_zero_rate(5.0, Decimal("0.0385"))
.build()
)
forward_curve = ForwardCurve.from_months(curve, 3)
engine = (
PricingEngineBuilder.new()
.with_market_data_provider(MarketDataProvider())
.with_reference_data_provider(ReferenceDataProvider())
.with_settlement_date(settlement)
.build()
)
assert curve.discount_factor(settlement.add_years(5)) > 0
assert forward_curve.forward_rate_at(1.0) > 0
assert engine.reactive_engine is not None
assert engine.pricing_router is not None
More Docs
- Core, Math, Curves, Bonds, and Analytics
- Rates, Funding, Credit, Inflation, and Portfolio
- Data, I/O, Engine, Testing, Examples, and Releasing
Tests
python -m pip install -e ".[dev,engine]"
pytest -q
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fuggers_py-0.2.1.tar.gz.
File metadata
- Download URL: fuggers_py-0.2.1.tar.gz
- Upload date:
- Size: 635.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bd01c86f1300a0a2b36c58aac6427bdfda629d2d9590ae2856f8c85de51ec47
|
|
| MD5 |
829e8a914ac7625cbbb8d50af578b641
|
|
| BLAKE2b-256 |
a1e88024f6a7390331f7ea1c93a484380e80e9fb2a94104c02793d9d40ffb698
|
Provenance
The following attestation bundles were made for fuggers_py-0.2.1.tar.gz:
Publisher:
release.yml on stanislawkubik/fuggers-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fuggers_py-0.2.1.tar.gz -
Subject digest:
5bd01c86f1300a0a2b36c58aac6427bdfda629d2d9590ae2856f8c85de51ec47 - Sigstore transparency entry: 1155510851
- Sigstore integration time:
-
Permalink:
stanislawkubik/fuggers-py@80412c73b5b5e66d6abd1b1c3cf0cd888b2d17a0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/stanislawkubik
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@80412c73b5b5e66d6abd1b1c3cf0cd888b2d17a0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fuggers_py-0.2.1-py3-none-any.whl.
File metadata
- Download URL: fuggers_py-0.2.1-py3-none-any.whl
- Upload date:
- Size: 539.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d45f58ee55960ab581e527ff7786ff6d96c2c4459ff4699ae6ab5cb0567d28c
|
|
| MD5 |
78fbfb15ae4ba1263db75206cc5ab274
|
|
| BLAKE2b-256 |
99242e539b10aec36dd3f6083b76a4872fcd5ed49aeb5c9e2968184c6718fbb0
|
Provenance
The following attestation bundles were made for fuggers_py-0.2.1-py3-none-any.whl:
Publisher:
release.yml on stanislawkubik/fuggers-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fuggers_py-0.2.1-py3-none-any.whl -
Subject digest:
2d45f58ee55960ab581e527ff7786ff6d96c2c4459ff4699ae6ab5cb0567d28c - Sigstore transparency entry: 1155510854
- Sigstore integration time:
-
Permalink:
stanislawkubik/fuggers-py@80412c73b5b5e66d6abd1b1c3cf0cd888b2d17a0 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/stanislawkubik
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@80412c73b5b5e66d6abd1b1c3cf0cd888b2d17a0 -
Trigger Event:
push
-
Statement type: