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

Arguments for Flexi-Swap More...

#include <qle/instruments/flexiswap.hpp>

+ Inheritance diagram for FlexiSwap::arguments:
+ Collaboration diagram for FlexiSwap::arguments:

Public Member Functions

 arguments ()
 
void validate () const override
 

Public Attributes

VanillaSwap::Type type
 
std::vector< Real > fixedNominal
 
std::vector< Real > floatingNominal
 
std::vector< Date > fixedResetDates
 
std::vector< Date > fixedPayDates
 
std::vector< Time > floatingAccrualTimes
 
std::vector< Date > floatingResetDates
 
std::vector< Date > floatingFixingDates
 
std::vector< Date > floatingPayDates
 
std::vector< Real > fixedCoupons
 
std::vector< Real > fixedRate
 
std::vector< Real > floatingGearings
 
std::vector< Real > floatingSpreads
 
std::vector< Real > cappedRate
 
std::vector< Real > flooredRate
 
std::vector< Real > floatingCoupons
 
QuantLib::ext::shared_ptr< IborIndex > iborIndex
 
std::vector< Real > lowerNotionalBound
 
QuantLib::Position::Type optionPosition
 
std::vector< boolnotionalCanBeDecreased
 

Detailed Description

Arguments for Flexi-Swap

Definition at line 128 of file flexiswap.hpp.

Constructor & Destructor Documentation

◆ arguments()

arguments ( )

Definition at line 130 of file flexiswap.hpp.

130: type(VanillaSwap::Receiver) {}

Member Function Documentation

◆ validate()

void validate ( ) const
override

Definition at line 219 of file flexiswap.cpp.

219 {
220 Swap::arguments::validate();
221 Size ratio = floatingNominal.size() / fixedNominal.size(); // we know there is no remainder
222 bool hasOptionality = false;
223 Date today = Settings::instance().evaluationDate();
224 for (Size i = 0; i < fixedNominal.size(); ++i) {
225 for (Size j = 0; j < ratio; ++j) {
226 QL_REQUIRE(QuantLib::close_enough(fixedNominal[i], floatingNominal[i * ratio + j]),
227 "FlexiSwap::arguments::validate(): fixedNominal["
228 << i << "] = " << fixedNominal[i] << " does not match floatingNominal[" << i * ratio + j
229 << "] = " << floatingNominal[i * ratio + j] << ", ratio is " << ratio);
230 }
231 QL_REQUIRE(lowerNotionalBound[i] < fixedNominal[i] ||
232 QuantLib::close_enough(lowerNotionalBound[i], fixedNominal[i]),
233 "FlexiSwap::arguments::validate(): lowerNotionalBound[" << i << "] = " << lowerNotionalBound[i]
234 << " must be leq fixedNominal[" << i
235 << "] = " << fixedNominal[i]);
236 if (floatingResetDates[ratio * i] > today && notionalCanBeDecreased[i])
237 hasOptionality = hasOptionality || !QuantLib::close_enough(lowerNotionalBound[i], fixedNominal[i]);
238 if (i > 0 && hasOptionality) {
239 QL_REQUIRE(lowerNotionalBound[i] < lowerNotionalBound[i - 1] ||
240 QuantLib::close_enough(lowerNotionalBound[i], lowerNotionalBound[i - 1]),
241 "FlexiSwap::arguments::validate(): lowerNotionalBound["
242 << i - 1 << "] = " << lowerNotionalBound[i - 1] << " < lowerNotionalBound[" << i << "] = "
243 << lowerNotionalBound[i] << ", not allowed, since optionality has kicked in already");
244 QL_REQUIRE(fixedNominal[i] < fixedNominal[i - 1] ||
245 QuantLib::close_enough(fixedNominal[i], fixedNominal[i - 1]),
246 "FlexiSwap::arguments::validate(): fixedNominal["
247 << i - 1 << "] = " << fixedNominal[i - 1] << " < fixedNominal[" << i
248 << "] = " << fixedNominal[i] << ", not allowed, since optionality has kicked in already");
249 }
250 }
251}
std::vector< Date > floatingResetDates
Definition: flexiswap.hpp:137
std::vector< Real > fixedNominal
Definition: flexiswap.hpp:132
std::vector< Real > floatingNominal
Definition: flexiswap.hpp:132
std::vector< bool > notionalCanBeDecreased
Definition: flexiswap.hpp:153
std::vector< Real > lowerNotionalBound
Definition: flexiswap.hpp:151

Member Data Documentation

◆ type

VanillaSwap::Type type

Definition at line 131 of file flexiswap.hpp.

◆ fixedNominal

std::vector<Real> fixedNominal

Definition at line 132 of file flexiswap.hpp.

◆ floatingNominal

std::vector<Real> floatingNominal

Definition at line 132 of file flexiswap.hpp.

◆ fixedResetDates

std::vector<Date> fixedResetDates

Definition at line 134 of file flexiswap.hpp.

◆ fixedPayDates

std::vector<Date> fixedPayDates

Definition at line 135 of file flexiswap.hpp.

◆ floatingAccrualTimes

std::vector<Time> floatingAccrualTimes

Definition at line 136 of file flexiswap.hpp.

◆ floatingResetDates

std::vector<Date> floatingResetDates

Definition at line 137 of file flexiswap.hpp.

◆ floatingFixingDates

std::vector<Date> floatingFixingDates

Definition at line 138 of file flexiswap.hpp.

◆ floatingPayDates

std::vector<Date> floatingPayDates

Definition at line 139 of file flexiswap.hpp.

◆ fixedCoupons

std::vector<Real> fixedCoupons

Definition at line 141 of file flexiswap.hpp.

◆ fixedRate

std::vector<Real> fixedRate

Definition at line 142 of file flexiswap.hpp.

◆ floatingGearings

std::vector<Real> floatingGearings

Definition at line 143 of file flexiswap.hpp.

◆ floatingSpreads

std::vector<Real> floatingSpreads

Definition at line 144 of file flexiswap.hpp.

◆ cappedRate

std::vector<Real> cappedRate

Definition at line 145 of file flexiswap.hpp.

◆ flooredRate

std::vector<Real> flooredRate

Definition at line 146 of file flexiswap.hpp.

◆ floatingCoupons

std::vector<Real> floatingCoupons

Definition at line 147 of file flexiswap.hpp.

◆ iborIndex

QuantLib::ext::shared_ptr<IborIndex> iborIndex

Definition at line 149 of file flexiswap.hpp.

◆ lowerNotionalBound

std::vector<Real> lowerNotionalBound

Definition at line 151 of file flexiswap.hpp.

◆ optionPosition

QuantLib::Position::Type optionPosition

Definition at line 152 of file flexiswap.hpp.

◆ notionalCanBeDecreased

std::vector<bool> notionalCanBeDecreased

Definition at line 153 of file flexiswap.hpp.