finpricing.model.bond_curve_solver
#
Module Contents#
Classes#
- class finpricing.model.bond_curve_solver.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.bond_curve_solver.PenaltyParameter[source]#
- penalty_ridge_tuning: float = 0.0001#
- penalize_sample_size: bool = True#
- penalize_maturity_span: bool = True#
- penalize_inverted_curve: bool = True#
- penalty_inverted_tuning: float = 0.2#
- penalty_inverted_threshold: float = 0.01#
- median_dummy_curve_level: float = 0.009730434692816878#
- class finpricing.model.bond_curve_solver.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]#