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

Vanilla cross currency interest rate swap. More...

#include <qle/instruments/currencyswap.hpp>

+ Inheritance diagram for VanillaCrossCurrencySwap:
+ Collaboration diagram for VanillaCrossCurrencySwap:

Public Member Functions

 VanillaCrossCurrencySwap (bool payFixed, Currency fixedCcy, Real fixedNominal, const Schedule &fixedSchedule, Rate fixedRate, const DayCounter &fixedDayCount, Currency floatCcy, Real floatNominal, const Schedule &floatSchedule, const QuantLib::ext::shared_ptr< IborIndex > &iborIndex, Rate floatSpread, boost::optional< BusinessDayConvention > paymentConvention=boost::none, const bool isPhysicallySettled=true, const bool isResettable=false)
 
- Public Member Functions inherited from CurrencySwap
void alwaysForwardNotifications () override
 
void deepUpdate () override
 
Date startDate () const
 
Date maturityDate () const
 
Real legBPS (Size j) const
 
Real legNPV (Size j) const
 
Real inCcyLegBPS (Size j) const
 
Real inCcyLegNPV (Size j) const
 
DiscountFactor startDiscounts (Size j) const
 
DiscountFactor endDiscounts (Size j) const
 
DiscountFactor npvDateDiscount () const
 
const Leg & leg (Size j) const
 
const Currency & legCurrency (Size j) const
 
std::vector< Leg > legs ()
 
std::vector< Currency > currencies ()
 
bool isExpired () const override
 
void setupArguments (PricingEngine::arguments *) const override
 
void fetchResults (const PricingEngine::results *) const override
 
 CurrencySwap (const std::vector< Leg > &legs, const std::vector< bool > &payer, const std::vector< Currency > &currency, const bool isPhysicallySettled=true, const bool isResettable=false)
 

Additional Inherited Members

- Protected Member Functions inherited from CurrencySwap
void setupExpired () const override
 
 CurrencySwap (Size legs)
 
- Protected Attributes inherited from CurrencySwap
std::vector< Leg > legs_
 
std::vector< Real > payer_
 
std::vector< Currency > currency_
 
bool isPhysicallySettled_
 
bool isResettable_
 
std::vector< Real > legNPV_
 
std::vector< Real > inCcyLegNPV_
 
std::vector< Real > legBPS_
 
std::vector< Real > inCcyLegBPS_
 
std::vector< DiscountFactor > startDiscounts_
 
std::vector< DiscountFactor > endDiscounts_
 
DiscountFactor npvDateDiscount_
 

Detailed Description

Vanilla cross currency interest rate swap.

Specialised CurrencySwap: Two currencies, fixed vs. floating, constant notionals, rate and spread.

\ingroup instruments{

Definition at line 173 of file currencyswap.hpp.

Constructor & Destructor Documentation

◆ VanillaCrossCurrencySwap()

VanillaCrossCurrencySwap ( bool  payFixed,
Currency  fixedCcy,
Real  fixedNominal,
const Schedule &  fixedSchedule,
Rate  fixedRate,
const DayCounter &  fixedDayCount,
Currency  floatCcy,
Real  floatNominal,
const Schedule &  floatSchedule,
const QuantLib::ext::shared_ptr< IborIndex > &  iborIndex,
Rate  floatSpread,
boost::optional< BusinessDayConvention >  paymentConvention = boost::none,
const bool  isPhysicallySettled = true,
const bool  isResettable = false 
)

Definition at line 207 of file currencyswap.cpp.

214 : CurrencySwap(4) {
215
216 isPhysicallySettled_ = isPhysicallySettled;
217 isResettable_ = isResettable;
218
219 BusinessDayConvention convention;
220 if (paymentConvention)
221 convention = *paymentConvention;
222 else
223 convention = floatSchedule.businessDayConvention();
224
225 // fixed leg
226 currency_[0] = fixedCcy;
227 payer_[0] = (payFixed ? -1 : +1);
228 legs_[0] = FixedRateLeg(fixedSchedule)
229 .withNotionals(fixedNominal)
230 .withCouponRates(fixedRate, fixedDayCount)
231 .withPaymentAdjustment(convention);
232
233 // add initial and final notional exchange
234 currency_[1] = fixedCcy;
235 payer_[1] = payer_[0];
236 legs_[1].push_back(QuantLib::ext::shared_ptr<CashFlow>(
237 new SimpleCashFlow(-fixedNominal, fixedSchedule.calendar().adjust(fixedSchedule.dates().front(), convention))));
238 legs_[1].push_back(QuantLib::ext::shared_ptr<CashFlow>(
239 new SimpleCashFlow(fixedNominal, fixedSchedule.calendar().adjust(fixedSchedule.dates().back(), convention))));
240
241 // floating leg
242 currency_[2] = floatCcy;
243 payer_[2] = (payFixed ? +1 : -1);
244 legs_[2] = IborLeg(floatSchedule, iborIndex)
245 .withNotionals(floatNominal)
246 .withPaymentDayCounter(iborIndex->dayCounter())
247 .withPaymentAdjustment(convention)
248 .withSpreads(floatSpread);
249 for (Leg::const_iterator i = legs_[2].begin(); i < legs_[2].end(); ++i)
250 registerWith(*i);
251
252 // add initial and final notional exchange
253 currency_[3] = floatCcy;
254 payer_[3] = payer_[2];
255 legs_[3].push_back(QuantLib::ext::shared_ptr<CashFlow>(
256 new SimpleCashFlow(-floatNominal, floatSchedule.calendar().adjust(floatSchedule.dates().front(), convention))));
257 legs_[3].push_back(QuantLib::ext::shared_ptr<CashFlow>(
258 new SimpleCashFlow(floatNominal, floatSchedule.calendar().adjust(floatSchedule.dates().back(), convention))));
259}
std::vector< Currency > currency_
CurrencySwap(const std::vector< Leg > &legs, const std::vector< bool > &payer, const std::vector< Currency > &currency, const bool isPhysicallySettled=true, const bool isResettable=false)
std::vector< Leg > legs_
std::vector< Real > payer_