QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
FloatFloatSwap Class Reference

float float swap More...

#include <ql/instruments/floatfloatswap.hpp>

+ Inheritance diagram for FloatFloatSwap:
+ Collaboration diagram for FloatFloatSwap:

Classes

class  arguments
 Arguments for float float swap calculation More...
 
class  engine
 
class  results
 Results from float float swap calculation More...
 

Public Member Functions

 FloatFloatSwap (Swap::Type type, Real nominal1, Real nominal2, const Schedule &schedule1, ext::shared_ptr< InterestRateIndex > index1, DayCounter dayCount1, const Schedule &schedule2, ext::shared_ptr< InterestRateIndex > index2, DayCounter dayCount2, bool intermediateCapitalExchange=false, bool finalCapitalExchange=false, Real gearing1=1.0, Real spread1=0.0, Real cappedRate1=Null< Real >(), Real flooredRate1=Null< Real >(), Real gearing2=1.0, Real spread2=0.0, Real cappedRate2=Null< Real >(), Real flooredRate2=Null< Real >(), const ext::optional< BusinessDayConvention > &paymentConvention1=ext::nullopt, const ext::optional< BusinessDayConvention > &paymentConvention2=ext::nullopt)
 
 FloatFloatSwap (Swap::Type type, std::vector< Real > nominal1, std::vector< Real > nominal2, Schedule schedule1, ext::shared_ptr< InterestRateIndex > index1, DayCounter dayCount1, Schedule schedule2, ext::shared_ptr< InterestRateIndex > index2, DayCounter dayCount2, bool intermediateCapitalExchange=false, bool finalCapitalExchange=false, std::vector< Real > gearing1=std::vector< Real >(), std::vector< Real > spread1=std::vector< Real >(), std::vector< Real > cappedRate1=std::vector< Real >(), std::vector< Real > flooredRate1=std::vector< Real >(), std::vector< Real > gearing2=std::vector< Real >(), std::vector< Real > spread2=std::vector< Real >(), std::vector< Real > cappedRate2=std::vector< Real >(), std::vector< Real > flooredRate2=std::vector< Real >(), const ext::optional< BusinessDayConvention > &paymentConvention1=ext::nullopt, const ext::optional< BusinessDayConvention > &paymentConvention2=ext::nullopt)
 
Inspectors
Swap::Type type () const
 
const std::vector< Real > & nominal1 () const
 
const std::vector< Real > & nominal2 () const
 
const Scheduleschedule1 () const
 
const Scheduleschedule2 () const
 
const ext::shared_ptr< InterestRateIndex > & index1 () const
 
const ext::shared_ptr< InterestRateIndex > & index2 () const
 
std::vector< Realspread1 () const
 
std::vector< Realspread2 () const
 
std::vector< Realgearing1 () const
 
std::vector< Realgearing2 () const
 
std::vector< RatecappedRate1 () const
 
std::vector< RateflooredRate1 () const
 
std::vector< RatecappedRate2 () const
 
std::vector< RateflooredRate2 () const
 
const DayCounterdayCount1 () const
 
const DayCounterdayCount2 () const
 
BusinessDayConvention paymentConvention1 () const
 
BusinessDayConvention paymentConvention2 () const
 
const Legleg1 () const
 
const Legleg2 () const
 
- Public Member Functions inherited from Swap
void deepUpdate () override
 
Size numberOfLegs () const
 
const std::vector< Leg > & legs () const
 
virtual Date startDate () const
 
virtual Date maturityDate () const
 
Real legBPS (Size j) const
 
Real legNPV (Size j) const
 
DiscountFactor startDiscounts (Size j) const
 
DiscountFactor endDiscounts (Size j) const
 
DiscountFactor npvDateDiscount () const
 
const Legleg (Size j) const
 
bool payer (Size j) const
 
bool isExpired () const override
 returns whether the instrument might have value greater than zero. More...
 
void setupArguments (PricingEngine::arguments *) const override
 
void fetchResults (const PricingEngine::results *) const override
 
 Swap (const Leg &firstLeg, const Leg &secondLeg)
 
 Swap (const std::vector< Leg > &legs, const std::vector< bool > &payer)
 
- 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 >
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...
 
- 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 ()
 

Results

Swap::Type type_
 
std::vector< Realnominal1_
 
std::vector< Realnominal2_
 
Schedule schedule1_
 
Schedule schedule2_
 
ext::shared_ptr< InterestRateIndexindex1_
 
ext::shared_ptr< InterestRateIndexindex2_
 
std::vector< Realgearing1_
 
std::vector< Realgearing2_
 
std::vector< Realspread1_
 
std::vector< Realspread2_
 
std::vector< RealcappedRate1_
 
std::vector< RealflooredRate1_
 
std::vector< RealcappedRate2_
 
std::vector< RealflooredRate2_
 
DayCounter dayCount1_
 
DayCounter dayCount2_
 
std::vector< boolisRedemptionFlow1_
 
std::vector< boolisRedemptionFlow2_
 
BusinessDayConvention paymentConvention1_
 
BusinessDayConvention paymentConvention2_
 
