finpricing.model
#
Subpackages#
Submodules#
Package Contents#
Classes#
Functions#
|
Calculate CDS market spreads for a list of expiries |
- class finpricing.model.FixedBondPricer(inst: finpricing.instrument.fixed_bond.FixedBond)[source]#
Bases:
finpricing.utils.ClassUtil
- property principal_amount#
- property coupon_cashflows#
- price(valuation_date: finpricing.utils.Union[finpricing.utils.datetime.date, finpricing.utils.Date], survival_curve, discount_curve, recovery_rate: float = 0.4) float [source]#
risky pricing of a fixed bond
- Parameters:
valuation_date – valuation date
survival_curve – survival curve
discount_curve – discount curve
recovery_rate – recovery rate
- Returns:
Dirty price of the bond.
- price_with_basis(valuation_date: finpricing.utils.Union[finpricing.utils.datetime.date, finpricing.utils.Date], survival_curve, discount_curve, recovery_rate: float = 0.4, basis: float = 0.0, basis_type: str = 'AdditiveZeroRates') float [source]#
- solve_basis(valuation_date: finpricing.utils.Union[finpricing.utils.datetime.date, finpricing.utils.Date], dirty_price: float, survival_curve, discount_curve, settlement_date: finpricing.utils.Union[finpricing.utils.datetime.date, finpricing.utils.Date] = None, recovery_rate: float = 0.4, basis_type: str = 'AdditiveZeroRates', basis_solver_params=BASIS_SOLVER_PARAMS) float [source]#
- class finpricing.model.BondCurveAnalyticsHelper(bonds)[source]#
- property recovery_rates#
- property dirty_prices#
- property discount_curves#
- property survival_curves#
- property settlement_dates#
- property valuation_date#
- property maturity_dates#
maturity dates of all bonds in the portfolio
- property maturity_span#
maximum maturity minus minimum maturity in years
- setup(valuation_date: datetime.date | finpricing.utils.date.Date = None, dirty_prices: List[float] = None, discount_curves=None, survival_curves=None, recovery_rates=None, settlement_dates=None)[source]#
setup the helper in one go
- get_bond_bases(valuation_date: datetime.date | finpricing.utils.date.Date = None, dirty_prices: List[float] = None, survival_curves=None, basis_type: str = 'AdditiveZeroRates')[source]#
- class finpricing.model.BondCurveSolver(bondAnalyticsHelper: BondCurveAnalyticsHelper, initial_params=None, weights=None, penalty_params: PenaltyParameter = None)[source]#
- getSurvivalCurveGenerator(bondAnalyticsHelper: BondCurveAnalyticsHelper)[source]#
return a survival curve generator that can generate survival curves from parameters
This is actually not a true generator, but a survival curve that has the method to recreate a new survival curve with the same anchor date and pivot dates but different parameters.
- solve(dirty_prices: List[float] = None, weights: List[float] = None, params: List[float] = None)[source]#
solve the best parameters for the survival curve that minimizes the weighted residuals
- get_weighted_residuals_and_penalty(params: List[float], dirty_prices: List[float], weights: List[float], valuation_date: datetime.date | finpricing.utils.date.Date = None, basis_type: str = 'AdditiveZeroRates')[source]#
- finpricing.model.cds_market_spreads(discount_curve, survival_curve, recovery_rate: float, expiries: List[datetime.date | finpricing.utils.Date], **kwargs)[source]#
Calculate CDS market spreads for a list of expiries