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

#include <qle/instruments/creditlinkedswap.hpp>

+ Inheritance diagram for CreditLinkedSwap:
+ Collaboration diagram for CreditLinkedSwap:

Classes

struct  arguments
 

Public Types

enum class  LegType { IndependentPayments , ContingentPayments , DefaultPayments , RecoveryPayments }
 
using results = QuantLib::Instrument::results
 
using engine = QuantLib::GenericEngine< arguments, results >
 

Public Member Functions

 CreditLinkedSwap (const std::vector< Leg > &legs, const std::vector< bool > &legPayers, const std::vector< LegType > &legTypes, const bool settlesAccrual, const Real fixedRecoveryRate, const QuantExt::CreditDefaultSwap::ProtectionPaymentTime &defaultPaymentTime, const Currency &currency)
 
bool isExpired () const override
 
void setupArguments (QuantLib::PricingEngine::arguments *) const override
 
Date maturity () const
 

Private Attributes

std::vector< Leg > legs_
 
std::vector< boollegPayers_
 
std::vector< LegTypelegTypes_
 
bool settlesAccrual_
 
Real fixedRecoveryRate_
 
QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime_
 
Currency currency_
 

Detailed Description

Definition at line 34 of file creditlinkedswap.hpp.

Member Typedef Documentation

◆ results

Definition at line 55 of file creditlinkedswap.hpp.

◆ engine

using engine = QuantLib::GenericEngine<arguments, results>

Definition at line 56 of file creditlinkedswap.hpp.

Member Enumeration Documentation

◆ LegType

enum class LegType
strong
Enumerator
IndependentPayments 
ContingentPayments 
DefaultPayments 
RecoveryPayments 

Definition at line 36 of file creditlinkedswap.hpp.

Constructor & Destructor Documentation

◆ CreditLinkedSwap()

CreditLinkedSwap ( const std::vector< Leg > &  legs,
const std::vector< bool > &  legPayers,
const std::vector< LegType > &  legTypes,
const bool  settlesAccrual,
const Real  fixedRecoveryRate,
const QuantExt::CreditDefaultSwap::ProtectionPaymentTime &  defaultPaymentTime,
const Currency &  currency 
)

Definition at line 25 of file creditlinkedswap.cpp.

30 : legs_(legs), legPayers_(legPayers), legTypes_(legTypes), settlesAccrual_(settlesAccrual),
31 fixedRecoveryRate_(fixedRecoveryRate), defaultPaymentTime_(defaultPaymentTime), currency_(currency) {
32 QL_REQUIRE(legs_.size() == legPayers_.size(), "CreditLinkedSwap: legs size (" << legs_.size()
33 << ") must match legPayers size ("
34 << legPayers_.size() << ")");
35 QL_REQUIRE(legs_.size() == legTypes_.size(), "CreditLinkedSwap: legs size (" << legs_.size()
36 << ") must match legTypes size ("
37 << legTypes_.size() << ")");
38}
std::vector< LegType > legTypes_
std::vector< bool > legPayers_
QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime_

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
override

Definition at line 40 of file creditlinkedswap.cpp.

40{ return QuantLib::detail::simple_event(maturity()).hasOccurred(); }
+ Here is the call graph for this function:

◆ setupArguments()

void setupArguments ( QuantLib::PricingEngine::arguments args) const
override

Definition at line 42 of file creditlinkedswap.cpp.

42 {
43 CreditLinkedSwap::arguments* a = dynamic_cast<CreditLinkedSwap::arguments*>(args);
44 QL_REQUIRE(a != nullptr, "CreditLinkedSwap::setupArguments(): wrong argument type");
45 a->legs = legs_;
46 a->legPayers = legPayers_;
47 a->legTypes = legTypes_;
48 a->settlesAccrual = settlesAccrual_;
49 a->fixedRecoveryRate = fixedRecoveryRate_;
50 a->defaultPaymentTime = defaultPaymentTime_;
51 a->maturityDate = maturity();
52 a->currency = currency_;
53}
+ Here is the call graph for this function:

◆ maturity()

Date maturity ( ) const

Definition at line 55 of file creditlinkedswap.cpp.

55 {
56 Date maturity = Date::minDate();
57 for (auto const& l : legs_) {
58 for (auto const& c : l) {
59 maturity = std::max(maturity, c->date());
60 }
61 }
62 return maturity;
63}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ legs_

std::vector<Leg> legs_
private

Definition at line 64 of file creditlinkedswap.hpp.

◆ legPayers_

std::vector<bool> legPayers_
private

Definition at line 65 of file creditlinkedswap.hpp.

◆ legTypes_

std::vector<LegType> legTypes_
private

Definition at line 66 of file creditlinkedswap.hpp.

◆ settlesAccrual_

bool settlesAccrual_
private

Definition at line 67 of file creditlinkedswap.hpp.

◆ fixedRecoveryRate_

Real fixedRecoveryRate_
private

Definition at line 68 of file creditlinkedswap.hpp.

◆ defaultPaymentTime_

QuantExt::CreditDefaultSwap::ProtectionPaymentTime defaultPaymentTime_
private

Definition at line 69 of file creditlinkedswap.hpp.

◆ currency_

Currency currency_
private

Definition at line 70 of file creditlinkedswap.hpp.