Cashflows Class Reference
#include <ql/CashFlows/analysis.hpp>
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 Real | bps (const std::vector< boost::shared_ptr< CashFlow > > &, const Handle< YieldTermStructure > &) |
Basis-point sensitivity of the cash flows. | |
static Real | bps (const std::vector< boost::shared_ptr< CashFlow > > &, const InterestRate &, Date settlementDate=Date()) |
Basis-point sensitivity 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 Time | duration (const std::vector< boost::shared_ptr< CashFlow > > &, const InterestRate &y, Duration::Type type=Duration::Modified, Date settlementDate=Date()) |
Cash-flow duration. | |
static Real | convexity (const std::vector< boost::shared_ptr< CashFlow > > &, const InterestRate &y, Date settlementDate=Date()) |
Cash-flow convexity. |
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 Real bps | ( | const std::vector< boost::shared_ptr< CashFlow > > & | , | |
const Handle< YieldTermStructure > & | ||||
) | [static] |
Basis-point sensitivity of the cash flows.
The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given term structure.
static Real bps | ( | const std::vector< boost::shared_ptr< CashFlow > > & | , | |
const InterestRate & | , | |||
Date | settlementDate = Date() | |||
) | [static] |
Basis-point sensitivity of the cash flows.
The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is 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 Time duration | ( | const std::vector< boost::shared_ptr< CashFlow > > & | , | |
const InterestRate & | y, | |||
Duration::Type | type = Duration::Modified , |
|||
Date | settlementDate = Date() | |||
) | [static] |
Cash-flow duration.
The simple duration of a string of cash flows is defined as
where is the amount of the
-th cash flow,
is its payment time, and
is the corresponding discount according to the passed yield.
The modified duration is defined as
where is the present value of the cash flows according to the given IRR
.
The Macaulay duration is defined for a compounded IRR as
where is the IRR and
is the number of cash flows per year.
static Real convexity | ( | const std::vector< boost::shared_ptr< CashFlow > > & | , | |
const InterestRate & | y, | |||
Date | settlementDate = Date() | |||
) | [static] |
Cash-flow convexity.
The convexity of a string of cash flows is defined as
where is the present value of the cash flows according to the given IRR
.