fuggers_py.core¶
Foundational dates, prices, yields, ids, calendars, and day-count primitives.
.. py:module:: fuggers_py.core
Shared primitives for the fixed-income library.
fuggers_py.core is the foundation layer for the public API. It exposes the
typed dates, prices, yields, spreads, identifiers, calendars, day-count
conventions, and protocol interfaces that higher-level analytics build on.
Public imports are intended to work from this module directly, for example::
from fuggers_py.core import Date, Price, SIFMACalendar, Act360
.. py:exception:: FuggersError :module: fuggers_py.core :canonical: fuggers_py.core.errors.FuggersError
Base exception for all fuggers_py domain errors.
.. py:class:: Date(_date) :module: fuggers_py.core :canonical: fuggers_py.core.types.Date
An immutable wrapper around datetime.date.
Date preserves the ordering and calendar arithmetic of the underlying
datetime.date without attaching timezone, holiday, or business-day
metadata. Weekend-only helpers are available on the type itself; calendar
aware business-day logic lives in :mod:fuggers_py.core.calendars.
.. attribute:: _date
The underlying naive `datetime.date`.
.. py:method:: Date.from_ymd(year, month, day) :module: fuggers_py.core :classmethod:
Construct a `Date` from year, month, and day components.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.parse(text) :module: fuggers_py.core :classmethod:
Parse an ISO date string (`YYYY-MM-DD`).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.today() :module: fuggers_py.core :classmethod:
Return today's date in the local timezone.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.year() :module: fuggers_py.core
Return the year.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.month() :module: fuggers_py.core
Return the month (1-12).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.day() :module: fuggers_py.core
Return the day of month (1-31).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.day_of_year() :module: fuggers_py.core
Return the day-of-year (1-366).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.weekday() :module: fuggers_py.core
Return the weekday as an integer where Monday=0 and Sunday=6.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.as_naive_date() :module: fuggers_py.core
Return the underlying `datetime.date`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~datetime.date\``
.. py:method:: Date.is_leap_year() :module: fuggers_py.core
Return True if the year is a leap year.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Date.days_in_month() :module: fuggers_py.core
Return the number of days in this date's month.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.days_in_year() :module: fuggers_py.core
Return the number of days in this date's year (365 or 366).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.start_of_month() :module: fuggers_py.core
Return the first day of the month.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.end_of_month() :module: fuggers_py.core
Return the last day of the month.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.start_of_year() :module: fuggers_py.core
Return January 1st of this date's year.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.end_of_year() :module: fuggers_py.core
Return December 31st of this date's year.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.is_end_of_month() :module: fuggers_py.core
Return True if this date is the last day of its month.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Date.is_weekend() :module: fuggers_py.core
Return True for Saturday/Sunday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Date.is_weekday() :module: fuggers_py.core
Return True for Monday-Friday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Date.add_days(n) :module: fuggers_py.core
Add `n` calendar days.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.add_months(n) :module: fuggers_py.core
Add `n` calendar months, clamping invalid day-of-month to month-end.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.add_years(n) :module: fuggers_py.core
Add `n` calendar years, clamping invalid day-of-month to month-end.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.days_between(other) :module: fuggers_py.core
Return the signed day count from this date to `other`.
The start date is excluded and the end date is included.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.next_weekday() :module: fuggers_py.core
Return the next weekday, leaving weekdays unchanged.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.prev_weekday() :module: fuggers_py.core
Return the previous weekday, leaving weekdays unchanged.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.add_business_days(n) :module: fuggers_py.core
Add business days using weekend-only logic (no holiday calendar).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.business_days_between(other) :module: fuggers_py.core
Count business days between dates.
The start date is excluded and the end date is included. Uses
weekend-only logic with no holiday calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Date.min(a, b) :module: fuggers_py.core :staticmethod:
Return the earlier date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Date.max(a, b) :module: fuggers_py.core :staticmethod:
Return the later date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:class:: Currency(value) :module: fuggers_py.core :canonical: fuggers_py.core.types.Currency
ISO 4217 currency codes used throughout the library.
.. py:method:: Currency.code() :module: fuggers_py.core
Return the ISO alphabetic currency code.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Currency.symbol() :module: fuggers_py.core
Return a commonly used currency symbol.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Currency.name() :module: fuggers_py.core
Return the display name of the currency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Currency.numeric_code() :module: fuggers_py.core
Return the ISO 4217 numeric code.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Currency.is_g10() :module: fuggers_py.core
Return True for the common "G10" FX set.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Currency.is_emerging() :module: fuggers_py.core
Return True for a simple EM classification.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Currency.decimal_places() :module: fuggers_py.core
Return the typical number of decimal places for amounts in this currency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Currency.standard_settlement_days() :module: fuggers_py.core
Return a standard spot-settlement lag for the currency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Currency.from_code(code) :module: fuggers_py.core :classmethod:
Parse an ISO currency code (case-insensitive).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Currency\``
.. py:class:: Frequency(value) :module: fuggers_py.core :canonical: fuggers_py.core.types.Frequency
Coupon or payment frequency.
.. py:method:: Frequency.periods_per_year() :module: fuggers_py.core
Return the number of periods per year.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Frequency.months_per_period() :module: fuggers_py.core
Return the number of calendar months per period.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Frequency.is_zero() :module: fuggers_py.core
Return True for the zero-coupon frequency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: Compounding(value) :module: fuggers_py.core :canonical: fuggers_py.core.types.Compounding
Interest-rate compounding convention.
.. py:method:: Compounding.periods_per_year() :module: fuggers_py.core
Return periods per year, using a sentinel for continuous compounding.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Compounding.is_continuous() :module: fuggers_py.core
Return True for continuous compounding.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Compounding.is_simple() :module: fuggers_py.core
Return True for simple compounding.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: Price(_percentage, _currency) :module: fuggers_py.core :canonical: fuggers_py.core.types.Price
A percentage-of-par price quoted in a currency.
The stored numeric value is in percent-of-par terms, so 98.50 means
98.50% of par and 1.00 means 1.00% of par, not a decimal price.
.. attribute:: _percentage
Price quoted as a percentage of par.
.. attribute:: _currency
Currency denomination of the quote.
.. py:method:: Price.new(percentage, currency) :module: fuggers_py.core :classmethod:
Create a price from a percentage-of-par value.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: Price.from_decimal(decimal_value, currency) :module: fuggers_py.core :classmethod:
Create a price from a decimal-of-par value.
:type decimal_value: :sphinx_autodoc_typehints_type:`\:py\:class\:\`object\``
:param decimal_value: Raw decimal price where ``1.0`` means par and ``0.985`` means
98.5% of par.
:type currency: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Currency\``
:param currency: Denomination of the price.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: Price.validate() :module: fuggers_py.core
Validate the price, which must be strictly positive.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: Price.as_percentage() :module: fuggers_py.core
Return the percentage-of-par value.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Price.as_decimal() :module: fuggers_py.core
Return the decimal-of-par value.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Price.currency() :module: fuggers_py.core
Return the currency denomination.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Currency\``
.. py:method:: Price.is_at_par() :module: fuggers_py.core
Return True if the price is exactly at par (100%).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Price.is_discount() :module: fuggers_py.core
Return True if the price is below par.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Price.is_premium() :module: fuggers_py.core
Return True if the price is above par.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Price.par(currency) :module: fuggers_py.core :classmethod:
Return a par price (100%).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: Price.discount_or_premium() :module: fuggers_py.core
Return the signed difference from par in percentage points.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Price.to_dirty(accrued) :module: fuggers_py.core
Convert a clean price to a dirty price.
:type accrued: :sphinx_autodoc_typehints_type:`\:py\:class\:\`object\``
:param accrued: Accrued interest in percentage-of-par points, not raw currency
units.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: Price.to_clean(accrued) :module: fuggers_py.core
Convert a dirty price to a clean price.
:type accrued: :sphinx_autodoc_typehints_type:`\:py\:class\:\`object\``
:param accrued: Accrued interest in percentage-of-par points, not raw currency
units.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: Price.dollar_value(face_value) :module: fuggers_py.core
Return the currency value given a face amount in currency units.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Price.round(decimal_places) :module: fuggers_py.core
Round the percentage to `decimal_places` decimal places.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: Price.same_currency(other) :module: fuggers_py.core
Return True if two prices are denominated in the same currency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: Yield(_value, _compounding) :module: fuggers_py.core :canonical: fuggers_py.core.types.Yield
An annualized yield rate with an explicit compounding convention.
The stored value is a raw decimal rate. For example, 0.05 means 5%,
5.0 is a percentage value, and 500 basis points is 5%.
.. attribute:: _value
Yield as a raw decimal rate.
.. attribute:: _compounding
Compounding convention used to interpret the rate.
.. py:method:: Yield.new(value, compounding) :module: fuggers_py.core :classmethod:
Create a yield from a raw decimal rate.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Yield\``
.. py:method:: Yield.from_percentage(percentage, compounding) :module: fuggers_py.core :classmethod:
Create a yield from a quoted percentage rate.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Yield\``
.. py:method:: Yield.from_bps(bps, compounding) :module: fuggers_py.core :classmethod:
Create a yield from basis points.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Yield\``
.. py:method:: Yield.validate() :module: fuggers_py.core
Validate the yield is within a conservative domain of [-100%, +100%].
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: Yield.value() :module: fuggers_py.core
Return the yield as a decimal rate.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Yield.as_percentage() :module: fuggers_py.core
Return the yield as a percentage.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Yield.as_bps() :module: fuggers_py.core
Return the yield in basis points, truncated toward zero.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Yield.compounding() :module: fuggers_py.core
Return the compounding convention.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Compounding\``
.. py:method:: Yield.convert_to(target_compounding) :module: fuggers_py.core
Convert this yield to `target_compounding` preserving annual growth.
Conversion preserves the 1-year accumulation factor:
- SIMPLE: A = 1 + r
- CONTINUOUS: A = exp(r)
- n-periodic: A = (1 + r/n)^n
The target rate is solved from the same accumulation factor.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Yield\``
.. py:class:: Spread(_bps, _spread_type) :module: fuggers_py.core :canonical: fuggers_py.core.types.Spread
A spread quoted in basis points with a spread type.
The stored value is basis points, so 125 means 125 bps, or 1.25%
in percentage terms.
.. attribute:: _bps
Spread amount in basis points.
.. attribute:: _spread_type
Spread family or quoting convention.
.. py:method:: Spread.new(bps, spread_type) :module: fuggers_py.core :classmethod:
Create a spread from a basis-point value.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Spread\``
.. py:method:: Spread.from_decimal(decimal_value, spread_type) :module: fuggers_py.core :classmethod:
Create a spread from a decimal spread quote.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Spread\``
.. py:method:: Spread.from_bps_i32(value, spread_type) :module: fuggers_py.core :classmethod:
Create a spread from an integer basis-point value.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Spread\``
.. py:method:: Spread.as_bps() :module: fuggers_py.core
Return the spread in basis points.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Spread.as_decimal() :module: fuggers_py.core
Return the spread as a decimal.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Spread.as_percentage() :module: fuggers_py.core
Return the spread as a percentage.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Spread.spread_type() :module: fuggers_py.core
Return the spread type.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.SpreadType\``
.. py:method:: Spread.is_positive() :module: fuggers_py.core
Return True if the spread is strictly positive.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Spread.is_negative() :module: fuggers_py.core
Return True if the spread is strictly negative.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Spread.is_zero() :module: fuggers_py.core
Return True if the spread is exactly zero.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Spread.abs() :module: fuggers_py.core
Return the absolute value of the spread.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Spread\``
.. py:method:: Spread.round(decimal_places) :module: fuggers_py.core
Round the basis-point value to `decimal_places` decimal places.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Spread\``
.. py:method:: Spread.same_type(other) :module: fuggers_py.core
Return True if two spreads have the same `SpreadType`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: SpreadType(value) :module: fuggers_py.core :canonical: fuggers_py.core.types.SpreadType
Quoted spread family used by pricing and analytics APIs.
.. py:class:: CashFlowType(value) :module: fuggers_py.core :canonical: fuggers_py.core.types.CashFlowType
Categorize a cash flow by its economic role.
.. py:class:: CashFlow(_date, _amount, _cf_type, _accrual_start=None, _accrual_end=None, _reference_rate=None, _notional_after=None) :module: fuggers_py.core :canonical: fuggers_py.core.types.CashFlow
A dated cash flow with optional accrual and reference metadata.
Amounts are stored in currency units, not as percentages. Coupon-like cash flows may carry accrual dates, a floating reference rate, and remaining notional after principal amortization.
.. attribute:: _date
Payment date.
.. attribute:: _amount
Cash amount in currency units.
.. attribute:: _cf_type
Economic classification of the cash flow.
.. attribute:: _accrual_start, _accrual_end
Optional accrual period bounds.
.. attribute:: _reference_rate
Optional floating reference rate.
.. attribute:: _notional_after
Optional remaining notional after the payment.
.. py:method:: CashFlow.new(date, amount, cf_type) :module: fuggers_py.core :classmethod:
Create a cash flow with a payment date, amount, and type.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.coupon(date, amount) :module: fuggers_py.core :classmethod:
Create a fixed coupon cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.coupon_with_accrual(date, amount, accrual_start, accrual_end) :module: fuggers_py.core :classmethod:
Create a fixed coupon with accrual start and end metadata.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.floating_coupon(date, amount, reference_rate=None) :module: fuggers_py.core :classmethod:
Create a floating coupon cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.principal(date, amount) :module: fuggers_py.core :classmethod:
Create a principal cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.partial_principal(date, amount, notional_after=None) :module: fuggers_py.core :classmethod:
Create a partial principal payment.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.final_payment(date, coupon_amount, principal_amount) :module: fuggers_py.core :classmethod:
Create a final coupon-plus-principal cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.final_payment_with_accrual(date, coupon_amount, principal_amount, accrual_start, accrual_end) :module: fuggers_py.core :classmethod:
Create a final payment with accrual metadata.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.inflation_coupon(date, amount) :module: fuggers_py.core :classmethod:
Create an inflation-linked coupon cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.inflation_principal(date, amount) :module: fuggers_py.core :classmethod:
Create an inflation-linked principal cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.date() :module: fuggers_py.core
Return the cash-flow payment date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: CashFlow.payment_date() :module: fuggers_py.core
Return the payment date (alias for `date()`).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: CashFlow.amount() :module: fuggers_py.core
Return the cash-flow amount in currency units.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: CashFlow.cf_type() :module: fuggers_py.core
Return the cash-flow type.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlowType\``
.. py:method:: CashFlow.accrual_start() :module: fuggers_py.core
Return the accrual start date if available.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\` \| \:py\:obj\:\`None\``
.. py:method:: CashFlow.accrual_end() :module: fuggers_py.core
Return the accrual end date if available.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\` \| \:py\:obj\:\`None\``
.. py:method:: CashFlow.reference_rate() :module: fuggers_py.core
Return the floating reference rate if available.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\` \| \:py\:obj\:\`None\``
.. py:method:: CashFlow.notional_after() :module: fuggers_py.core
Return the remaining notional after this cash flow, if available.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\` \| \:py\:obj\:\`None\``
.. py:method:: CashFlow.is_coupon() :module: fuggers_py.core
Return True for cash flows that contain coupon interest.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: CashFlow.is_principal() :module: fuggers_py.core
Return True for cash flows that contain principal.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: CashFlow.is_floating() :module: fuggers_py.core
Return True for floating-rate coupons.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: CashFlow.is_inflation_linked() :module: fuggers_py.core
Return True for inflation-linked cash flows.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: CashFlow.with_accrual(accrual_start, accrual_end) :module: fuggers_py.core
Return a copy with accrual metadata set.
The accrual start must not be after the accrual end.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.with_reference_rate(rate) :module: fuggers_py.core
Return a copy with the floating reference rate set.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:method:: CashFlow.with_notional_after(amount) :module: fuggers_py.core
Return a copy with the remaining notional set.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\``
.. py:class:: CashFlowSchedule(cashflows=None) :module: fuggers_py.core :canonical: fuggers_py.core.types.CashFlowSchedule
An ordered, mutable container for cash flows.
The schedule preserves insertion order, can be sorted in place by payment date, and exposes an immutable tuple view for callers that should not mutate the underlying list.
.. attribute:: _cashflows
Backing list of cash flows in insertion order.
.. py:method:: CashFlowSchedule.new() :module: fuggers_py.core :classmethod:
Create an empty schedule.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlowSchedule\``
.. py:method:: CashFlowSchedule.with_capacity(capacity) :module: fuggers_py.core :classmethod:
Create an empty schedule with a capacity hint (no-op in Python).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlowSchedule\``
.. py:method:: CashFlowSchedule.push(cf) :module: fuggers_py.core
Append a cash flow.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: CashFlowSchedule.as_slice() :module: fuggers_py.core
Return an immutable view of the cash flows.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~collections.abc.Sequence\`\\ \\\[\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\`\]`
.. py:method:: CashFlowSchedule.len() :module: fuggers_py.core
Return the number of cash flows.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: CashFlowSchedule.is_empty() :module: fuggers_py.core
Return True if the schedule is empty.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: CashFlowSchedule.iter() :module: fuggers_py.core
Return an iterator over cash flows.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~collections.abc.Iterator\`\\ \\\[\:py\:class\:\`\~fuggers\_py.core.types.CashFlow\`\]`
.. py:method:: CashFlowSchedule.total() :module: fuggers_py.core
Return the sum of all cash-flow amounts in currency units.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: CashFlowSchedule.sort_by_date() :module: fuggers_py.core
Sort cash flows in place by payment date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlowSchedule\``
.. py:method:: CashFlowSchedule.after(date) :module: fuggers_py.core
Return a new schedule containing cash flows strictly after `date`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.CashFlowSchedule\``
.. py:class:: CurrencyPair(base, quote) :module: fuggers_py.core :canonical: fuggers_py.core.ids.CurrencyPair
Normalized base/quote currency pair.
Parsing accepts separator variants such as AAA/BBB and compact
AAABBB inputs. Whitespace and separator noise are stripped before
validation, and the stored pair always keeps the base currency first.
.. py:method:: CurrencyPair.parse(value) :module: fuggers_py.core :classmethod:
Parse a currency pair from a typed or string input.
Accepts existing `CurrencyPair` objects, slash-separated strings, and
compact six-letter ISO pairs.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.CurrencyPair\``
.. py:method:: CurrencyPair.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.CurrencyPair\``
.. py:method:: CurrencyPair.as_str() :module: fuggers_py.core
Return the canonical ``AAA/BBB`` representation.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: CurveId(value) :module: fuggers_py.core :canonical: fuggers_py.core.ids.CurveId
Normalized curve identifier.
The value is stripped of leading and trailing whitespace before storage.
.. py:method:: CurveId.parse(value) :module: fuggers_py.core :classmethod:
Parse and normalize a curve identifier from any object.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.CurveId\``
.. py:method:: CurveId.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.CurveId\``
.. py:method:: CurveId.as_str() :module: fuggers_py.core
Return the normalized identifier string.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: EtfId(value) :module: fuggers_py.core :canonical: fuggers_py.core.ids.EtfId
Normalized ETF identifier.
The value is stripped of leading and trailing whitespace before storage.
.. py:method:: EtfId.parse(value) :module: fuggers_py.core :classmethod:
Parse and normalize an ETF identifier from any object.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.EtfId\``
.. py:method:: EtfId.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.EtfId\``
.. py:method:: EtfId.as_str() :module: fuggers_py.core
Return the normalized identifier string.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: InstrumentId(value) :module: fuggers_py.core :canonical: fuggers_py.core.ids.InstrumentId
Normalized instrument identifier.
The value is stripped of leading and trailing whitespace before storage.
.. py:method:: InstrumentId.parse(value) :module: fuggers_py.core :classmethod:
Parse and normalize an instrument identifier from any object.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.InstrumentId\``
.. py:method:: InstrumentId.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.InstrumentId\``
.. py:method:: InstrumentId.as_str() :module: fuggers_py.core
Return the normalized identifier string.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: PortfolioId(value) :module: fuggers_py.core :canonical: fuggers_py.core.ids.PortfolioId
Normalized portfolio identifier.
The value is stripped of leading and trailing whitespace before storage.
.. py:method:: PortfolioId.parse(value) :module: fuggers_py.core :classmethod:
Parse and normalize a portfolio identifier from any object.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.PortfolioId\``
.. py:method:: PortfolioId.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.PortfolioId\``
.. py:method:: PortfolioId.as_str() :module: fuggers_py.core
Return the normalized identifier string.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: VolSurfaceId(value) :module: fuggers_py.core :canonical: fuggers_py.core.ids.VolSurfaceId
Normalized volatility-surface identifier.
The value is stripped of leading and trailing whitespace before storage.
.. py:method:: VolSurfaceId.parse(value) :module: fuggers_py.core :classmethod:
Parse and normalize a volatility-surface identifier from any object.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.VolSurfaceId\``
.. py:method:: VolSurfaceId.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.VolSurfaceId\``
.. py:method:: VolSurfaceId.as_str() :module: fuggers_py.core
Return the normalized identifier string.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: YearMonth(year, month) :module: fuggers_py.core :canonical: fuggers_py.core.ids.YearMonth
Year-month identifier in canonical YYYY-MM form.
.. py:method:: YearMonth.parse(value) :module: fuggers_py.core :classmethod:
Parse a strict ``YYYY-MM`` year-month value from any object.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.YearMonth\``
.. py:method:: YearMonth.from_string(value) :module: fuggers_py.core :classmethod:
Compatibility alias for :meth:`parse`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.ids.YearMonth\``
.. py:method:: YearMonth.as_str() :module: fuggers_py.core
Return the canonical ``YYYY-MM`` representation.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: DayCount() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.DayCount
Abstract day-count convention interface.
Implementations return raw decimal year fractions and integer day counts. The fraction is not a percentage quote and should be used directly in accrual calculations.
.. py:method:: DayCount.name() :module: fuggers_py.core :abstractmethod:
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: DayCount.year_fraction(start, end) :module: fuggers_py.core :abstractmethod:
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: DayCount.day_count(start, end) :module: fuggers_py.core :abstractmethod:
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:class:: DayCountConvention(value) :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.DayCountConvention
Closed vocabulary of supported day-count conventions.
.. py:method:: DayCountConvention.all() :module: fuggers_py.core :classmethod:
Return all supported conventions.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`list\`\\ \\\[\:py\:class\:\`\~fuggers\_py.core.daycounts.DayCountConvention\`\]`
.. py:method:: DayCountConvention.name() :module: fuggers_py.core
Return the convention name in market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: DayCountConvention.to_day_count() :module: fuggers_py.core
Construct the day-count object for this convention.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.daycounts.DayCount\``
.. py:class:: Act360() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Act360
ACT/360 day-count convention.
.. py:method:: Act360.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Act360.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Act360.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Act365Fixed() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Act365Fixed
ACT/365F day-count convention.
.. py:method:: Act365Fixed.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Act365Fixed.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Act365Fixed.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Act365Leap() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Act365Leap
ACT/365L day-count convention.
Uses a 366-day denominator when the accrual interval contains 29 February and 365 otherwise.
.. py:method:: Act365Leap.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Act365Leap.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Act365Leap.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: ActActAfb() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.ActActAfb
ACT/ACT AFB day-count convention.
Uses a whole-years-plus-remaining-days approach. The remaining-day denominator is 366 if the residual period contains 29 February and 365 otherwise.
.. py:method:: ActActAfb.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: ActActAfb.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: ActActAfb.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: ActActIcma(_frequency) :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.ActActIcma
ACT/ACT ICMA with an explicit coupon frequency.
The convention depends on the coupon schedule frequency and on the exact coupon period boundaries used for the accrual calculation.
.. py:method:: ActActIcma.new(frequency) :module: fuggers_py.core :classmethod:
Create an ICMA day-count with the given coupon frequency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.daycounts.ActActIcma\``
.. py:method:: ActActIcma.annual() :module: fuggers_py.core :classmethod:
Create an ICMA convention with annual coupon frequency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.daycounts.ActActIcma\``
.. py:method:: ActActIcma.semi_annual() :module: fuggers_py.core :classmethod:
Create an ICMA convention with semi-annual coupon frequency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.daycounts.ActActIcma\``
.. py:method:: ActActIcma.quarterly() :module: fuggers_py.core :classmethod:
Create an ICMA convention with quarterly coupon frequency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.daycounts.ActActIcma\``
.. py:method:: ActActIcma.monthly() :module: fuggers_py.core :classmethod:
Create an ICMA convention with monthly coupon frequency.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.daycounts.ActActIcma\``
.. py:method:: ActActIcma.frequency() :module: fuggers_py.core
Return the coupon frequency used by the convention.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Frequency\``
.. py:method:: ActActIcma.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: ActActIcma.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: ActActIcma.accrued_days(accrual_start, accrual_end) :module: fuggers_py.core
Return accrued days between the accrual dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: ActActIcma.year_fraction_with_period(accrual_start, accrual_end, period_start, period_end) :module: fuggers_py.core
Return the year fraction using explicit coupon period boundaries.
The coupon period is used to normalize the accrual when the accrual
window does not match the full coupon schedule period.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: ActActIcma.year_fraction(start, end) :module: fuggers_py.core
Return the year fraction using the accrual window as the coupon period.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: ActActIsda() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.ActActIsda
ACT/ACT ISDA day-count convention.
.. py:method:: ActActIsda.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: ActActIsda.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: ActActIsda.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Thirty360E() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Thirty360E
30E/360 day-count convention (Eurobond basis).
.. py:method:: Thirty360E.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Thirty360E.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Thirty360E.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Thirty360EIsda() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Thirty360EIsda
30E/360 ISDA day-count convention with end-of-month adjustment.
.. py:method:: Thirty360EIsda.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Thirty360EIsda.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Thirty360EIsda.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Thirty360German() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Thirty360German
30/360 German day-count convention.
Also known as 30/360 ISDA in some market references.
.. py:method:: Thirty360German.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Thirty360German.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Thirty360German.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Thirty360US() :module: fuggers_py.core :canonical: fuggers_py.core.daycounts.Thirty360US
30/360 US day-count convention.
Also known as Bond Basis. The implementation includes end-of-February handling consistent with common market practice.
.. py:method:: Thirty360US.name() :module: fuggers_py.core
Return the convention name in its market-standard form.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Thirty360US.day_count(start, end) :module: fuggers_py.core
Return the signed day count between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: Thirty360US.year_fraction(start, end) :module: fuggers_py.core
Return the raw decimal year fraction between two dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:attribute:: Act365 :module: fuggers_py.core
alias of :py:class:~fuggers_py.core.daycounts.Act365Fixed
.. py:attribute:: Thirty360 :module: fuggers_py.core
alias of :py:class:~fuggers_py.core.daycounts.Thirty360US
.. py:class:: BusinessDayConvention(value) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.BusinessDayConvention
Business-day adjustment convention.
.. py:class:: WeekendType(value) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.WeekendType
Weekend definition used by a calendar.
.. py:method:: WeekendType.is_weekend(weekday) :module: fuggers_py.core
Return True if `weekday` is a weekend day under this weekend type.
`weekday` follows Python's convention: Monday=0 ... Sunday=6.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: Calendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.Calendar
Abstract business-day calendar interface.
Implementations decide whether a Date is a business day and inherit the
standard adjustment and counting rules defined here.
.. py:method:: Calendar.name() :module: fuggers_py.core :abstractmethod:
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Calendar.is_business_day(date) :module: fuggers_py.core :abstractmethod:
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Calendar.is_holiday(date) :module: fuggers_py.core
Return True if `date` is a holiday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: Calendar.adjust(date, convention) :module: fuggers_py.core
Adjust a date according to a business-day convention.
`FOLLOWING` and `PRECEDING` move forward or backward until a business
day is found. Modified conventions roll back or forward if the adjusted
date would cross month-end. `NEAREST` prefers the later date on a tie.
`END_OF_MONTH` preserves month-end dates by rolling backward if needed.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Calendar.add_business_days(date, days) :module: fuggers_py.core
Add business days relative to a calendar.
The start date is excluded from the count. Positive values move
forward, negative values move backward, and only business days are
counted.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Calendar.settlement_date(trade_date, settlement_days) :module: fuggers_py.core
Return the settlement date for a trade date and business-day lag.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Calendar.next_business_day(date) :module: fuggers_py.core
Return `date` if it is open, otherwise the next business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Calendar.previous_business_day(date) :module: fuggers_py.core
Return `date` if it is open, otherwise the previous business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Calendar.business_days_between(start, end) :module: fuggers_py.core
Count business days between dates.
The count is start-exclusive and end-inclusive. Negative intervals are
returned as negative counts.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:class:: WeekendCalendar(weekend_type=WeekendType.SATURDAY_SUNDAY, name=’WeekendCalendar’) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.WeekendCalendar
Calendar that treats weekends as non-business days and nothing else.
.. py:method:: WeekendCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: WeekendCalendar.weekend_type() :module: fuggers_py.core
Return the weekend type.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.WeekendType\``
.. py:method:: WeekendCalendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: USCalendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.USCalendar
US calendar alias that currently matches the SIFMA holiday set.
.. py:method:: USCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: SIFMACalendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.SIFMACalendar
US SIFMA bond-market calendar with rule-based holidays.
.. py:method:: SIFMACalendar.new() :module: fuggers_py.core :classmethod:
Create a new SIFMA calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.SIFMACalendar\``
.. py:method:: SIFMACalendar.global_(cls) :module: fuggers_py.core :classmethod:
Return a cached singleton instance.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.SIFMACalendar\``
.. rubric:: Notes
Python reserves the keyword `global`, so this API uses `global_()`
for the cached singleton constructor.
.. py:method:: SIFMACalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: SIFMACalendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: USGovernmentCalendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.USGovernmentCalendar
US Government calendar.
For the current core layer this intentionally matches the SIFMA holiday set. This keeps US government and bond-market settlement logic aligned until the repo adds a distinct government-market calendar.
.. py:method:: USGovernmentCalendar.new() :module: fuggers_py.core :classmethod:
Create a new US Government calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.USGovernmentCalendar\``
.. py:method:: USGovernmentCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:class:: Target2Calendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.Target2Calendar
TARGET2 euro-system calendar with the standard holiday set.
.. py:method:: Target2Calendar.new() :module: fuggers_py.core :classmethod:
Create a new TARGET2 calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.Target2Calendar\``
.. py:method:: Target2Calendar.global_(cls) :module: fuggers_py.core :classmethod:
Return a cached singleton instance.
See `SIFMACalendar.global_()` for the naming rationale.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.Target2Calendar\``
.. py:method:: Target2Calendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: Target2Calendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: UKCalendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.UKCalendar
UK calendar using England and Wales bank holidays.
.. py:method:: UKCalendar.new() :module: fuggers_py.core :classmethod:
Create a new UK calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.UKCalendar\``
.. py:method:: UKCalendar.global_(cls) :module: fuggers_py.core :classmethod:
Return a cached singleton instance.
See `SIFMACalendar.global_()` for the naming rationale.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.UKCalendar\``
.. py:method:: UKCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: UKCalendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: JapanCalendar() :module: fuggers_py.core :canonical: fuggers_py.core.calendars.JapanCalendar
Japan calendar with a simplified rule-based holiday set.
.. py:method:: JapanCalendar.new() :module: fuggers_py.core :classmethod:
Create a new Japan calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.JapanCalendar\``
.. py:method:: JapanCalendar.global_(cls) :module: fuggers_py.core :classmethod:
Return a cached singleton instance.
See `SIFMACalendar.global_()` for the naming rationale.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.JapanCalendar\``
.. py:method:: JapanCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: JapanCalendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: JointCalendar(calendars) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.JointCalendar
Calendar that is open only when all component calendars are open.
.. py:method:: JointCalendar.new(calendars) :module: fuggers_py.core :classmethod:
Create a joint calendar from component calendars.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.JointCalendar\``
.. py:method:: JointCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: JointCalendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:class:: HolidayBitmap(name, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.HolidayBitmap
Mutable holiday container backed by a Python set.
Weekend handling is separate from the stored holiday set, so callers can use this type for holiday-only logic or combine it with a weekend rule.
.. py:method:: HolidayBitmap.new(name, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :classmethod:
Create an empty holiday container.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayBitmap\``
.. py:method:: HolidayBitmap.from_holidays(name, holidays, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :classmethod:
Create a holiday container from an iterable of holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayBitmap\``
.. py:method:: HolidayBitmap.name() :module: fuggers_py.core
Return the name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: HolidayBitmap.weekend_type() :module: fuggers_py.core
Return the weekend type.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.WeekendType\``
.. py:method:: HolidayBitmap.add_holiday(date) :module: fuggers_py.core
Add a holiday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: HolidayBitmap.add_holidays(dates) :module: fuggers_py.core
Add multiple holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: HolidayBitmap.remove_holiday(date) :module: fuggers_py.core
Remove a holiday if present.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: HolidayBitmap.is_holiday(date) :module: fuggers_py.core
Return True if the date is a holiday (ignores weekends).
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: HolidayBitmap.is_business_day(year, month, day) :module: fuggers_py.core
Return True if the Y/M/D is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: HolidayBitmap.is_business_day_date(date) :module: fuggers_py.core
Return True if the date is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: HolidayBitmap.count_holidays() :module: fuggers_py.core
Return the number of stored holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:class:: HolidayCalendarBuilder(name) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.HolidayCalendarBuilder
Builder for HolidayBitmap objects.
The builder collects explicit dates and year-based holiday rules, then evaluates them over an optional inclusive year range.
.. py:method:: HolidayCalendarBuilder.new(name) :module: fuggers_py.core :classmethod:
Create a new builder.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.weekend(weekend_type) :module: fuggers_py.core
Set the weekend rule used by the built calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.year_range(start, end) :module: fuggers_py.core
Set the inclusive year range used when materializing rules.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_holiday(date) :module: fuggers_py.core
Add an explicit holiday date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_holidays(dates) :module: fuggers_py.core
Add explicit holiday dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_fixed_holiday(month, day, observe_weekend) :module: fuggers_py.core
Add a fixed-date holiday for each year in range.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_fixed_holiday_from(month, day, from_year, observe_weekend) :module: fuggers_py.core
Add a fixed-date holiday for each year starting at `from_year`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_nth_weekday_holiday(month, weekday, occurrence) :module: fuggers_py.core
Add an Nth-weekday holiday such as a third Monday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_last_weekday_holiday(month, weekday) :module: fuggers_py.core
Add a last-weekday holiday such as the last Monday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_easter_holiday(offset_days) :module: fuggers_py.core
Add an Easter-relative holiday offset from Easter Sunday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.add_custom_holidays(generator) :module: fuggers_py.core
Add custom holidays from a per-year generator.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayCalendarBuilder\``
.. py:method:: HolidayCalendarBuilder.build() :module: fuggers_py.core
Build the `HolidayBitmap` from explicit dates and year rules.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.HolidayBitmap\``
.. py:class:: CalendarData(name, weekend=WeekendType.SATURDAY_SUNDAY, holidays=()) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.CalendarData
Serializable snapshot of a calendar definition.
The snapshot captures the calendar name, weekend rule, and explicit holiday dates in a form that can be serialized to JSON.
.. py:method:: CalendarData.new(name) :module: fuggers_py.core :classmethod:
Create an empty calendar data container.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:method:: CalendarData.with_weekend(weekend_type) :module: fuggers_py.core
Return a copy with the weekend rule updated.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:method:: CalendarData.with_holiday(date) :module: fuggers_py.core
Return a copy with an added holiday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:method:: CalendarData.with_holidays(dates) :module: fuggers_py.core
Return a copy with added holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:method:: CalendarData.build() :module: fuggers_py.core
Return the built `CalendarData` unchanged.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:method:: CalendarData.to_dict() :module: fuggers_py.core
Return a JSON-serializable dictionary.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`dict\`\\ \\\[\:py\:class\:\`str\`\, \:py\:class\:\`object\`\]`
.. py:method:: CalendarData.from_dict(data) :module: fuggers_py.core :classmethod:
Parse `CalendarData` from a dictionary.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:class:: DynamicCalendar(name, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.DynamicCalendar
A mutable calendar loaded or assembled at runtime.
.. py:method:: DynamicCalendar.new(name, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :classmethod:
Create an empty dynamic calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.from_dates(name, dates, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :classmethod:
Create a calendar from `Date` holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.from_naive_dates(name, dates, weekend_type=WeekendType.SATURDAY_SUNDAY) :module: fuggers_py.core :classmethod:
Create a calendar from `datetime.date` holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.from_json(text) :module: fuggers_py.core :classmethod:
Load a calendar from JSON text.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.from_json_file(path) :module: fuggers_py.core :classmethod:
Load a calendar from a JSON file.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.from_calendar_data(calendar_data) :module: fuggers_py.core :classmethod:
Create a calendar from `CalendarData`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.from_loader(loader_callable) :module: fuggers_py.core :classmethod:
Create a calendar from a loader callable.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.calendar_name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: DynamicCalendar.name() :module: fuggers_py.core
Return the calendar name.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: DynamicCalendar.weekend_type() :module: fuggers_py.core
Return the weekend type.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.WeekendType\``
.. py:method:: DynamicCalendar.add_holiday(date) :module: fuggers_py.core
Add a holiday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.add_holiday_naive(date) :module: fuggers_py.core
Add a holiday using a `datetime.date`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.add_holidays(dates) :module: fuggers_py.core
Add multiple holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.add_holidays_naive(dates) :module: fuggers_py.core
Add multiple `datetime.date` holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.remove_holiday(date) :module: fuggers_py.core
Remove a holiday if present.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.remove_holiday_naive(date) :module: fuggers_py.core
Remove a `datetime.date` holiday if present.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.add_holidays_for_year(year, generator) :module: fuggers_py.core
Add holidays for a given year from a generator.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.holiday_count() :module: fuggers_py.core
Return the number of stored holidays.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`int\``
.. py:method:: DynamicCalendar.is_holiday_date(date) :module: fuggers_py.core
Return True if the given `Date` is a holiday, ignoring weekends.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: DynamicCalendar.is_holiday_naive(date) :module: fuggers_py.core
Return True if the given `datetime.date` is a holiday, ignoring weekends.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: DynamicCalendar.is_business_day(date) :module: fuggers_py.core
Return True if `date` is a business day.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`bool\``
.. py:method:: DynamicCalendar.merge(other) :module: fuggers_py.core
Return a new calendar that is the union of this calendar and `other`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:method:: DynamicCalendar.merge_from(other) :module: fuggers_py.core
Merge `other` into this calendar in place.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:method:: DynamicCalendar.to_calendar_data() :module: fuggers_py.core
Convert the calendar to `CalendarData`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CalendarData\``
.. py:method:: DynamicCalendar.to_json() :module: fuggers_py.core
Serialize to JSON.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`str\``
.. py:method:: DynamicCalendar.to_json_file(path) :module: fuggers_py.core
Serialize to a JSON file.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:obj\:\`None\``
.. py:class:: CustomCalendarBuilder(name) :module: fuggers_py.core :canonical: fuggers_py.core.calendars.CustomCalendarBuilder
Convenience builder for DynamicCalendar.
This builder mirrors HolidayCalendarBuilder but materializes a mutable
calendar object instead of an immutable holiday container.
.. py:method:: CustomCalendarBuilder.new(name) :module: fuggers_py.core :classmethod:
Create a builder.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.weekend(weekend_type) :module: fuggers_py.core
Set the weekend rule used by the built calendar.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.year_range(start, end) :module: fuggers_py.core
Set the inclusive year range used when materializing rules.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_date(date) :module: fuggers_py.core
Add an explicit holiday date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_dates(dates) :module: fuggers_py.core
Add explicit holiday dates.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_fixed_holiday(month, day) :module: fuggers_py.core
Add a fixed holiday without weekend observation.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_fixed_holiday_observed(month, day) :module: fuggers_py.core
Add a fixed holiday with US-style weekend observation.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_fixed_holiday_from(month, day, from_year) :module: fuggers_py.core
Add a fixed holiday from `from_year` inclusive with weekend observation.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_nth_weekday(month, weekday, occurrence) :module: fuggers_py.core
Add an Nth-weekday holiday such as a third Monday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_last_weekday(month, weekday) :module: fuggers_py.core
Add a last-weekday holiday such as the last Monday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_easter_offset(offset_days) :module: fuggers_py.core
Add an Easter-relative holiday offset from Easter Sunday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_good_friday() :module: fuggers_py.core
Add Good Friday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_easter_monday() :module: fuggers_py.core
Add Easter Monday.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.add_custom(generator) :module: fuggers_py.core
Add a custom per-year holiday generator.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.CustomCalendarBuilder\``
.. py:method:: CustomCalendarBuilder.build() :module: fuggers_py.core
Build the dynamic calendar from the configured rules.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.calendars.DynamicCalendar\``
.. py:function:: easter_sunday(year) :module: fuggers_py.core
Return Easter Sunday for the given year in the Gregorian calendar.
:rtype: :sphinx_autodoc_typehints_type:\:py\:class\:\~fuggers_py.core.types.Date``
.. py:function:: last_weekday_of_month(year, month, weekday) :module: fuggers_py.core
Return the last occurrence of a weekday in a month.
:rtype: :sphinx_autodoc_typehints_type:\:py\:class\:\~fuggers_py.core.types.Date``
.. py:function:: nth_weekday_of_month(year, month, weekday, occurrence) :module: fuggers_py.core
Return the Nth occurrence of a weekday in a month.
:rtype: :sphinx_autodoc_typehints_type:\:py\:class\:\~fuggers_py.core.types.Date``
.. py:function:: observed_date(date) :module: fuggers_py.core
Return the US-style observed date for a holiday on a weekend.
Saturday -> Friday
Sunday -> Monday
:rtype: :sphinx_autodoc_typehints_type:\:py\:class\:\~fuggers_py.core.types.Date``
.. py:class:: YieldCurve() :module: fuggers_py.core :canonical: fuggers_py.core.traits.YieldCurve
A discount curve interface.
Implementations should provide discount factors and, where useful, zero rates. The interface is expressed in raw decimal units.
.. py:method:: YieldCurve.reference_date() :module: fuggers_py.core :abstractmethod:
Return the curve's reference or anchor date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: YieldCurve.discount_factor(date) :module: fuggers_py.core :abstractmethod:
Return the discount factor from `reference_date()` to `date`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: YieldCurve.zero_rate(date) :module: fuggers_py.core :abstractmethod:
Return the zero rate from `reference_date()` to `date`.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Yield\``
.. py:method:: YieldCurve.forward_rate(start, end) :module: fuggers_py.core
Return the annualized simple forward rate implied by discount factors.
This default implementation uses an ACT/365F year fraction:
f = (DF(start)/DF(end) - 1) / ((end-start)/365)
Implementations may override this for a different convention or for
improved numerical handling.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: YieldCurve.max_date() :module: fuggers_py.core :abstractmethod:
Return the maximum supported curve date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:class:: PricingEngine() :module: fuggers_py.core :canonical: fuggers_py.core.traits.PricingEngine
An interface for bond pricing engines.
.. py:method:: PricingEngine.price(bond, curve, settlement_date) :module: fuggers_py.core :abstractmethod:
Return the bond price at the requested settlement date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Price\``
.. py:method:: PricingEngine.yield_to_maturity(bond, price, settlement_date) :module: fuggers_py.core :abstractmethod:
Return the yield to maturity implied by a price.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Yield\``
.. py:class:: RiskCalculator() :module: fuggers_py.core :canonical: fuggers_py.core.traits.RiskCalculator
An interface for standard bond risk measures.
.. py:method:: RiskCalculator.modified_duration(bond, curve, settlement_date) :module: fuggers_py.core :abstractmethod:
Return modified duration.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: RiskCalculator.macaulay_duration(bond, curve, settlement_date) :module: fuggers_py.core :abstractmethod:
Return Macaulay duration.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: RiskCalculator.convexity(bond, curve, settlement_date) :module: fuggers_py.core :abstractmethod:
Return convexity.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: RiskCalculator.dv01(bond, curve, settlement_date) :module: fuggers_py.core :abstractmethod:
Return DV01, the dollar value of a basis point.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: Discountable() :module: fuggers_py.core :canonical: fuggers_py.core.traits.Discountable
An interface for a dated cash flow that can be discounted.
.. py:method:: Discountable.payment_date() :module: fuggers_py.core :abstractmethod:
Return the payment date.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Date\``
.. py:method:: Discountable.amount() :module: fuggers_py.core :abstractmethod:
Return the cash-flow amount in currency units.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:method:: Discountable.present_value(curve) :module: fuggers_py.core
Return present value using the curve's discount factor.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~decimal.Decimal\``
.. py:class:: SpreadCalculator() :module: fuggers_py.core :canonical: fuggers_py.core.traits.SpreadCalculator
An interface for spread calculations.
.. py:method:: SpreadCalculator.z_spread(bond, price, curve, settlement_date) :module: fuggers_py.core :abstractmethod:
Return the z-spread implied by a bond price and discount curve.
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.core.types.Spread\``