Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ProxyCreditVolCurve Class Reference

#include <qle/termstructures/creditvolcurve.hpp>

+ Inheritance diagram for ProxyCreditVolCurve:
+ Collaboration diagram for ProxyCreditVolCurve:

Public Member Functions

 ProxyCreditVolCurve (const QuantLib::Handle< CreditVolCurve > &source, const std::vector< QuantLib::Period > &terms={}, const std::vector< QuantLib::Handle< CreditCurve > > &termCurves={})
 
QuantLib::Real volatility (const QuantLib::Date &exerciseDate, const QuantLib::Real underlyingLength, const QuantLib::Real strike, const Type &targetType) const override
 
const QuantLib::Date & referenceDate () const override
 
- Public Member Functions inherited from CreditVolCurve
 CreditVolCurve (QuantLib::BusinessDayConvention bdc, const QuantLib::DayCounter &dc, const std::vector< QuantLib::Period > &terms, const std::vector< QuantLib::Handle< CreditCurve > > &termCurves, const Type &type)
 
 CreditVolCurve (const QuantLib::Natural settlementDays, const QuantLib::Calendar &cal, QuantLib::BusinessDayConvention bdc, const QuantLib::DayCounter &dc, const std::vector< QuantLib::Period > &terms, const std::vector< QuantLib::Handle< CreditCurve > > &termCurves, const Type &type)
 
 CreditVolCurve (const QuantLib::Date &referenceDate, const QuantLib::Calendar &cal, QuantLib::BusinessDayConvention bdc, const QuantLib::DayCounter &dc, const std::vector< QuantLib::Period > &terms, const std::vector< QuantLib::Handle< CreditCurve > > &termCurves, const Type &type)
 
QuantLib::Real volatility (const QuantLib::Date &exerciseDate, const QuantLib::Period &underlyingTerm, const QuantLib::Real strike, const Type &targetType) const
 
virtual QuantLib::Real volatility (const QuantLib::Date &exerciseDate, const QuantLib::Real underlyingLength, const QuantLib::Real strike, const Type &targetType) const =0
 
QuantLib::Real volatility (const QuantLib::Real exerciseTime, const QuantLib::Real underlyingLength, const QuantLib::Real strike, const Type &targetType) const
 
virtual const std::vector< QuantLib::Period > & terms () const
 
virtual const std::vector< QuantLib::Handle< CreditCurve > > & termCurves () const
 
const Typetype () const
 
QuantLib::Real atmStrike (const QuantLib::Date &expiry, const QuantLib::Period &term) const
 
QuantLib::Real atmStrike (const QuantLib::Date &expiry, const QuantLib::Real underlyingLength) const
 
QuantLib::Real minStrike () const override
 
QuantLib::Real maxStrike () const override
 
QuantLib::Date maxDate () const override
 

Private Attributes

QuantLib::Handle< CreditVolCurvesource_
 

Additional Inherited Members

- Public Types inherited from CreditVolCurve
enum class  Type { Price , Spread }
 
- Protected Member Functions inherited from CreditVolCurve
void init ()
 
void update () override
 
void performCalculations () const override
 
QuantLib::Real moneyness (const QuantLib::Real strike, const QuantLib::Real atmStrike) const
 
QuantLib::Real strike (const QuantLib::Real moneyness, const QuantLib::Real atmStrike) const
 
- Protected Attributes inherited from CreditVolCurve
std::vector< QuantLib::Period > terms_
 
std::vector< QuantLib::Handle< CreditCurve > > termCurves_
 
Type type_
 
std::map< std::pair< QuantLib::Date, double >, double > atmStrikeCache_
 

Detailed Description

Definition at line 128 of file creditvolcurve.hpp.

Constructor & Destructor Documentation

◆ ProxyCreditVolCurve()

ProxyCreditVolCurve ( const QuantLib::Handle< CreditVolCurve > &  source,
const std::vector< QuantLib::Period > &  terms = {},
const std::vector< QuantLib::Handle< CreditCurve > > &  termCurves = {} 
)

Definition at line 537 of file creditvolcurve.cpp.

540 : CreditVolCurve(source->businessDayConvention(), source->dayCounter(), terms.empty() ? source->terms() : terms,
541 termCurves.empty() ? source->termCurves() : termCurves, source->type()),
542 source_(source) {
543 // check inputs to ctor for consistency
544 QL_REQUIRE(terms.size() == termCurves.size(), "ProxyCreditVolCurve: given terms (" << terms.size()
545 << ") do not match term curves ("
546 << termCurves.size() << ")");
547 registerWith(source);
548}
CreditVolCurve(QuantLib::BusinessDayConvention bdc, const QuantLib::DayCounter &dc, const std::vector< QuantLib::Period > &terms, const std::vector< QuantLib::Handle< CreditCurve > > &termCurves, const Type &type)
virtual const std::vector< QuantLib::Handle< CreditCurve > > & termCurves() const
virtual const std::vector< QuantLib::Period > & terms() const
QuantLib::Handle< CreditVolCurve > source_
+ Here is the call graph for this function:

Member Function Documentation

◆ volatility()

QuantLib::Real volatility ( const QuantLib::Date &  exerciseDate,
const QuantLib::Real  underlyingLength,
const QuantLib::Real  strike,
const Type targetType 
) const
overridevirtual

Implements CreditVolCurve.

Definition at line 550 of file creditvolcurve.cpp.

552 {
553
554 // we read the vol from the source surface keeping the moneyness constant (if meaningful)
555
556 Real effectiveStrike = strike;
557 if (!this->terms().empty() && !source_->terms().empty()) {
558 effectiveStrike = this->strike(this->moneyness(strike, this->atmStrike(exerciseDate, underlyingLength)),
559 source_->atmStrike(exerciseDate, underlyingLength));
560 }
561 return source_->volatility(exerciseDate, underlyingLength, effectiveStrike, type());
562}
QuantLib::Real moneyness(const QuantLib::Real strike, const QuantLib::Real atmStrike) const
QuantLib::Real atmStrike(const QuantLib::Date &expiry, const QuantLib::Period &term) const
QuantLib::Real strike(const QuantLib::Real moneyness, const QuantLib::Real atmStrike) const
const Type & type() const
+ Here is the call graph for this function:

◆ referenceDate()

const Date & referenceDate ( ) const
override

Definition at line 564 of file creditvolcurve.cpp.

564{ return source_->referenceDate(); }

Member Data Documentation

◆ source_

QuantLib::Handle<CreditVolCurve> source_
private

Definition at line 139 of file creditvolcurve.hpp.