const bool intermediateCapitalExchange_
 
const bool finalCapitalExchange_
 
void setupArguments (PricingEngine::arguments *args) const override
 
void fetchResults (const PricingEngine::results *) const override
 
void init (ext::optional< BusinessDayConvention > paymentConvention1, ext::optional< BusinessDayConvention > paymentConvention2)
 
void setupExpired () const override
 

Additional Inherited Members

- Public Types inherited from Swap
enum  Type { Receiver = -1 , Payer = 1 }
 
- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Swap
void setupExpired () const override
 
 Swap (Size legs)
 
- Protected Member Functions inherited from Instrument
void calculate () const override
 
void performCalculations () const override
 
- Protected Member Functions inherited from LazyObject
- Protected Attributes inherited from Swap
std::vector< Leglegs_
 
std::vector< Realpayer_
 
std::vector< ReallegNPV_
 
std::vector< ReallegBPS_
 
std::vector< DiscountFactorstartDiscounts_
 
std::vector< DiscountFactorendDiscounts_
 
DiscountFactor npvDateDiscount_
 
- 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

float float swap

Definition at line 43 of file floatfloatswap.hpp.

Constructor & Destructor Documentation

◆ FloatFloatSwap() [1/2]

FloatFloatSwap ( Swap::Type  type,
Real  nominal1,
Real  nominal2,
const Schedule schedule1,
ext::shared_ptr< InterestRateIndex index1,
DayCounter  dayCount1,
const Schedule schedule2,
ext::shared_ptr< InterestRateIndex index2,
DayCounter  dayCount2,
bool  intermediateCapitalExchange = false,
bool  finalCapitalExchange = false,
Real  gearing1 = 1.0,
Real  spread1 = 0.0,
Real  cappedRate1 = Null<Real>(),
Real  flooredRate1 = Null<Real>(),
Real  gearing2 = 1.0,
Real  spread2 = 0.0,
Real  cappedRate2 = Null<Real>(),
Real  flooredRate2 = Null<Real>(),
const ext::optional< BusinessDayConvention > &  paymentConvention1 = ext::nullopt,
const ext::optional< BusinessDayConvention > &  paymentConvention2 = ext::nullopt 
)

Definition at line 37 of file floatfloatswap.cpp.

+ Here is the call graph for this function:

◆ FloatFloatSwap() [2/2]

FloatFloatSwap ( Swap::Type  type,
std::vector< Real nominal1,
std::vector< Real nominal2,
Schedule  schedule1,
ext::shared_ptr< InterestRateIndex index1,
DayCounter  dayCount1,
Schedule  schedule2,
ext::shared_ptr< InterestRateIndex index2,
DayCounter  dayCount2,
bool  intermediateCapitalExchange = false,
bool  finalCapitalExchange = false,
std::vector< Real gearing1 = std::vector<Real>(),
std::vector< Real spread1 = std::vector<Real>(),
std::vector< Real cappedRate1 = std::vector<Real>(),
std::vector< Real flooredRate1 = std::vector<Real>(),
std::vector< Real gearing2 = std::vector<Real>(),
std::vector< Real spread2 = std::vector<Real>(),
std::vector< Real cappedRate2 = std::vector<Real>(),
std::vector< Real flooredRate2 = std::vector<Real>(),
const ext::optional< BusinessDayConvention > &  paymentConvention1 = ext::nullopt,
const ext::optional< BusinessDayConvention > &  paymentConvention2 = ext::nullopt 
)

Definition at line 76 of file floatfloatswap.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ type()

Swap::Type type ( ) const

Definition at line 187 of file floatfloatswap.hpp.

◆ nominal1()

const std::vector< Real > & nominal1 ( ) const

Definition at line 189 of file floatfloatswap.hpp.

◆ nominal2()

const std::vector< Real > & nominal2 ( ) const

Definition at line 193 of file floatfloatswap.hpp.

◆ schedule1()

const Schedule & schedule1 ( ) const

Definition at line 197 of file floatfloatswap.hpp.

◆ schedule2()

const Schedule & schedule2 ( ) const

Definition at line 201 of file floatfloatswap.hpp.

◆ index1()

const ext::shared_ptr< InterestRateIndex > & index1 ( ) const

Definition at line 206 of file floatfloatswap.hpp.

◆ index2()

const ext::shared_ptr< InterestRateIndex > & index2 ( ) const

Definition at line 211 of file floatfloatswap.hpp.

◆ spread1()

std::vector< Real > spread1 ( ) const

Definition at line 215 of file floatfloatswap.hpp.

◆ spread2()

std::vector< Real > spread2 ( ) const

Definition at line 217 of file floatfloatswap.hpp.

◆ gearing1()

std::vector< Real > gearing1 ( ) const

Definition at line 219 of file floatfloatswap.hpp.

◆ gearing2()

std::vector< Real > gearing2 ( ) const

Definition at line 221 of file floatfloatswap.hpp.

◆ cappedRate1()

std::vector< Real > cappedRate1 ( ) const

Definition at line 223 of file floatfloatswap.hpp.

◆ flooredRate1()

