QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
irregularswaption.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) 2001, 2002, 2003 Sadruddin Rejeb
5 Copyright (C) 2006 Cristina Duminuco
6 Copyright (C) 2006 Marco Bianchetti
7 Copyright (C) 2007 StatPro Italia srl
8 Copyright (C) 2010 Andre Miemiec
9
10 This file is part of QuantLib, a free-software/open-source library
11 for financial quantitative analysts and developers - http://quantlib.org/
12
13 QuantLib is free software: you can redistribute it and/or modify it
14 under the terms of the QuantLib license. You should have received a
15 copy of the license along with this program; if not, please email
16 <quantlib-dev@lists.sf.net>. The license is also available online at
17 <http://quantlib.org/license.shtml>.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the license for more details.
22*/
23
24/*! \file irregularswaption.hpp
25 \brief Irregular swaption class
26*/
27
28#ifndef quantlib_instruments_irregular_swaption_hpp
29#define quantlib_instruments_irregular_swaption_hpp
30
31#include <ql/option.hpp>
34
35namespace QuantLib {
36
37 //! %settlement information
39 enum Type { Physical, Cash };
40 };
41
42 std::ostream& operator<<(std::ostream& out,
44
45 //! Irregular %Swaption class
46 /*! \ingroup instruments */
47 class IrregularSwaption : public Option {
48 public:
49 class arguments;
50 class engine;
51 IrregularSwaption(ext::shared_ptr<IrregularSwap> swap,
52 const ext::shared_ptr<Exercise>& exercise,
54 //! \name Instrument interface
55 //@{
56 bool isExpired() const override;
57 void setupArguments(PricingEngine::arguments*) const override;
58 //@}
59 //! \name Inspectors
60 //@{
62 Swap::Type type() const { return swap_->type(); }
63 const ext::shared_ptr<IrregularSwap>& underlyingSwap() const {
64 return swap_;
65 }
66 //@}
67 //! implied volatility
69 Real price,
70 const Handle<YieldTermStructure>& discountCurve,
71 Volatility guess,
72 Real accuracy = 1.0e-4,
73 Natural maxEvaluations = 100,
74 Volatility minVol = 1.0e-7,
75 Volatility maxVol = 4.0) const;
76 private:
77 // arguments
78 ext::shared_ptr<IrregularSwap> swap_;
80 };
81
82 //! %Arguments for irregular-swaption calculation
84 public Option::arguments {
85 public:
86 arguments() = default;
87 ext::shared_ptr<IrregularSwap> swap;
89 void validate() const override;
90 };
91
92 //! base class for irregular-swaption engines
94 : public GenericEngine<IrregularSwaption::arguments, IrregularSwaption::results> {};
95
96}
97
98#endif
template base class for option pricing engines
Shared handle to an observable.
Definition: handle.hpp:41
Arguments for irregular-swap calculation
Arguments for irregular-swaption calculation
ext::shared_ptr< IrregularSwap > swap
IrregularSettlement::Type settlementType
base class for irregular-swaption engines
Irregular Swaption class.
void setupArguments(PricingEngine::arguments *) const override
bool isExpired() const override
returns whether the instrument might have value greater than zero.
IrregularSettlement::Type settlementType_
ext::shared_ptr< IrregularSwap > swap_
const ext::shared_ptr< IrregularSwap > & underlyingSwap() const
IrregularSettlement::Type settlementType() const
Volatility impliedVolatility(Real price, const Handle< YieldTermStructure > &discountCurve, Volatility guess, Real accuracy=1.0e-4, Natural maxEvaluations=100, Volatility minVol=1.0e-7, Volatility maxVol=4.0) const
implied volatility
basic option arguments
Definition: option.hpp:57
base option class
Definition: option.hpp:36
ext::shared_ptr< Exercise > exercise() const
Definition: option.hpp:46
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Volatility
volatility
Definition: types.hpp:78
Irregular fixed-rate vs Libor swap.
Definition: any.hpp:35
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
void swap(Array &v, Array &w) noexcept
Definition: array.hpp:903
Base option class.
Interest-rate term structure.