pub struct SpreadCdsHelper { /* private fields */ }Expand description
A spread-quoted CDS as a credit bootstrap helper (SpreadCdsHelper,
defaultprobabilityhelpers.hpp:128).
The helper prices a par CDS on its own schedule against the curve being
bootstrapped and reports that contract’s fair spread as
implied_quote; the bootstrap
drives quoted spread - fair spread to zero.
The C++ CdsHelper base (defaultprobabilityhelpers.hpp:47-126) has no
separate type here. It exists in C++ only to share state and
initializeDates with UpfrontCdsHelper, and that sibling is deferred
(#676), so its state and initializeDates live directly in this struct.
Porting UpfrontCdsHelper means factoring out the fields below plus
initialize_dates
and set_term_structure,
leaving only reset_engine and implied_quote per subclass.
Implementations§
Source§impl SpreadCdsHelper
impl SpreadCdsHelper
Sourcepub fn new(
running_spread: Handle<dyn Quote>,
tenor: Period,
settlement_days: Integer,
calendar: Calendar,
frequency: Frequency,
payment_convention: BusinessDayConvention,
rule: DateGeneration,
day_counter: DayCounter,
recovery_rate: Real,
discount_curve: Handle<dyn YieldTermStructure>,
settings: Shared<Settings<Date>>,
) -> QlResult<Shared<SpreadCdsHelper>>
pub fn new( running_spread: Handle<dyn Quote>, tenor: Period, settlement_days: Integer, calendar: Calendar, frequency: Frequency, payment_convention: BusinessDayConvention, rule: DateGeneration, day_counter: DayCounter, recovery_rate: Real, discount_curve: Handle<dyn YieldTermStructure>, settings: Shared<Settings<Date>>, ) -> QlResult<Shared<SpreadCdsHelper>>
A helper on the C++ default terms (defaultprobabilityhelpers.cpp:109).
The C++ quote is a std::variant<Rate, Handle<Quote>> (hpp:129); a
quoted spread takes the Rate arm here as
make_quote_handle(spread).handle().
§Errors
As with_terms.
Sourcepub fn with_terms(
running_spread: Handle<dyn Quote>,
tenor: Period,
settlement_days: Integer,
calendar: Calendar,
frequency: Frequency,
payment_convention: BusinessDayConvention,
rule: DateGeneration,
day_counter: DayCounter,
recovery_rate: Real,
discount_curve: Handle<dyn YieldTermStructure>,
terms: CdsHelperTerms,
settings: Shared<Settings<Date>>,
) -> QlResult<Shared<SpreadCdsHelper>>
pub fn with_terms( running_spread: Handle<dyn Quote>, tenor: Period, settlement_days: Integer, calendar: Calendar, frequency: Frequency, payment_convention: BusinessDayConvention, rule: DateGeneration, day_counter: DayCounter, recovery_rate: Real, discount_curve: Handle<dyn YieldTermStructure>, terms: CdsHelperTerms, settings: Shared<Settings<Date>>, ) -> QlResult<Shared<SpreadCdsHelper>>
A helper on the given terms (defaultprobabilityhelpers.cpp:40-58).
The helper observes its quote and its discount curve (the constructor’s
registerWith(discountCurve), cpp:57) and tracks the evaluation date,
rebuilding its schedule and its contract whenever that date moves.
§Errors
Rejects the three CDS date-generation rules. Their maturity comes from
cdsMaturity (cpp:87), which is not ported, and taking the other arm
for them would silently produce a schedule ending on the wrong date; that
branch is deferred within EPIC Credit (#676).
Sourcepub fn protection_start(&self) -> Date
pub fn protection_start(&self) -> Date
The date protection starts, settlement_days past the evaluation date
(cpp:79).
Trait Implementations§
Source§impl AsObservable for SpreadCdsHelper
impl AsObservable for SpreadCdsHelper
Source§fn observable(&self) -> &Observable
fn observable(&self) -> &Observable
Source§impl DefaultProbabilityHelper for SpreadCdsHelper
impl DefaultProbabilityHelper for SpreadCdsHelper
Source§fn implied_quote(&self) -> QlResult<Real>
fn implied_quote(&self) -> QlResult<Real>
The contract’s fair spread (impliedQuote, cpp:132-135).
The recalculation is forced rather than left to the cache: the helper
weak-links the curve handle the engine prices over, so a node the
bootstrap has just moved does not notify the contract, and a plain
fair_spread would answer from the previous iteration’s results.
Source§fn set_term_structure(
&self,
term_structure: &Shared<dyn DefaultProbabilityTermStructure>,
)
fn set_term_structure( &self, term_structure: &Shared<dyn DefaultProbabilityTermStructure>, )
Records the curve, hands it to the engine, and rebuilds the contract
(setTermStructure, cpp:60-68).
The engine’s handle is linked weakly, the port of the C++
linkTo(..., false) at cpp:63-65: the curve owns this helper, which
owns the contract, which owns the engine, and a strong link would close
that ring.
Source§fn base(&self) -> &DefaultProbabilityHelperBase
fn base(&self) -> &DefaultProbabilityHelperBase
Source§fn quote_error(&self) -> QlResult<Real>
fn quote_error(&self) -> QlResult<Real>
Source§fn earliest_date(&self) -> Date
fn earliest_date(&self) -> Date
Source§fn maturity_date(&self) -> Date
fn maturity_date(&self) -> Date
Source§fn latest_relevant_date(&self) -> Date
fn latest_relevant_date(&self) -> Date
Source§fn pillar_date(&self) -> Date
fn pillar_date(&self) -> Date
Source§fn latest_date(&self) -> Date
fn latest_date(&self) -> Date
Source§impl RelativeDateDefaultProbabilityHelper for SpreadCdsHelper
impl RelativeDateDefaultProbabilityHelper for SpreadCdsHelper
Source§fn initialize_dates(&self)
fn initialize_dates(&self)
Rebuilds the schedule off the current evaluation date (initializeDates,
cpp:75-108).
Protection starts settlement_days past the evaluation date and, absent
an explicit start, the schedule starts there too, rolled to a business
day. The maturity is the tenor past that same reference date - the
cdsMaturity arm above it (cpp:86-88) covers only the three CDS rules,
which the constructor rejects; TwentiethIMM takes this arm.
The earliest date is the schedule’s first date and the latest its last,
rolled. C++ then adds a day under the ISDA model (cpp:105-106); the
midpoint model, the only one ported, does not.