std::vector< Real > flooredRate1 ( ) const

Definition at line 227 of file floatfloatswap.hpp.

◆ cappedRate2()

std::vector< Real > cappedRate2 ( ) const

Definition at line 225 of file floatfloatswap.hpp.

◆ flooredRate2()

std::vector< Real > flooredRate2 ( ) const

Definition at line 229 of file floatfloatswap.hpp.

◆ dayCount1()

const DayCounter & dayCount1 ( ) const

Definition at line 231 of file floatfloatswap.hpp.

◆ dayCount2()

const DayCounter & dayCount2 ( ) const

Definition at line 235 of file floatfloatswap.hpp.

◆ paymentConvention1()

BusinessDayConvention paymentConvention1 ( ) const

Definition at line 239 of file floatfloatswap.hpp.

+ Here is the caller graph for this function:

◆ paymentConvention2()

BusinessDayConvention paymentConvention2 ( ) const

Definition at line 243 of file floatfloatswap.hpp.

+ Here is the caller graph for this function:

◆ leg1()

const Leg & leg1 ( ) const

Definition at line 247 of file floatfloatswap.hpp.

+ Here is the caller graph for this function:

◆ leg2()

const Leg & leg2 ( ) const

Definition at line 249 of file floatfloatswap.hpp.

+ Here is the caller graph for this function:

◆ setupArguments()

void setupArguments ( PricingEngine::arguments ) const
overridevirtual

When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used.

Reimplemented from Instrument.

Definition at line 390 of file floatfloatswap.cpp.

+ Here is the call graph for this function:

◆ fetchResults()

void fetchResults ( const PricingEngine::results r) const
overridevirtual

When a derived result structure is defined for an instrument, this method should be overridden to read from it. This is mandatory in case a pricing engine is used.

Reimplemented from Instrument.

Definition at line 528 of file floatfloatswap.cpp.

+ Here is the call graph for this function:

◆ init()

void init ( ext::optional< BusinessDayConvention paymentConvention1,
ext::optional< BusinessDayConvention paymentConvention2 
)
private

Definition at line 110 of file floatfloatswap.cpp.

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

◆ 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 526 of file floatfloatswap.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ type_

Swap::Type type_
private

Definition at line 138 of file floatfloatswap.hpp.

◆ nominal1_

std::vector<Real> nominal1_
private

Definition at line 139 of file floatfloatswap.hpp.

◆ nominal2_

std::vector<Real> nominal2_
private

Definition at line 139 of file floatfloatswap.hpp.

◆ schedule1_

Schedule schedule1_
private

Definition at line 140 of file floatfloatswap.hpp.

◆ schedule2_

Schedule schedule2_
private

Definition at line 140 of file floatfloatswap.hpp.

◆ index1_

ext::shared_ptr<InterestRateIndex> index1_
private

Definition at line 141 of file floatfloatswap.hpp.

◆ index2_

ext::shared_ptr<InterestRateIndex> index2_
private

Definition at line 141 of file floatfloatswap.hpp.

◆ gearing1_

std::vector<Real> gearing1_
private

Definition at line 142 of file floatfloatswap.hpp.

◆ gearing2_

std::vector<Real> gearing2_
private

Definition at line 142 of file floatfloatswap.hpp.

◆ spread1_

std::vector<Real> spread1_
private

Definition at line 142 of file floatfloatswap.hpp.

◆ spread2_

std::vector<Real> spread2_
private

Definition at line 142 of file floatfloatswap.hpp.

◆ cappedRate1_

std::vector<Real> cappedRate1_
private

Definition at line 143 of file floatfloatswap.hpp.

◆ flooredRate1_

std::vector<Real> flooredRate1_
private

Definition at line 143 of file floatfloatswap.hpp.

◆ cappedRate2_

std::vector<Real> cappedRate2_
private

Definition at line 143 of file floatfloatswap.hpp.

◆ flooredRate2_

std::vector<Real> flooredRate2_
private

Definition at line 144 of file floatfloatswap.hpp.

◆ dayCount1_

DayCounter dayCount1_
private

Definition at line 145 of file floatfloatswap.hpp.

◆ dayCount2_

DayCounter dayCount2_
private

Definition at line 145 of file floatfloatswap.hpp.

◆ isRedemptionFlow1_

std::vector<bool> isRedemptionFlow1_
private

Definition at line 146 of file floatfloatswap.hpp.

◆ isRedemptionFlow2_

std::vector<bool> isRedemptionFlow2_
private

Definition at line 146 of file floatfloatswap.hpp.

◆ paymentConvention1_

BusinessDayConvention paymentConvention1_
private

Definition at line 147 of file floatfloatswap.hpp.

◆ paymentConvention2_

BusinessDayConvention paymentConvention2_
private

Definition at line 147 of file floatfloatswap.hpp.

◆ intermediateCapitalExchange_

const bool intermediateCapitalExchange_
private

Definition at line 148 of file floatfloatswap.hpp.

◆ finalCapitalExchange_

const bool finalCapitalExchange_
private

Definition at line 148 of file floatfloatswap.hpp.