Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cashflows.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2010 - 2016 Quaternion Risk Management Ltd.
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/cashflows/cashflows.hpp
20 \brief additional cash-flow analysis functions
21*/
22
23#ifndef quantext_cashflows_hpp
24#define quantext_cashflows_hpp
25
26#include <ql/cashflow.hpp>
27#include <ql/termstructures/yieldtermstructure.hpp>
28
29namespace QuantExt {
30using namespace QuantLib;
31
32//! %cashflow-analysis functions in addition to those in QuantLib
33class CashFlows {
34private:
37
38public:
39 //! \name YieldTermStructure functions
40 //@{
41 //! NPV due to any spreads on a leg.
42 /*! The spread NPV is the sum of the spread-related cash flows on the
43 leg, each discounted according to the given term structure.
44
45 - If there are no spreads on the leg, then zero is returned.
46 - Only applicable to FloatingRateCoupon. Should be expanded if
47 needed for other coupon types e.g. %YoYInflationCoupon.
48 */
49 static Real spreadNpv(const Leg& leg, const YieldTermStructure& discountCurve, bool includeSettlementDateFlows,
50 Date settlementDate = Date(), Date npvDate = Date());
51 //@}
52
53 //! Return the sum of the cashflows on \p leg after \p startDate and before or on \p endDate
54 static Real sumCashflows(const Leg& leg, const Date& startDate, const Date& endDate);
55
56 /*! Return only the coupon rates from a \p leg i.e. only Cashflow that casts to Coupon
57 Maintains the order of the coupon rates
58 */
59 static std::vector<Rate> couponRates(const Leg& leg);
60
61 /*! Return the coupon rates multiplied by day count fraction from a \p leg i.e. only Cashflow
62 that casts to Coupon. Maintains the order of the coupon rates
63 */
64 static std::vector<Rate> couponDcfRates(const Leg& leg);
65};
66
67} // namespace QuantExt
68
69#endif
cashflow-analysis functions in addition to those in QuantLib
Definition: cashflows.hpp:33
static Real spreadNpv(const Leg &leg, const YieldTermStructure &discountCurve, bool includeSettlementDateFlows, Date settlementDate=Date(), Date npvDate=Date())
NPV due to any spreads on a leg.
Definition: cashflows.cpp:27
static Real sumCashflows(const Leg &leg, const Date &startDate, const Date &endDate)
Return the sum of the cashflows on leg after startDate and before or on endDate.
Definition: cashflows.cpp:54
static std::vector< Rate > couponDcfRates(const Leg &leg)
Definition: cashflows.cpp:82
static std::vector< Rate > couponRates(const Leg &leg)
Definition: cashflows.cpp:70
CashFlows(const CashFlows &)