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

Basis swap: compounded overnight rate in ccy 1 vs. compounded overnight rate in ccy 2. More...

#include <qle/instruments/oiccbasisswap.hpp>

+ Inheritance diagram for OvernightIndexedCrossCcyBasisSwap:
+ Collaboration diagram for OvernightIndexedCrossCcyBasisSwap:

Classes

class  arguments
 
class  engine
 
class  results
 

Public Member Functions

 OvernightIndexedCrossCcyBasisSwap (Real payNominal, Currency payCurrency, const Schedule &paySchedule, const QuantLib::ext::shared_ptr< OvernightIndex > &payIndex, Real paySpread, Real recNominal, Currency recCurrency, const Schedule &recSchedule, const QuantLib::ext::shared_ptr< OvernightIndex > &recIndex, Real recSpread)
 
Inspectors
Real payNominal () const
 
Currency payCurrency () const
 
const Schedule & paySchedule ()
 
const QuantLib::ext::shared_ptr< OvernightIndex > & payIndex ()
 
Real paySpread () const
 
Real recNominal () const
 
Currency recCurrency () const
 
const Schedule & recSchedule ()
 
const QuantLib::ext::shared_ptr< OvernightIndex > & recIndex ()
 
Real recSpread () const
 
const Leg & payLeg () const
 
const Leg & recLeg () const
 

Results

Real payNominal_
 
Real recNominal_
 
Currency payCurrency_
 
Currency recCurrency_
 
Schedule paySchedule_
 
Schedule recSchedule_
 
QuantLib::ext::shared_ptr< OvernightIndex > payIndex_
 
QuantLib::ext::shared_ptr< OvernightIndex > recIndex_
 
Spread paySpread_
 
Spread recSpread_
 
std::vector< Currency > currency_
 
Real fairPayLegSpread_
 
Real fairRecLegSpread_
 
Real payLegBPS () const
 
Real payLegNPV () const
 
Real fairPayLegSpread () const
 
Real recLegBPS () const
 
Real recLegNPV () const
 
Spread fairRecLegSpread () const
 
void setupArguments (PricingEngine::arguments *args) const override
 
void fetchResults (const PricingEngine::results *) const override
 
void initialize ()
 

Detailed Description

Basis swap: compounded overnight rate in ccy 1 vs. compounded overnight rate in ccy 2.

Definition at line 44 of file oiccbasisswap.hpp.

Constructor & Destructor Documentation

◆ OvernightIndexedCrossCcyBasisSwap()

OvernightIndexedCrossCcyBasisSwap ( Real  payNominal,
Currency  payCurrency,
const Schedule &  paySchedule,
const QuantLib::ext::shared_ptr< OvernightIndex > &  payIndex,
Real  paySpread,
Real  recNominal,
Currency  recCurrency,
const Schedule &  recSchedule,
const QuantLib::ext::shared_ptr< OvernightIndex > &  recIndex,
Real  recSpread 
)

Definition at line 25 of file oiccbasisswap.cpp.

32
33 registerWith(payIndex);
34 registerWith(recIndex);
35 initialize();
36}
QuantLib::ext::shared_ptr< OvernightIndex > recIndex_
const QuantLib::ext::shared_ptr< OvernightIndex > & payIndex()
QuantLib::ext::shared_ptr< OvernightIndex > payIndex_
const QuantLib::ext::shared_ptr< OvernightIndex > & recIndex()
+ Here is the call graph for this function:

Member Function Documentation

◆ payNominal()

Real payNominal ( ) const

Definition at line 100 of file oiccbasisswap.hpp.

100{ return payNominal_; }

◆ payCurrency()

Currency payCurrency ( ) const

Definition at line 104 of file oiccbasisswap.hpp.

104{ return payCurrency_; }

◆ paySchedule()

const Schedule & paySchedule ( )

Definition at line 57 of file oiccbasisswap.hpp.

57{ return paySchedule_; }

◆ payIndex()

const QuantLib::ext::shared_ptr< OvernightIndex > & payIndex ( )

Definition at line 58 of file oiccbasisswap.hpp.

58{ return payIndex_; }
+ Here is the caller graph for this function:

◆ paySpread()

Real paySpread ( ) const

Definition at line 108 of file oiccbasisswap.hpp.

108{ return paySpread_; }

◆ recNominal()

Real recNominal ( ) const

Definition at line 102 of file oiccbasisswap.hpp.

102{ return recNominal_; }

◆ recCurrency()

Currency recCurrency ( ) const

Definition at line 106 of file oiccbasisswap.hpp.

106{ return recCurrency_; }

◆ recSchedule()

const Schedule & recSchedule ( )

Definition at line 63 of file oiccbasisswap.hpp.

63{ return recSchedule_; }

◆ recIndex()

const QuantLib::ext::shared_ptr< OvernightIndex > & recIndex ( )

Definition at line 64 of file oiccbasisswap.hpp.

64{ return recIndex_; }
+ Here is the caller graph for this function:

◆ recSpread()

Real recSpread ( ) const

Definition at line 110 of file oiccbasisswap.hpp.

110{ return recSpread_; }

◆ payLeg()

const Leg & payLeg ( ) const

Definition at line 67 of file oiccbasisswap.hpp.

67{ return legs_[0]; }

◆ recLeg()

const Leg & recLeg ( ) const

Definition at line 68 of file oiccbasisswap.hpp.

68{ return legs_[1]; }

◆ payLegBPS()

Real payLegBPS ( ) const

Definition at line 73 of file oiccbasisswap.cpp.

73 {
74 calculate();
75 QL_REQUIRE(legBPS_[0] != Null<Real>(), "result not available");
76 return legBPS_[0];
77}

