Swap Class Reference
[Financial instruments]

#include <ql/instruments/swap.hpp>

Inheritance diagram for Swap:

Inheritance graph
[legend]
List of all members.

Detailed Description

Interest rate swap.

The cash flows belonging to the first leg are paid; the ones belonging to the second leg are received.


Public Member Functions

 Swap (const Handle< YieldTermStructure > &termStructure, const Leg &firstLeg, const Leg &secondLeg)
 Swap (const Handle< YieldTermStructure > &termStructure, const std::vector< Leg > &legs, const std::vector< bool > &payer)
Instrument interface
bool isExpired () const
 returns whether the instrument is still tradable.
Additional interface
Date startDate () const
Date maturityDate () const
Real legBPS (Size j) const
Real legNPV (Size j) const
const Leg & leg (Size j) const
const Handle< YieldTermStructure > & termStructure () const

Protected Member Functions

void setupExpired () const
void performCalculations () const

Protected Attributes

Handle< YieldTermStructuretermStructure_
std::vector< Leg > legs_
std::vector< Real > payer_
std::vector< Real > legNPV_
std::vector< Real > legBPS_


Constructor & Destructor Documentation

Swap ( const Handle< YieldTermStructure > &  termStructure,
const Leg &  firstLeg,
const Leg &  secondLeg 
)

The cash flows belonging to the first leg are paid; the ones belonging to the second leg are received.

Swap ( const Handle< YieldTermStructure > &  termStructure,
const std::vector< Leg > &  legs,
const std::vector< bool > &  payer 
)

Multi leg constructor.


Member Function Documentation

void setupExpired (  )  const [protected, virtual]

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

Reimplemented from Instrument.

void performCalculations (  )  const [protected, virtual]

In case a pricing engine is not used, this method must be overridden to perform the actual calculations and set any needed results. In case a pricing engine is used, the default implementation can be used.

Reimplemented from Instrument.