QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
gaussian1dfloatfloatswaptionengine.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2013, 2015 Peter Caspers
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib liense. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file gaussian1dfloatfloatswaptionengine.hpp
21 \brief float float swaption engine for one factor interest rate models
22*/
23
24#ifndef quantlib_pricers_gaussian1d_floatfloatswaption_hpp
25#define quantlib_pricers_gaussian1d_floatfloatswaption_hpp
26
30
32
33namespace QuantLib {
34
35 //! One factor model float float swaption engine
36 /*! \ingroup swaptionengines
37
38 All float coupons with fixing date greater or
39 equal the respective option expiry are considered
40 part of the exercise into right. Note that this
41 is different from the usual accrual start date
42 greater or equal exercise date if the fixing lag
43 is strictly greater than the exercise lag (which
44 should be a rare case). For the redepmtion flows
45 the criterion is that the associated start date
46 of the redemption flow (i.e. the start date of
47 the regular coupon period with same payment date
48 as the redemption flow) is greater or equal the
49 exercise date.
50
51 The addtional result underlyingValue is the npv
52 of the underlying (as seen from "today") including
53 all fixings greater (or greater equal depending
54 on includeTodaysExercise) today.
55 */
56
59 public GenericModelEngine<Gaussian1dModel,
60 FloatFloatSwaption::arguments,
61 FloatFloatSwaption::results> {
62 public:
67 };
68
70 const ext::shared_ptr<Gaussian1dModel> &model,
71 const int integrationPoints = 64, const Real stddevs = 7.0,
72 const bool extrapolatePayoff = true,
73 const bool flatPayoffExtrapolation = false,
74 const Handle<Quote> &oas =
75 Handle<Quote>(), // continously compounded w.r.t. yts daycounter
76 const Handle<YieldTermStructure> &discountCurve =
78 const bool includeTodaysExercise = false,
79 const Probabilities probabilities = None)
80 : BasketGeneratingEngine(model, oas, discountCurve),
83 integrationPoints_(integrationPoints), stddevs_(stddevs),
84 extrapolatePayoff_(extrapolatePayoff),
85 flatPayoffExtrapolation_(flatPayoffExtrapolation),
86 oas_(oas), discountCurve_(discountCurve),
87 includeTodaysExercise_(includeTodaysExercise),
88 probabilities_(probabilities) {
89
90 if (!discountCurve_.empty())
92
93 if (!oas_.empty())
95 }
96
98 const Handle<Gaussian1dModel> &model,
99 const int integrationPoints = 64, const Real stddevs = 7.0,
100 const bool extrapolatePayoff = true,
101 const bool flatPayoffExtrapolation = false,
102 const Handle<Quote> &oas =
103 Handle<Quote>(), // continously compounded w.r.t. yts daycounter
104 const Handle<YieldTermStructure> &discountCurve =
106 const bool includeTodaysExercise = false,
107 const Probabilities probabilities = None)
108 : BasketGeneratingEngine(model, oas, discountCurve),
111 integrationPoints_(integrationPoints), stddevs_(stddevs),
112 extrapolatePayoff_(extrapolatePayoff),
113 flatPayoffExtrapolation_(flatPayoffExtrapolation),
114 oas_(oas), discountCurve_(discountCurve),
115 includeTodaysExercise_(includeTodaysExercise),
116 probabilities_(probabilities) {
117
118 if (!discountCurve_.empty())
120
121 if (!oas_.empty())
123 }
124
125 void calculate() const override;
126
128 return discountCurve_.empty() ? model_->termStructure()
130 }
131
132 protected:
133 Real underlyingNpv(const Date& expiry, Real y) const override;
134 Swap::Type underlyingType() const override;
135 const Date underlyingLastDate() const override;
136 const Array initialGuess(const Date& expiry) const override;
137
138 private:
146
147 std::pair<Real, Real> npvs(const Date& expiry,
148 Real y,
149 bool includeExerciseOnxpiry,
150 bool considerProbabilities = false) const;
151
152 mutable ext::shared_ptr<RebatedExercise> rebatedExercise_;
153 };
154}
155
156#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Concrete date class.
Definition: date.hpp:125
floatfloat swaption class
One factor model float float swaption engine.
std::pair< Real, Real > npvs(const Date &expiry, Real y, bool includeExerciseOnxpiry, bool considerProbabilities=false) const
const Array initialGuess(const Date &expiry) const override
Gaussian1dFloatFloatSwaptionEngine(const Handle< Gaussian1dModel > &model, const int integrationPoints=64, const Real stddevs=7.0, const bool extrapolatePayoff=true, const bool flatPayoffExtrapolation=false, const Handle< Quote > &oas=Handle< Quote >(), const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const bool includeTodaysExercise=false, const Probabilities probabilities=None)
Gaussian1dFloatFloatSwaptionEngine(const ext::shared_ptr< Gaussian1dModel > &model, const int integrationPoints=64, const Real stddevs=7.0, const bool extrapolatePayoff=true, const bool flatPayoffExtrapolation=false, const Handle< Quote > &oas=Handle< Quote >(), const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const bool includeTodaysExercise=false, const Probabilities probabilities=None)
Real underlyingNpv(const Date &expiry, Real y) const override
Base class for some pricing engine on a particular model.
Shared handle to an observable.
Definition: handle.hpp:41
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
floatfloatswaption class
basic interface for one factor interest rate models
Generic option engine based on a model.
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
Option exercise with rebate payments.