Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cpicouponpricer.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 cpicouponpricer.cpp
20 \brief CPI CashFlow and Coupon pricers that handle caps/floors
21*/
22
23#include <ql/cashflows/cashflowvectors.hpp>
24#include <ql/time/daycounters/thirty360.hpp>
28
29namespace QuantExt {
30
31InflationCashFlowPricer::InflationCashFlowPricer(const Handle<CPIVolatilitySurface>& vol,
32 const Handle<YieldTermStructure>& yts)
33 : vol_(vol), yts_(yts) {
34 if (!vol_.empty())
35 registerWith(vol_);
36 if (yts_.empty()) {
37 yts_ = Handle<YieldTermStructure>(
38 QuantLib::ext::shared_ptr<YieldTermStructure>(new FlatForward(0, NullCalendar(), 0.05, Actual365Fixed())));
39 } else {
40 registerWith(yts_);
41 }
42}
43
44BlackCPICashFlowPricer::BlackCPICashFlowPricer(const Handle<CPIVolatilitySurface>& vol,
45 const Handle<YieldTermStructure>& yts, const bool useLastFixing)
46 : InflationCashFlowPricer(vol, yts) {
47 engine_ = QuantLib::ext::make_shared<CPIBlackCapFloorEngine>(yieldCurve(), volatility(), useLastFixing);
48}
49
50BachelierCPICashFlowPricer::BachelierCPICashFlowPricer(const Handle<CPIVolatilitySurface>& vol,
51 const Handle<YieldTermStructure>& yts, const bool useLastFixing)
52 : InflationCashFlowPricer(vol, yts) {
53 engine_ = QuantLib::ext::make_shared<CPIBachelierCapFloorEngine>(yieldCurve(), volatility(), useLastFixing);
54}
55
56
57CappedFlooredCPICouponPricer::CappedFlooredCPICouponPricer(const Handle<CPIVolatilitySurface>& vol,
58 const Handle<YieldTermStructure>& yts)
59 : CPICouponPricer(vol, yts) {
60 if (nominalTermStructure_.empty())
61 nominalTermStructure_ = Handle<YieldTermStructure>(
62 QuantLib::ext::shared_ptr<YieldTermStructure>(new FlatForward(0, NullCalendar(), 0.05, Actual365Fixed())));
63}
64
65BlackCPICouponPricer::BlackCPICouponPricer(const Handle<CPIVolatilitySurface>& vol,
66 const Handle<YieldTermStructure>& yts, const bool useLastFixing)
68 engine_ = QuantLib::ext::make_shared<CPIBlackCapFloorEngine>(yieldCurve(), volatility(), useLastFixing);
69}
70
71BachelierCPICouponPricer::BachelierCPICouponPricer(const Handle<CPIVolatilitySurface>& vol,
72 const Handle<YieldTermStructure>& yts, const bool useLastFixing)
74 engine_ = QuantLib::ext::make_shared<CPIBachelierCapFloorEngine>(yieldCurve(), volatility(), useLastFixing);
75}
76
77} // namespace QuantExt
QuantLib::ext::shared_ptr< SimpleQuote > vol_
Definition: cdsoption.cpp:80
BachelierCPICashFlowPricer(const Handle< QuantLib::CPIVolatilitySurface > &vol=Handle< QuantLib::CPIVolatilitySurface >(), const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >(), const bool useLastFixing=false)
BachelierCPICouponPricer(const Handle< QuantLib::CPIVolatilitySurface > &vol=Handle< QuantLib::CPIVolatilitySurface >(), const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >(), const bool useLastFixing=false)
BlackCPICashFlowPricer(const Handle< QuantLib::CPIVolatilitySurface > &vol=Handle< QuantLib::CPIVolatilitySurface >(), const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >(), const bool useLastFixing=false)
BlackCPICouponPricer(const Handle< QuantLib::CPIVolatilitySurface > &vol=Handle< QuantLib::CPIVolatilitySurface >(), const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >(), const bool useLastFixing=false)
CappedFlooredCPICouponPricer(const Handle< QuantLib::CPIVolatilitySurface > &vol=Handle< QuantLib::CPIVolatilitySurface >(), const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >())
Handle< YieldTermStructure > yieldCurve()
QuantLib::ext::shared_ptr< PricingEngine > engine_
Handle< QuantLib::CPIVolatilitySurface > volatility()
Base class for CPI CashFLow and Coupon pricers.
Handle< YieldTermStructure > yts_
Handle< YieldTermStructure > yieldCurve()
Handle< QuantLib::CPIVolatilitySurface > vol_
InflationCashFlowPricer(const Handle< QuantLib::CPIVolatilitySurface > &vol=Handle< QuantLib::CPIVolatilitySurface >(), const Handle< YieldTermStructure > &yts=Handle< YieldTermStructure >())
QuantLib::ext::shared_ptr< PricingEngine > engine_
Handle< QuantLib::CPIVolatilitySurface > volatility()
Inspectors.
CPI cap/floor engine using the Bachelier pricing formula and interpreting the volatility data as norm...
CPI cap/floor engine using the Black pricing formula and interpreting the volatility data as lognorma...
CPI cash flow and coupon pricers that handle caps/floors using a CpiCapFloorEngine.