◆ payLegNPV()

Real payLegNPV ( ) const

Definition at line 85 of file oiccbasisswap.cpp.

85 {
86 calculate();
87 QL_REQUIRE(legNPV_[0] != Null<Real>(), "result not available");
88 return legNPV_[0];
89}

◆ fairPayLegSpread()

Spread fairPayLegSpread ( ) const

Definition at line 61 of file oiccbasisswap.cpp.

61 {
62 calculate();
63 QL_REQUIRE(fairPayLegSpread_ != Null<Real>(), "result not available");
64 return fairPayLegSpread_;
65}

◆ recLegBPS()

Real recLegBPS ( ) const

Definition at line 79 of file oiccbasisswap.cpp.

79 {
80 calculate();
81 QL_REQUIRE(legBPS_[1] != Null<Real>(), "result not available");
82 return legBPS_[1];
83}

◆ recLegNPV()

Real recLegNPV ( ) const

Definition at line 91 of file oiccbasisswap.cpp.

91 {
92 calculate();
93 QL_REQUIRE(legNPV_[1] != Null<Real>(), "result not available");
94 return legNPV_[1];
95}

◆ fairRecLegSpread()

Spread fairRecLegSpread ( ) const

Definition at line 67 of file oiccbasisswap.cpp.

67 {
68 calculate();
69 QL_REQUIRE(fairRecLegSpread_ != Null<Real>(), "result not available");
70 return fairRecLegSpread_;
71}

◆ setupArguments()

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

Definition at line 97 of file oiccbasisswap.cpp.

97 {
98 Swap::setupArguments(args);
99
100 OvernightIndexedCrossCcyBasisSwap::arguments* arguments =
101 dynamic_cast<OvernightIndexedCrossCcyBasisSwap::arguments*>(args);
102 QL_REQUIRE(arguments != 0, "wrong argument type");
103
104 arguments->currency = currency_;
105 arguments->paySpread = paySpread_;
106 arguments->recSpread = recSpread_;
107}

◆ fetchResults()

void fetchResults ( const PricingEngine::results *  r) const
override

Definition at line 109 of file oiccbasisswap.cpp.

109 {
110 Swap::fetchResults(r);
111
112 const OvernightIndexedCrossCcyBasisSwap::results* results =
113 dynamic_cast<const OvernightIndexedCrossCcyBasisSwap::results*>(r);
114 QL_REQUIRE(results != 0, "wrong result type");
115
116 fairRecLegSpread_ = results->fairRecLegSpread;
117 fairPayLegSpread_ = results->fairPayLegSpread;
118}

◆ initialize()

void initialize ( )
private

Definition at line 38 of file oiccbasisswap.cpp.

38 {
39 legs_[0] = OvernightLeg(paySchedule_, payIndex_).withNotionals(payNominal_).withSpreads(paySpread_);
40 legs_[0].insert(legs_[0].begin(),
41 QuantLib::ext::shared_ptr<CashFlow>(new SimpleCashFlow(-payNominal_, paySchedule_.dates().front())));
42 legs_[0].push_back(QuantLib::ext::shared_ptr<CashFlow>(new SimpleCashFlow(payNominal_, paySchedule_.dates().back())));
43
44 legs_[1] = OvernightLeg(recSchedule_, recIndex_).withNotionals(recNominal_).withSpreads(recSpread_);
45 legs_[1].insert(legs_[1].begin(),
46 QuantLib::ext::shared_ptr<CashFlow>(new SimpleCashFlow(-recNominal_, recSchedule_.dates().front())));
47 legs_[1].push_back(QuantLib::ext::shared_ptr<CashFlow>(new SimpleCashFlow(recNominal_, recSchedule_.dates().back())));
48
49 for (Size j = 0; j < 2; ++j) {
50 for (Leg::iterator i = legs_[j].begin(); i != legs_[j].end(); ++i)
51 registerWith(*i);
52 }
53
54 payer_[0] = -1.0;
55 payer_[1] = +1.0;
56
59}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ payNominal_

Real payNominal_
private

Definition at line 87 of file oiccbasisswap.hpp.

◆ recNominal_

Real recNominal_
private

Definition at line 87 of file oiccbasisswap.hpp.

◆ payCurrency_

Currency payCurrency_
private

Definition at line 88 of file oiccbasisswap.hpp.

◆ recCurrency_

Currency recCurrency_
private

Definition at line 88 of file oiccbasisswap.hpp.

◆ paySchedule_

Schedule paySchedule_
private

Definition at line 89 of file oiccbasisswap.hpp.

◆ recSchedule_

Schedule recSchedule_
private

Definition at line 89 of file oiccbasisswap.hpp.

◆ payIndex_

QuantLib::ext::shared_ptr<OvernightIndex> payIndex_
private

Definition at line 90 of file oiccbasisswap.hpp.

◆ recIndex_

QuantLib::ext::shared_ptr<OvernightIndex> recIndex_
private

Definition at line 90 of file oiccbasisswap.hpp.

◆ paySpread_

Spread paySpread_
private

Definition at line 91 of file oiccbasisswap.hpp.

◆ recSpread_

Spread recSpread_
private

Definition at line 91 of file oiccbasisswap.hpp.

◆ currency_

std::vector<Currency> currency_
private

Definition at line 92 of file oiccbasisswap.hpp.

◆ fairPayLegSpread_

Real fairPayLegSpread_
mutableprivate

Definition at line 94 of file oiccbasisswap.hpp.

◆ fairRecLegSpread_

Real fairRecLegSpread_
mutableprivate

Definition at line 95 of file oiccbasisswap.hpp.