fuggers_py.measuresΒΆ

User-facing analytics, report-oriented helpers, and desk measures.

.. py:module:: fuggers_py.measures

User-facing analytics, desk measures, and report-oriented helpers.

The package groups the public analytics surface into yield, spread, risk, relative-value, options, credit, funding, cashflow, and YAS subpackages. Raw decimal units are used for rates and spreads unless a helper explicitly says otherwise.

.. py:exception:: AnalyticsError :module: fuggers_py.measures :canonical: fuggers_py.measures.errors.AnalyticsError

Base exception for all analytics-layer errors.

The class also provides factory constructors that return the more specific analytics exception types used throughout the package.

.. py:method:: AnalyticsError.invalid_input(reason) :module: fuggers_py.measures :classmethod:

  Return an :class:`InvalidInput` for malformed analytics input.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.InvalidInput\``

.. py:method:: AnalyticsError.invalid_settlement(reason) :module: fuggers_py.measures :classmethod:

  Return an :class:`InvalidSettlement` for invalid settlement data.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.InvalidSettlement\``

.. py:method:: AnalyticsError.not_implemented(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`NotImplementedAnalytics` for unsupported paths.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.NotImplementedAnalytics\``

.. py:method:: AnalyticsError.yield_solver_failed(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`YieldSolverError` for solver failures.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.YieldSolverError\``

.. py:method:: AnalyticsError.pricing_failed(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`PricingError` for pricing failures.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.PricingError\``

.. py:method:: AnalyticsError.spread_failed(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`SpreadError` for spread-calculation failures.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.SpreadError\``

.. py:method:: AnalyticsError.risk_failed(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`RiskError` for risk-calculation failures.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.RiskError\``

.. py:method:: AnalyticsError.cashflow_failed(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`CashflowError` for cashflow-calculation failures.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.CashflowError\``

.. py:method:: AnalyticsError.yas_failed(reason) :module: fuggers_py.measures :classmethod:

  Return a :class:`YasError` for YAS-calculation failures.


  :rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~fuggers\_py.measures.errors.YasError\``

.. py:function:: current_yield(coupon_rate, clean_price) :module: fuggers_py.measures

Return current yield as a raw decimal.

:type coupon_rate: :sphinx_autodoc_typehints_type:\:py\:class\:\object`    :param coupon_rate: Annual coupon rate as a raw decimal or Decimal-like value.    :type coupon_rate: object    :type clean_price: :sphinx_autodoc_typehints_type::py:class:`object`` :param clean_price: Clean price in percent of par. :type clean_price: object

:returns: Current yield as a raw decimal rate. :rtype: Decimal

.. py:function:: current_yield_pct(coupon_rate, clean_price) :module: fuggers_py.measures

Return current yield as quoted percentage points.

:rtype: :sphinx_autodoc_typehints_type:\:py\:class\:\~decimal.Decimal``

.. py:function:: simple_yield(coupon_amount, clean_price, par, years) :module: fuggers_py.measures

Return simple yield as a quoted percentage.

:type coupon_amount: :sphinx_autodoc_typehints_type:\:py\:class\:\object`    :param coupon_amount: Annual coupon payment in currency units per 100 face.    :type clean_price: :sphinx_autodoc_typehints_type::py:class:`object`    :param clean_price: Clean price in percent of par.    :type par: :sphinx_autodoc_typehints_type::py:class:`object`    :param par: Par value, typically 100.    :type years: :sphinx_autodoc_typehints_type::py:class:`object`` :param years: Time to maturity in years.

:returns: Simple yield quoted as a percentage. :rtype: Decimal

.. py:function:: yield_to_maturity(bond, price, settlement_date) :module: fuggers_py.measures

Return yield to maturity from a clean price.

:type bond: :sphinx_autodoc_typehints_type:\:py\:class\:\~fuggers_py.products.bonds.traits.bond.Bond`    :param bond: Bond to value.    :type price: :sphinx_autodoc_typehints_type::py:class:`~fuggers_py.core.types.Price`    :param price: Clean price expressed as a :class:~fuggers_py.core.types.Price.    :type settlement_date: :sphinx_autodoc_typehints_type::py:class:`~fuggers_py.core.types.Date`` :param settlement_date: Settlement date used for accrued-interest and cashflow filtering.

:returns: Raw decimal yield, not a percentage. :rtype: Yield

.. rubric:: Notes

The input price is interpreted as a clean price.