QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
gaussian1dfloatfloatswaptionengine.hpp
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
24#ifndef quantlib_pricers_gaussian1d_floatfloatswaption_hpp
25#define quantlib_pricers_gaussian1d_floatfloatswaption_hpp
26
27#include <ql/instruments/floatfloatswaption.hpp>
28#include <ql/models/shortrate/onefactormodels/gaussian1dmodel.hpp>
29#include <ql/rebatedexercise.hpp>
30
31#include <ql/pricingengines/genericmodelengine.hpp>
32
33namespace QuantLib {
34
36
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
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35