QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
RiskyAssetSwap Class Reference

Risky asset-swap instrument. More...

#include <riskyassetswap.hpp>

+ Inheritance diagram for RiskyAssetSwap:
+ Collaboration diagram for RiskyAssetSwap:

Public Member Functions

 RiskyAssetSwap (bool fixedPayer, Real nominal, Schedule fixedSchedule, Schedule floatSchedule, DayCounter fixedDayCounter, DayCounter floatDayCounter, Rate spread, Rate recoveryRate_, Handle< YieldTermStructure > yieldTS, Handle< DefaultProbabilityTermStructure > defaultTS, Rate coupon=Null< Rate >())
 
Real fairSpread ()
 
Real floatAnnuity () const
 
Real nominal () const
 
Rate spread () const
 
bool fixedPayer () const
 
- Public Member Functions inherited from Instrument
 Instrument ()
 
Real NPV () const
 returns the net present value of the instrument. More...
 
Real errorEstimate () const
 returns the error estimate on the NPV when available. More...
 
const DatevaluationDate () const
 returns the date the net present value refers to. More...
 
template<typename T >
T result (const std::string &tag) const
 returns any additional result returned by the pricing engine. More...
 
const std::map< std::string, ext::any > & additionalResults () const
 returns all additional result returned by the pricing engine. More...
 
void setPricingEngine (const ext::shared_ptr< PricingEngine > &)
 set the pricing engine to be used. More...
 
virtual void setupArguments (PricingEngine::arguments *) const
 
virtual void fetchResults (const PricingEngine::results *) const
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Private Member Functions

void setupExpired () const override
 
bool isExpired () const override
 returns whether the instrument might have value greater than zero. More...
 
void performCalculations () const override
 
Real fixedAnnuity () const
 
Real parCoupon () const
 
Real recoveryValue () const
 
Real riskyBondPrice () const
 

Private Attributes

Real fixedAnnuity_
 
Real floatAnnuity_
 
Real parCoupon_
 
Real recoveryValue_
 
Real riskyBondPrice_
 
bool fixedPayer_
 
Real nominal_
 
Schedule fixedSchedule_
 
Schedule floatSchedule_
 
DayCounter fixedDayCounter_
 
DayCounter floatDayCounter_
 
Rate spread_
 
Rate recoveryRate_
 
Handle< YieldTermStructureyieldTS_
 
Handle< DefaultProbabilityTermStructuredefaultTS_
 
Real coupon_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Instrument
void calculate () const override
 
void performCalculations () const override
 
- Protected Member Functions inherited from LazyObject
- Protected Attributes inherited from Instrument
Real NPV_
 
Real errorEstimate_
 
Date valuationDate_
 
std::map< std::string, ext::any > additionalResults_
 
ext::shared_ptr< PricingEngineengine_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

Risky asset-swap instrument.

Definition at line 36 of file riskyassetswap.hpp.

Constructor & Destructor Documentation

◆ RiskyAssetSwap()

RiskyAssetSwap ( bool  fixedPayer,
Real  nominal,
Schedule  fixedSchedule,
Schedule  floatSchedule,
DayCounter  fixedDayCounter,
DayCounter  floatDayCounter,
Rate  spread,
Rate  recoveryRate_,
Handle< YieldTermStructure yieldTS,
Handle< DefaultProbabilityTermStructure defaultTS,
Rate  coupon = Null<Rate>() 
)

Definition at line 27 of file riskyassetswap.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ fairSpread()

Real fairSpread ( )

Definition at line 159 of file riskyassetswap.cpp.

+ Here is the call graph for this function:

◆ floatAnnuity()

Real floatAnnuity ( ) const

Definition at line 82 of file riskyassetswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nominal()

Real nominal ( ) const

Definition at line 54 of file riskyassetswap.hpp.

◆ spread()

Rate spread ( ) const

Definition at line 55 of file riskyassetswap.hpp.

◆ fixedPayer()

bool fixedPayer ( ) const

Definition at line 56 of file riskyassetswap.hpp.

◆ setupExpired()

void setupExpired ( ) const
overrideprivatevirtual

This method must leave the instrument in a consistent state when the expiration condition is met.

Reimplemented from Instrument.

Definition at line 53 of file riskyassetswap.cpp.

+ Here is the call graph for this function:

◆ isExpired()

bool isExpired ( ) const
overrideprivatevirtual

returns whether the instrument might have value greater than zero.

Implements Instrument.

Definition at line 47 of file riskyassetswap.cpp.

+ Here is the call graph for this function:

◆ performCalculations()

void performCalculations ( ) const
overrideprivatevirtual

This method must implement any calculations which must be (re)done in order to calculate the desired results.

Implements LazyObject.

Definition at line 58 of file riskyassetswap.cpp.

+ Here is the call graph for this function:

◆ fixedAnnuity()

Real fixedAnnuity ( ) const
private

Definition at line 93 of file riskyassetswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parCoupon()

Real parCoupon ( ) const
private

Definition at line 104 of file riskyassetswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recoveryValue()

Real recoveryValue ( ) const
private

Definition at line 111 of file riskyassetswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ riskyBondPrice()

Real riskyBondPrice ( ) const
private

Definition at line 141 of file riskyassetswap.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fixedAnnuity_

Real fixedAnnuity_
mutableprivate

Definition at line 69 of file riskyassetswap.hpp.

◆ floatAnnuity_

Real floatAnnuity_
mutableprivate

Definition at line 70 of file riskyassetswap.hpp.

◆ parCoupon_

Real parCoupon_
mutableprivate

Definition at line 71 of file riskyassetswap.hpp.

◆ recoveryValue_

Real recoveryValue_
mutableprivate

Definition at line 72 of file riskyassetswap.hpp.

◆ riskyBondPrice_

Real riskyBondPrice_
mutableprivate

Definition at line 73 of file riskyassetswap.hpp.

◆ fixedPayer_

bool fixedPayer_
private

Definition at line 76 of file riskyassetswap.hpp.

◆ nominal_

Real nominal_
private

Definition at line 77 of file riskyassetswap.hpp.

◆ fixedSchedule_

Schedule fixedSchedule_
private

Definition at line 78 of file riskyassetswap.hpp.

◆ floatSchedule_

Schedule floatSchedule_
private

Definition at line 78 of file riskyassetswap.hpp.

◆ fixedDayCounter_

DayCounter fixedDayCounter_
private

Definition at line 79 of file riskyassetswap.hpp.

◆ floatDayCounter_

DayCounter floatDayCounter_
private

Definition at line 79 of file riskyassetswap.hpp.

◆ spread_

Rate spread_
private

Definition at line 80 of file riskyassetswap.hpp.

◆ recoveryRate_

Rate recoveryRate_
private

Definition at line 81 of file riskyassetswap.hpp.

◆ yieldTS_

Handle<YieldTermStructure> yieldTS_
private

Definition at line 82 of file riskyassetswap.hpp.

◆ defaultTS_

Definition at line 83 of file riskyassetswap.hpp.

◆ coupon_

Real coupon_
mutableprivate

Definition at line 84 of file riskyassetswap.hpp.