Cashflows Class Reference

#include <ql/CashFlows/analysis.hpp>

List of all members.


Detailed Description

cashflows analysis functions

Todo:
add tests


Static Public Member Functions

static Real npv (const std::vector< boost::shared_ptr< CashFlow > > &, const Handle< YieldTermStructure > &)
 NPV of the cash flows.
static Real npv (const std::vector< boost::shared_ptr< CashFlow > > &, const InterestRate &, Date settlementDate=Date())
 NPV of the cash flows.
static Rate irr (const std::vector< boost::shared_ptr< CashFlow > > &, Real marketPrice, const DayCounter &dayCounter, Compounding compounding, Frequency frequency=NoFrequency, Date settlementDate=Date(), Real tolerance=1.0e-10, Size maxIterations=10000, Rate guess=0.05)
 Internal rate of return.
static Real convexity (const std::vector< boost::shared_ptr< CashFlow > > &, const InterestRate &, Date settlementDate=Date())
 Cash-flow convexity.
static Time duration (const std::vector< boost::shared_ptr< CashFlow > > &, Real marketPrice, const InterestRate &, Duration::Type type=Duration::Simple, Date settlementDate=Date())
 Cash-flow duration.


Member Function Documentation

static Real npv const std::vector< boost::shared_ptr< CashFlow > > &  ,
const Handle< YieldTermStructure > & 
[static]
 

NPV of the cash flows.

THe NPV is the sum of the cash flows, each discounted according to the given term structure.

static Real npv const std::vector< boost::shared_ptr< CashFlow > > &  ,
const InterestRate ,
Date  settlementDate = Date()
[static]
 

NPV of the cash flows.

The NPV is the sum of the cash flows, each discounted according to the given constant interest rate. The result is affected by the choice of the interest-rate compounding and the relative frequency and day counter.

static Rate irr const std::vector< boost::shared_ptr< CashFlow > > &  ,
Real  marketPrice,
const DayCounter dayCounter,
Compounding  compounding,
Frequency  frequency = NoFrequency,
Date  settlementDate = Date(),
Real  tolerance = 1.0e-10,
Size  maxIterations = 10000,
Rate  guess = 0.05
[static]
 

Internal rate of return.

The IRR is the interest rate at which the NPV of the cash flows equals the given market price. The function verifies the theoretical existance of an IRR and numerically establishes the IRR to the desired precision.

static Real convexity const std::vector< boost::shared_ptr< CashFlow > > &  ,
const InterestRate ,
Date  settlementDate = Date()
[static]
 

Cash-flow convexity.

The convexity is defined as

\[ C = \sum t^2 c_t P_t \]

where $ c_t $ is the amount of the cash flow and $ P_t $ is the discount at time $ t $ as implied by the given interest rate.

static Time duration const std::vector< boost::shared_ptr< CashFlow > > &  ,
Real  marketPrice,
const InterestRate ,
Duration::Type  type = Duration::Simple,
Date  settlementDate = Date()
[static]
 

Cash-flow duration.

The simple duration is defined as

\[ D_{\mathrm{simple}} = \frac{\sum t c_t P_t}{\sum c_t P_t} \]

where $ c_t $ is the amount of the cash flow and $ P_t $ is the discount at time $ t $ as implied by the given interest rate.

The modified duration is

\[ D_{\mathrm{modified}} = \frac{1}{y} D_{\mathrm{simple}} \]

where $ y $ is the IRR.

Finally, the Macaulay duration is

\[ D_{\mathrm{Macaulay}} = \frac{\sum t c_t P'_t}{\sum c_t P'_t} \]

where $ P'_t = e^{-yt} $ and $ y $ is the IRR.


QuantLib.org
QuantLib
Hosted by
SourceForge.net Logo
Documentation generated by
doxygen