Skip to main content

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.045 means 4.5%.
  • Bond clean and dirty prices are usually quoted in percent of par, so 101.25 means 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.
  • DiscountMarginCalculator applies DM as a continuously compounded spread over ACT/365 settlement-to-cash-flow times.
  • OASCalculator prices 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

Tests

python -m pip install -e ".[dev,engine]"
pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fuggers_py-0.2.1.tar.gz (635.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fuggers_py-0.2.1-py3-none-any.whl (539.5 kB view details)

Uploaded Python 3

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

Hashes for fuggers_py-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5bd01c86f1300a0a2b36c58aac6427bdfda629d2d9590ae2856f8c85de51ec47
MD5 829e8a914ac7625cbbb8d50af578b641
BLAKE2b-256 a1e88024f6a7390331f7ea1c93a484380e80e9fb2a94104c02793d9d40ffb698

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuggers_py-0.2.1.tar.gz:

Publisher: release.yml on stanislawkubik/fuggers-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for fuggers_py-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d45f58ee55960ab581e527ff7786ff6d96c2c4459ff4699ae6ab5cb0567d28c
MD5 78fbfb15ae4ba1263db75206cc5ab274
BLAKE2b-256 99242e539b10aec36dd3f6083b76a4872fcd5ed49aeb5c9e2968184c6718fbb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for fuggers_py-0.2.1-py3-none-any.whl:

Publisher: release.yml on stanislawkubik/fuggers-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page