QuantLib-docs-0 3 6
QuantLib-docs-0 3 6
QuantLib-docs-0 3 6
15 Apr 2004
Contents
I User Manual 1
1 An introduction to QuantLib 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Project overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Where to get QuantLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.6 Version history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.7 Additional resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.8 The QuantLib Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.9 QuantLib License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2 QuantLib components 33
2.1 Core classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2 Date and time calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.3 Lattice methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.4 The finite differences framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.5 The Monte Carlo framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.6 The short-rate modelling framework . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.7 Currencies and FX rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.8 Instruments and pricers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.9 Math tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.10 Design patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.11 Term structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.12 Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3 Examples 59
ii CONTENTS
II Reference Manual 61
User Manual
Chapter 1
An introduction to QuantLib
1.1 Introduction
QuantLib (http://quantlib.org/) is a C++ library for financial quantitative analysts and devel-
opers.
QuantLib is Non-Copylefted Free Software released under the modified BSD License. It is also
OSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source
Initiative.
QuantLib is free software and you are allowed to use, copy, modify, merge, publish, distribute,
and/or sell copies of it under the conditions stated in the QuantLib QuantLib License(p. 32).
QuantLib and its documentation are distributed in the hope that they will be useful, but WITH-
OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the QuantLib License(p. 32) for more details.
1.1.1 Disclaimer
At this time, this documentation is widely incomplete and must be regarded as a work in progress.
Contributions are welcome.
4 An introduction to QuantLib
• Date class.
• Day count conventions: Actual360, Actual365, ActualActual (Bond, ISDA, AFB), 30/360
(US, European, Italian).
To do:
Math
• Primitive, first and second derivative functions of cubic and linear interpolators.
• Cubic spline end conditions: first derivative value, second derivative value, not-a-knot.
• Beta functions.
To do:
1-dimensional solvers
To do:
• Clean up the interface so that it is clear whether the accuracy is specified for x or f(x).
Optimization
• Conjugate gradient, simplex, steepest descent, line search, Armijo line search, least squares.
• Constrained (positive, boundary, etc.) and unconstrained optimization
Random-number generation
To do:
Patterns
Finite differences
To do:
• Richardson extrapolation
• Introduce variable theta schemes.
• Introduce multi time-level schemes.
• Enable different solvers (SOR, etc.)
• Extend to time-dependant parameters.
• Extend to local volatility.
• Two-dimension schemes.
• Improve boundary conditions.
• Adapt to the new pricing engine framework.
• Use DiscretisedAsset instead of array?
• Use TimeGrid
• Use assetGrid
• Check (and improve) vega, rho, dividendRho greeks, solving their own equations
Lattices
• Discretized asset.
• Richardson extrapolation
To do:
• Merge finite differences with the lattice framework. Use same rollback scheme.
• Trinomial trees
Monte Carlo
To do:
• Greeks calculation.
• Predictor-corrector scheme.
Pricing engines
• Engines for options described by "vanilla" set of parameters: analytic digital American,
analytic European, Barone-Adesi and Whaley approximation for American, binomial (Cox-
Ross-Rubinstein, Jarrow-Rudd, additive equiprobabilities, Trigeorgis, Tian, Leisen-Reimer),
Bjerksund and Stensland approximation for American, integral European, Merton 76 jump-
diffusion, Monte Carlo digital, Monte Carlo European.
• Engines for options described by "barrier" set of parameters: analytic down/up in/out,
Monte Carlo down/up in/out
• Engines for options described by "discrete Asian" set of parameters: analytic discrete geo-
metric average price
• Basket engine: analytic Stulz engine for max/min on two assets, Monte Carlo engine (in
progress).
• Cap/floor pricing engines: analytic Black model, analytic affine models, tree based engine.
• Swaption pricing engines: analytic Black model, analytic affine models (Jamshidian), tree
based engine.
To do:
• Ensure all path dependant options allow for evaluation with collected past observations.
Pricers
• Cliquet option
• Bermudan option.
To do:
Financial Instruments
• Swaption.
• Cap/floor.
• Stock.
• Asian option.
• Barrier option.
• Cliquet option.
• Vanilla option.
• Basket option.
To do:
• Bond.
To do:
• Do not require today’s date, only the settlement date (when discount==1.0) is necessary
Volatility
• Interface for equity Black volatility term structures based on volatility or variance underlying
description: constant, time-dependant curve, time-strike surface, forward date implied term
structure.
• Interface for equity local volatility term structures: constant, time-dependant curve, time-
asset level surface (Gatheral’s formula).
To do:
Credit derivatives
To do:
Test suite
More than 100 automated tests covering:
• American options.
• Asian options.
• Barrier options.
• Calendars.
• Covariance matrices.
• Dates.
• Day counters.
• Distributions.
• Integration algorithms.
To do:
Miscellanea
• Index classes for handling of fixed-income libor indexes (fixings, forecasting, etc.): AUD,
CAD, CHF, EUR, GBP, JPY, USD, ZAR, generic.
• Cash-flow class.
• Currency enumeration.
• Output data formatters: long integers, Ordinal numerals, power of two, exponential, fixed
digit, sequences, dates, etc.
• Input data parsers.
• Error classes and error handling.
• Exercise classes: European, Bermudan, American
• Payoff classes: plain, gap, asset-or-nothing, cash-or-nothing
• Grid classes for handling of equally and unequally spaced grids.
To do:
Documentation
• Documentation automatically generated with Doxygen (html, PDF, ps, WinHelp, man
pages)
To do:
• Enable forums?
• Create a FAQ
Distribution
• RPMs available.
To do:
• Fink package
Source code, documentation, modules, etc. of current and previous QuantLib releases can be
downloaded from http://quantlib.org/download.html
1.4 Installation
1. ‘cd’ to the QuantLib directory and type ‘./configure’ to configure the package for your
system. Before doing this, you might want to type ‘./configure –help’ to obtain information
on additional features you can enable.
2. Type ‘make’ to compile the package.
3. Type ‘make install’ to install the library. This might require administrative privileges.
The file INSTALL.txt in the QuantLib source distribution contains more detailed instructions.
1.4.2 Win32
1.5 Usage
To use QuantLib classes in your own code just add
#include <ql/quantlib.hpp>
at the beginning of your source/header files. Depending on the number of your files in your
project, this could cause a large increase in compilation time. If this were not acceptable, collective
headers are also available for smaller parts of the library; in particular, each subdirectory of the ql
directory contains a file all.hpp which makes available all classes and function in the respective
subdirectory.
Under the Examples folder you can find examples of QuantLib usage, including makefiles for gcc,
the Borland free compiler, and Microsoft Visual C++. For the latter project files are also available.
A few suggestions for Visual C++ users wanting to use QuantLib into their own application:
1. you won’t have to explicitly link your application to the QuantLib library. This is done
automatically by compiler directives embedded in the sources.
2. Your project must be compiled with the same options that were used in compiling the Quant-
Lib library, in particular with regard to the settings under project settings, "C/C++" tab,
"Code Generation". You’ll have to check the "Use RTTI" option under the "C++ Language"
category, too. Finally, you have to define the NOMINMAX macro.
• When available, QuantLib 0.3.5 now uses parts of the Boost library. The presence of Boost is
detected automatically under Unix/Linux systems; on Windows systems, it must be enabled
by uncommenting the relevant line in ql/userconfig.hpp.
• In the next QuantLib release, the presence of the Boost library will be mandatory.
• Modified MultiPath interface to remove drifts. They are now in the stochastic processes.
• Preliminary implementation of Longstaff-Schwartz least-squares
• Monte Carlo pricer for European basket options
• Brownian-bridge bugs fixed
• StochasticProcess base class and derived classes (diffusion, jump-diffusion, etc.) have been
created.
VOLATILITY FRAMEWORK
OPTIMIZATION FRAMEWORK
PATTERNS
• Composite pattern
MATH
• Improved cubic spline interpolation. It now handles end conditions such as first derivative
value, second derivative value, not-a-knot. Hyman filter for monotonically constrained
interpolation has been implemented. Primitive calculation has been enabled in addition to
derivative and second derivative.
• Primitive, first derivative, and second derivative functions are available for linear interpo-
lator.
• Singular value decomposition improved.
• Added bivariate cumulative normal distribution.
• Added binomial coefficient calculation, binomial distribution, cumulative binomial distri-
bution, and Peizer-Pratt inversion (method 2.)
• Added beta functions.
• Added Poisson distribution and cumulative distribution.
• Added incomplete gamma functions.
• Added factorial calculation.
• Added rank-reduced square root and improved pseudo-square root of square symmetric
matrices.
• Added Cholesky decomposition.
TEST SUITE
MISCELLANEA
• More Payoff classes have been introduced: gap, asset-or-nothing, cash-or-nothing. Payoff
is now extensively used.
• Exercise class is now polymorphic. More derived classes have been introduced, and they
are now extensively used.
• Path pricer for Binary options. It should cover both European and American style options.
Also known as: Digital, Binary, Cash-At-Hit, Cash-At-Expiry.
• More options moved to the new pricing engine framework: binary, barrier
FIXED INCOME
VOLATILITY FRAMEWORK
OPTIMIZATION FRAMEWORK
PATTERNS
MATH
TEST SUITE
MISCELLANEA
• Old class Grid no longer exists, use CenteredGrid to obtain the same result.
LATTICE FRAMEWORK
• Partially implemented.
• Quanto forward compounded engines.
• Integral (european) pricing engine.
FIXED INCOME
OPTIMIZATION FRAMEWORK
PATTERNS
MATH
RISK MEASURES
MISCELLANEA
• Dataformatters extended to format long integers, Ordinal numerals, power of two format-
ting.
• Added payoff file for Payoff classes. Added Cash-Or-Nothing and Asset-Or-Nothing payoff
classes.
VOLATILITY FRAMEWORK
• interface revisited
FIXED INCOME
• Modified coupons so that the payment date can be after the end of the accrual period
MISCELLANEA
• added Period(std::string&)
• the allowExtrapolation boolean in interpolation classes has been removed from constructors
and added to the operator()
• bug fixes
BUILD PROCESS
LATTICE FRAMEWORK
VOLATILITY FRAMEWORK
FIXED INCOME
OPTIMIZATION FRAMEWORK
PATTERNS
MISCELLANEA
• added functions folder and namespace for QuantLibXL and any other function-like interface
to QuantLib
• kustosis() and skewness() now handles the case of stddev == 0 and/or variance == 0
• MonteCarloModel now handles both single factor and multi factors simulations.
• McPricer now handles both single factor and multi factors pricing. New pricing interface
• antithetic variance-reduction technique made possible in Monte Carlo for both single factor
and multi factors
• Control Variate specific class removed: control variation technique is now handled by the
general MC model
PATTERNS
VARIOUS
INSTALLATION FACILITIES
DOCUMENTATION
• general re-hauling
• improved and extended Monte Carlo documentation
• improved and extended examples
• Upgraded to Doxygen 1.2.11.1
• Added man pages for installed executables
• added docs in Windows Help format
• added info on "Win32 OnTheEdgeRelease" and "Win32 OnTheEdgeDebug" MS VC++ con-
figurations
• additional information on how to create a MS VC++ project based on QuantLib
• Library:
– source code moved under ql, better GNU standards
– gcc build dir can now be separated from source tree
• Library:
– Style guidelines introduced (see http://quantlib.org/style.html) and partially en-
forced
– full support for Microsoft Visual Studio
– full support for Linux/gcc
– momentarily broken support for Metrowerks CodeWarrior
– autoconfiscation (with specialized config.∗.hpp files for platforms without au-
tomake/autoconf support)
– Include files moved under Include/ql folder and referenced as "ql/header.hpp"
– Implemented expression templates techniques for array algebra optimization
– Added custom iterators
– Improved term structure
– Added Asian, Bermudan, Shout, Cliquet, Himalaya, and Barrier options (all with
greeks calculation, control variated where possible)
– Added Helsinki and Wellington calendars
– Improved Normal distribution related functions: cumulative, inverse cumulative, etc.
– Added uniform and Gaussian random number generators
– Added Statistics class (mean, variance, skewness, downside variance, etc.)
1.8.1 Authors
1.8.2 Contributors
We gratefully acknowledge contributions from Mario Aleppo, Toyin Akin, James Battle, Christo-
pher Baus, Thomas Becker, Adolfo Benin, David Binderman, Jon Davidson, Matteo Gallivanoni,
Roman Gitlin, Tomoya Kawanishi, Gilbert Peffer, Peter Schmitteckert, Enrico Sirola, Maxim
Sokolov, David Schwartz, and Bernd Johannes Wuebben.
• Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
• Redistributions in binary form must reproduce the above copyright notice, this list of con-
ditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
• Neither the names of the copyright holders nor the names of the QuantLib Group and
its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
QuantLib is Non-Copylefted Free Software [1] released under the modified BSD License [2] (also
know as XFree86-style license).
QuantLib is Open Source [3] because of its license: it is OSI Certified Open Source Software [4].
OSI Certified is a certification mark of the Open Source Initiative [5].
The modified BSD License is GPL compatible as confirmed by the Free Software Foundation [6].
This license has been adopted to allow free use of QuantLib and its source, to make QuantLib
flourish as a free-software/open-source project. It allows proprietary extensions to be commer-
cialized.
[1] http://www.gnu.org/philosophy/categories.html#Non-CopyleftedFreeSoftware
[2] http://www.opensource.org/licenses/bsd-license.html
[3] http://www.opensource.org/docs/definition.html
[4] http://www.opensource.org/docs/certification_mark.html
[5] http://www.opensource.org
[6] http://www.gnu.org/philosophy/bsd.html
QuantLib components
2.2.1 Dates
The concrete class QuantLib::Date(p. 237) implements the concept of date. Its functionalities
include:
• providing basic information such as weekday, day of the month, day of the year, month,
and year;
• comparing two dates to determine whether they are equal, or which one is the earlier or
later, or the difference between them expressed in days;
2.2.2 Calendars
The abstract class QuantLib::Calendar(p. 184) provides the interface for determining whether a
date is a business day or a holiday for a given market, or incrementing/decrementing a date of a
given number of business days. A number of calendars is contained in the ql/Calendars directory.
The abstract class QuantLib::DayCounter(p. 240) provides more advanced means of measuring
the distance between two dates according to a given market convention, both as number of days
of fraction of year. A number of such conventions is contained in the ql/DayCounters directory,
namely,
• Actual/360
• Actual/365
• Actual/Actual, which can be calculated according to:
– ISMA and US Treasury convention, also known as "Actual/Actual (Bond)";
– ISDA, also known as "Actual/Actual (Historical)";
– AFB, also known as "Actual/Actual (Euro)";
• 30/360, which can be calculated according to:
– USA convention;
– European convention;
– Italian convention.
The binomial method is the simplest numerical method that can be used to price path-independent
derivatives. It is usually the preferred lattice method under the Black-Scholes-Merton model. As
an example, let’s see the framework implemented in the bsmlattice.hpp(p. 749) file. It is a method
based on a binomial tree, with constant short-rate (discounting). There are several approaches to
build the underlying binomial tree, like Jarrow-Rudd or Cox-Ross-Rubinstein.
When the underlying stochastic process has a mean-reverting pattern, it is usually better to use a
trinomial tree instead of a binomial tree. An example is implemented in the QuantLib::Trinomial-
Tree(p. 615) class, which is constructed using a diffusion process and a time-grid. The goal is
to build a recombining trinomial tree that will discretize, at a finite set of times, the possible
evolutions of a random variable y satisfying
At each node, there is a probability pu , pm andpd to go through respectively the upper, the middle
and the lower branch. These probabilities must satisfy
and
pu y2i+1,k+1 + pm y2i+1,k + pd y2i+1,k−1 = Vi,2 j + E2i, j ,
where k (the index of the node at the end of themiddle branch) is the index of the node which is the
nearest to the expected future value, Ei, j = E y(ti+1 )|y(ti ) = yi, j and Vi,2 j = Var{y(ti+1 )|y(ti ) = yi, j }.
√
If we suppose that the variance is only dependant on time Vi,j = Vi and set yi+1 to Vi 3, we find
that
2
1 (Ei, j − yi+1,k ) Ei, j − yi+1,k
pu = + 2
+ √ ,
6 6Vi 2 3Vi
2
2 (Ei, j − yi+1,k )
pm = − ,
3 3Vi2
2
1 (Ei, j − yi+1,k ) Ei, j − yi+1,k
pd = + 2
− √ .
6 6Vi 2 3Vi
To come...
This class is a representation of the price of a derivative at a specific time. It is roughly an array
of values, each value being associated to a state of the underlying stochastic variables. For the
moment, it is only used when working with trees, but it should be quite easy to make a use
of it in finite-differences methods. The two main points, when deriving classes from Quant-
Lib::DiscretizedAsset(p. 260), are:
1. Define the initialisation procedure (e.g. terminal payoff for european stock options).
2. Define the method adjusting values, when necessary, at each time steps (e.g. apply the
step condition for american or bermudan options). Some examples are found in Quant-
Lib::DiscretizedSwap and QuantLib::DiscretizedSwaption.
∂f
= Lf
∂t
where L is a differential operator in “space”, i.e., one which does not contain partial derivatives
in t but can otherwise contain any derivative in any other variable of the problem.
Writing the equation in the above form allows us to implement separately the discretization of
the differential operator L and the time scheme used for the evolution of the solution. The Quant-
Lib::FiniteDifferenceModel(p. 302) class acts as a glue for such two steps—which are outlined
in the following sections—and provides the interface of the resulting finite difference model for
the end user. Furthermore, it provides the possibility of checking and operating on the solution
array at each step—which is typically used to apply an exercise condition for an option. This is
also outlined in a section below.
The discretization of the differential operator L depends on the discretization chosen for the
solution f of the given equation.
Such choice is obvious in the 1-D case where the domain [a, b] of the equation is discretized as
a series of points xi , i = 0 . . . N − 1 (note that the index is zero based) where xi = a + hi and
h = (b − a)/(N − 1). In turn, the solution f of the equation is discretized as an array ui , i = 0 . . . N − 1
whose elements are defined as ui = f (xi ). The discretization of the differential operator follows
by substituting the derivatives with the corresponding incremental ratios defined in terms of the
fi . A number of basic operators are defined in the framework which can be composed to form
more complex operators, namely:
the first derivative ∂/∂x is discretized as the operator D+ , defined as
ui+1 − ui
D+ ui =
h
and implemented in class QuantLib::DPlus(p. 267); the operator D− , defined as
ui − ui−1
D− ui =
h
and implemented in class QuantLib::DMinus(p. 265); and the operator D0 , defined as
ui+1 − ui−1
D0 ui =
2h
and implemented in class QuantLib::DZero(p. 271). The discretization error of the above opera-
tors is O(h) for D+ and D− and O(h2 ) for D0 ;
the second derivative ∂2 /∂x2 is discretized as the operator D+ D− , defined as
Once the differential operator L has been discretized, a number of choices are available for
discretizing the time derivative at the left-hand side of the equation.
In this framework, such choice is encapsulated in so-called evolvers which, given L and the
solution u(k) at time tk , yield the solution u(k−1) at the previous time step.
A number of evolvers are currently provided in the library which implement well-known schemes,
namely,
the forward Euler explicit scheme in which the equation is discretized as
u(k) − u(k−1)
= Lu(k)
∆t
hence
u(k−1) = (I − ∆tL) u(k)
from which u(k−1) can be obtained directly;
the backward Euler implicit scheme in which the equation is discretized as
u(k) − u(k−1)
= Lu(k−1)
∆t
hence
(I + ∆tL) u(k−1) = u(k)
from which u(k−1) can be obtained by solving a linear system;
the Crank-Nicolson scheme in which the equation is discretized as
A programmer could implement its own evolver, which does not need to inherit from any base
class.
However, it must implement the following interface:
class Evolver {
public:
typedef ... arrayType;
typedef ... operatorType;
// constructors
Evolver(const operatorType& D);
// member functions
void step(arrayType& a, Time t) const;
void setStep(Time dt);
};
Finally, we note again that the pricing of an option requires the finite difference model to solve
the corresponding equation backwards in time. Therefore, given a discretization u of the solution
at a given time t, the call
evolver.step(u,t)
A finite difference model can be passed a step condition to be applied at each step during the
rollback of the solution (e.g. the early exercise American condition). Such condition must be
embodied in a class derived from QuantLib::StepCondition(p. 570) and must implement the
interface of the latter, namely,
∂f σ2 ∂2 f ∂f
=− −ν + r f.
∂t 2 ∂x 2 ∂x
It can be seen that the operator LBS is
σ2 ∂2 ∂
LBS = − − ν + rI
2 ∂x2 ∂x
and can be built from the basic operators provided in the library as
σ2
LBS = − D+ D− − νD0 + rI.
2
Its implementation closely reflects the above decomposition and can be written as
taking as inputs the relevant parameters of the equation (σ, ν and r) as well as model parameters
such as the number N of grid points and their spacing h.
As simple example cases, we will use the above operator to price both an European and an
American option. The parameters of the two options will be the same, namely, they will be both
call options with underlying price u = 100, strike s = 95, residual time T = 1 year, dividend yield
q = 3% and volatility σ = 10%. The risk-free rate will be r = 5%. Such parameters are expressed
using QuantLib types as
The grid upon which the model will act will be a logarithmic grid of underlying prices, i.e., f will
be defined in a range [ln umin , ln umax ] discretized as an array xi , i = 0 . . . N − 1 with xi = ln umin + ih
and h = (ln umax − ln umin )/(N − 1). Such a grid and the corresponding vector of actual prices can
√ in the code below. The domain of the model will be defined as [ln u − ∆, ln u + ∆]
be built as shown
where ∆ = 4σ T. A number of grid points N = 101 will be used.
The initial condition is determined by the values of the option at maturity, i.e., either the difference
between underlying price and strike if such difference is positive, or 0 if that is not the case (the
above will have to be suitably modified for a put option or a straddle.) Such “initial” condition
will be rolled back in time by our model.
Array exercisingValue(gridPoints);
for (unsigned int i=0; i<gridPoints; i++)
exercisingValue[i] = QL_MAX(prices[i]-strike,0.0);
Now the differential operator can be initialized. Also, Neumann initial conditions are set which
correspond to the initial value of the derivatives at the boundaries (see the BoundaryCondition
class documentation for details).
We are now already set for the pricing of the European option. Also, the exercise condition is the
only thing still to be defined for the American option to be priced. Such condition is equivalent
to the statement that at each time step, the value of the option is the maximum between the profit
realized in exercising the option (which we already calculated and stored in exercisingValue)
and the value of the option should we keep it (which corresponds to the solution rolled back to
the current time step). This logic can be implemented as:
Everything is now ready. The model can be created gluing the piece together by means of the
QuantLib::FiniteDifferenceModel(p. 302) class. The current value of the option is calculated by
rolling back the solution to the current time, i.e., t = 0, and by taking the value corresponding at
the current underlying price—which by construction corresponds to the central value provided
that the number of grid points is odd.
// European option
Array f = exercisingValue; // initial condition
model.rollback(f, residualTime, 0.0, timeSteps);
double europeanValue = valueAtCenter(f);
// American option
f = exercisingValue; // reset
Handle<StepCondition<Array> > condition(
new ExerciseCondition(exercisingValue));
model.rollback(f, residualTime, 0.0, timeSteps, condition);
double americanValue = valueAtCenter(f);
where p(x) is a normalized probability function. Monte Carlo methods solve the above integral
by approximating it with the discrete sum
N
1 X
f (xi )w(xi )
N
i=1
where the xi are drawn from p(x), possibly with a weight w(xi ) — which otherwise can be
considered uniformly equal to 1.
The above sum has a straightforward interpretation in the case of a derivative product, namely,
the xi are N generated random paths which the value of the underlying can possibly follow, while
the f (xi ) are the values of the derivative on each of such paths. The sum above can therefore be
taken as an estimate of the price of the derivative, namely, the average of its value on all possible
paths — or rather all considered paths. Such a method enables the user to construct pricing
classes for an unlimited range of derivatives, most notably path-dependent ones which cannot
be priced by means of finite difference methods.
It must also be mentioned that for all such methods, the error e on the estimated value is propor-
tional to the square root of the number of samples N. A number of so-called variance-reduction
methods have been found which allows one to reduce the coefficient of proportionality between
√
e and 1/ N.
Separate implementations are provided in the library for the three components of the above
average, namely, the random drawing of the xi , the evaluation of the f (xi ), and the averaging
process itself. The QuantLib::MonteCarloModel(p. 448) class acts as a glue for such three steps
— which are outlined in the following sections — and provides the interface of the resulting
Monte Carlo model to the end user.
√ √
with average ν∆Ti and standard deviation σ ∆Ti — or possibly νi ∆Ti and σi ∆Ti should ν and
σ vary in time.
The QuantLib::Path(p. 501) class stores the variation vector decomposed in its drift (determined)
and diffusion (random) components. As shown below, this allows the implementation of anti-
thetic variance reduction techniques.
The QuantLib::MultiPath(p. 455) class is a straightforward extension which acts as a vector of
Path objects.
Classes are provided which generate paths and multi-paths with the desired drift and
diffusion components, namely, QuantLib::PathGenerator(p. 502) and QuantLib::MultiPath-
Generator(p. 456).
For the time being, the path generator is initialized with a constant drift and variance. This
requirement will most likely be relaxed in the next release. The multi-path generator is initialized
with an array of constant drifts—one for each single asset—and a covariance matrix which
encapsulates the relations between the diffusion components of the single assets.
The time discretization of the (multi)paths can be specified either as a given number of equal time
steps over a given time span, or as a vector of explicitly specified times at which the path will be
sampled.
The QuantLib::PathPricer(p. 504) class is the base class from which path pricers must inherit. The
only method which subclasses are required to implement is
where P can be Path or MultiPath depending on the derivative whose value must be calculated.
Similarly, the term path will be used in the following discussion as meaning either path or multi-
path depending on the context. The term single path is not to be taken as opposite to multi-path,
but rather as meaning “a single instance of a (multi)path" as opposed to the set of all generated
(multi)paths.
The above method encapsulates the pricing of the derivative on a single path and must return
its value had the evolution of the underlying(s) followed the path passed as argument. For this
reason, control variate techniques (see below) must not be implemented at this level since they
would cause the returned value to differ from the actual price of the derivative on the path.
Instead, antithetic variance-reduction techniques can be effectively implemented at this level and
indeed are used in the pricers currently included in the library.
In short, such techniques consist in pricing an option on both the given path and its antithetic,
the latter being a path with the same drift and the opposite diffusion component. The value of
the sample is defined as the average of the prices on the two paths.
A generic implementation of antithetic techniques could consist of a path pricer class which takes
a concrete path pricer upon construction and whose operator() simply proxies two calls to the
contained pricer, passing the given path and its antithetic, and averages the result. However, this
would not take full advantage of the technique.
In fact, it must be noted that using antithetic paths not only reduces the variance per se but also
allows to factor out calculations commons to a path and its antithetic, thus reducing greatly the
computation time. Therefore, such techniques are best implemented inside the path pricer itself,
whose algorithm can fully exploit such factorization.
A number of path pricers are available in the library and listed in reference manual.
The Monte Carlo model also provides the user with the possibility to take advantage of control-
variate techniques.
Such techniques consist in pricing a portfolio from which the price of the derivative can be
deduced, but with a lower variance than the derivative alone.
In our current implementation, static-hedge control variate is used, namely, the formed portfolio
is long of the derivative we need to price and short of a similar derivative whose price can be
calculated analytically. The value of the portfolio on a given path will of course be given by
the difference of the values of the two derivatives on such path. However, due to the similarity
between the derivatives, the portfolio price will have a lower variance than either derivative alone
since any variation in the price of the latter will be partly compensated by a similar variation in
the price of the other. Lastly, given the portfolio price, the price of the derivative we are interested
in can be deduced by adding the analytic value of the other.
In order to use such technique, the user must provide the model with a path pricer for the
additional option and the value of the latter. The action of the Monte Carlo model is in this case
expressed as:
Martingale (a.k.a. dynamic-hedge) control variate techniques are planned for future releases.
A QuantLib::McPricer(p. 438) class is also available which wraps the typical usage of a Monte
Carlo model.
Details on the Monte Carlo Pricer interface will be available in the Pricers(p. 49) section.
As a simple example, we will use the outlined tools to price an European option by means of
Monte Carlo techniques.
Given a current underlying price u0 and a path p = [p1 , . . . , pN ] where every variation pi is the
sum of a drift term di and a random diffusion term ri , the price of the underlying at maturity is
N
N N N
Y X X X
u = u0 epi = u0 exp pi = u0 exp di + ri
1 1 1 1
while the price on the antithetic path — i.e., same drift and opposite diffusion — is
N N
X X
u0 exp di − ri .
1 1
size_t n = path.size();
// calculate payoff
double payoff;
switch (type_) {
case Option::Call;
payoff = QL_MAX(price-strike,0.0);
break;
// other cases are left as an exercise to the reader
...
}
The path pricer can now be used in a model. Let us assume the following parameters:
Handle<GaussianPathGenerator> pathGenerator(
new GaussianPathGenerator(nu,vol2,residualTime,timeSteps));
// discount at maturity
DiscountFactor discount = QL_EXP(-riskFreeRate*residualTime);
bool antithetic = true;
model.addSamples(samples);
// now get the results: the option price is given by value with
// a confidence level given by error
value = model.sampleAccumulator().mean();
error = model.sampleAccumulator().errorEstimate();
More examples of path pricers can be found in the ql/MonteCarlo directory, while examples of
more sophisticated pricers which uses them in Monte Carlo models can be found in the ql/Pricers
directory.
2.5.5 Notes
(1)(p. 42) A more rigorous approach would lead us to integrate the above equation by means of
Green functions or Laplace transforms. Both such methods would show that the price at time
t = 0 of an option with payoff G(S(T)) where S(T) is the underlying price at expiry is given by the
integral Z ∞
(ξ − νT)2
!
1
e−rT G(S0 eξ ) √ exp − dξ
−∞ 2πσ2 T 2σ2 T
where S0 is the price of the underlying at t = 0. It can be seen that the above integral is of the
form shown at the beginning of this section, namely, the pricing function is
and can be interpreted as the option payoff discounted to the present time, while the probability
distribution is
(x − νT)2
!
1
p(x) = √ exp − .
2πσ2 T 2σ2 T
which again shows that the logarithms of the underlying prices at time T are distributed as a
√
Gaussian with average νT and standard deviation σ T.
where r = f (t, x). If the model is affine (i.e. derived from the QuantLib::AffineModel(p. 112)
class), analytical formulas for discount bonds and discount bond options are given (useful for
calibration).
When α and σ are constants, this model has analytical formulas for discount bonds and
discount bond options.
√
drt = (θ(t) − krt )dt + σ rt dWt
There are analytical formulas for discount bonds (and soon for discount bond options).
2.6.2 Calibration
The class CalibrationHelper is a base class that facilitates the instanciation of market instruments
used for calibration. It has a method marketValue() that gives the market price using a Black
formula, and a modelValue() method that gives the price according to a model
Derived classed are QuantLib::CapHelper and QuantLib::SwaptionHelper.
For the calibration itself, you must choose an optimization method that will find constant param-
eters such that the value: v
t n
X (T − M )2
i i
V= ,
Mi
i=1
where Ti is the price given by the model and Mi is the market price, is minimized. A few
optimization methods are available in the ql/Optimization directory.
2.6.4 Pricers
Analytical pricers
If the model is affine, i.e. discount bond options formulas exist, caps are easily priced since they
are a portfolio of discount bond options. Such a pricer is implemented in QuantLib::Analytical-
CapFloor(p. 119). In the case of single-factor affine models, swaptions can be priced using the
Jamshidian decomposition, implemented in QuantLib::JamshidianSwaption(p. 379).
(Doesn’t work for the moment) For the moment, this is only available for single-factor affine
models. If x = x(t, r) is the state variable and follows this stochastic process:
∂P ∂P 1 2 ∂2 P
+µ + σ = r(t, x)P
∂t ∂x 2 ∂x2
The adequate operator to feed a Finite Difference Model instance is defined in the QuantLib::One-
FactorOperator(p. 487) class.
Using Trees
Each model derived from the single-factor model class has the ability to return a trinomial tree. For
yield-curve consistent models, the fitting parameter can be determined either analytically (when
possible) or numerically. When a tree is built, it is then pretty straightforward to implement
a pricer for any path-independant derivative. Just implement a class derived from Numerical-
Derivative (see QuantLib::NumericalSwaption for example) and roll it back until the present
time... Just look at QuantLib::TreeCapFloor(p. 608) and QuantLib::TreeSwaption(p. 609) for
working pricers.
Since version 0.3.4, the Instrument class was reworked as shown in the following figure.
if (isExpired()) LazyObject
setupExpired();
else #calculate(): void
LazyObject::calculate(); #performCalculations(): void
setupArguments(engine_->arguments());
engine_->arguments()->validate();
engine_->calculate(); engine_
// dynamic_cast needed in real code
NPV_ = engine_->results()->NPV;
Instrument
+isExpired(): bool
#calculate(): void PricingEngine
#performCalculations(): void
#setupExpired(): void -arguments: Arguments *
+setupArguments(Arguments *): void -results: Results *
+calculate()
On the one hand, the checking of the expiration condition is now performed in a method is-
Expired() separated from the actual calculation, and a setupExpired() method is provided.
The latter sets the NPV to 0.0 and can be extended in derived classes should any other results be
returned.
On the other hand, the pricing-engine machinery previously contained in the Option class was
moved upwards to the Instrument class. Also, the setupEngine() method was replaced by a
setupArguments(Arguments∗) method. This allows one to cleanly implement containment of
instruments with code such as:
results beside NPV_ and errorEstimate_, the setupExpired method should also be extended
so that those results are set to a value suitable for an expired instrument. This was the
migration path taken for all instruments not previously deriving from the Option class.
2. define suitable argument and result classes for the instrument and implement the is-
Expired and setupArguments methods, reusing the pricing-engine machinery provided by
the default performCalculations method. The latter can be extended by first calling
the default implementation and then performing any additional tasks required by the
instrument—most often, copying additional results from the pricing engine results to the
corresponding data members of the instrument. As in the previous case, the setupExpired
method can be extended to account for such extra data members.
The abstract class QuantLib::Solver1D(p. 565) provides the interface for one-dimensional solvers
which can find the zeroes of a given function.
A number of such solvers is contained in the ql/Solvers1D directory.
The implementation of the algorithms was inspired by "Numerical Recipes in C", 2nd edition,
Press, Teukolsky, Vetterling, Flannery - Chapter 9
Some work is needed to resolve the ambiguity of the root finding accuracy defition: for some
algorithms it is the x-accuracy, for others it is f(x)-accuracy.
2.9.3 Optimizers
This method, implemented in QuantLib::Simplex(p. 560), is rather raw and requires quite a lot
of computing resources, but it has the advantage that it does not need any evaluation of the cost
function’s gradient, and that it is quite easily implemented. First, we must choose N+1 starting
points, given here by a starting point P0 and N points such that
Pi = P0 + λei ,
where λ is the problem’s characteristic length scale). These points will form a geometrical form
called simplex. The principle of the downhill simplex method is, at each iteration, to move the
worst point (highest cost function value) through the opposite face to a better point. When the
simplex seems to be constrained in a valley, it will be contracted downhill, keeping the best point
unchanged.
d0 = −∇ f (x0 ).
As we can see, this optimization method requires the knowledge of the gradient of the cost
function. See QuantLib::ConjugateGradient(p. 213) .
2.12 Utilities
Iterators are meant to build a sequence on the fly from one or more other sequences, without
having to allocate place for storing it. A couple of examples: suppose we have a function which
calculates the average of a sequence, and that for genericity we have implemented it as a template
function which takes the beginning and the end of the sequence, so that its declaration is:
This kind of genericity allows one to use the same function to calculate the average of a std::vector,
a std::list, a QuantLib::History(p. 342), any other container, of a subset of any of the former.
Now let’s say we have two sequences of numbers, and we want to calculate the average of their
products. One approach could be to store the products in another sequence, and to calculate the
average of the latter, as in:
The above works, however, it might be not particularly efficient since we have to allocate the
product vector, quite possibly just to throw it away when the calculation is done.
QuantLib::coupling_iterator(p. 220) allows us to do the same thing without allocating the extra
vector: what we do is simply:
The call to make_coupling_iterator creates an iterator which is really a reference to the two
iterators and the operation we passed. Dereferencing such iterator returns the result of applying
such operation to the values pointed to by the two contained iterators. Advancing the coupling
iterator advances the two underlying ones. One can see how iterating on such iterator generates
the products one by one so that they can be processed by average(), but does not need allocating
memory for storing the results. The product sequence is generated on the fly.
The other iterators share the same principle but have different functionalities:
• processing_iterator takes a sequence [x0 , x1 , . . .] and a function f and generates the sequence
[ f (x0 ), f (x1 ), . . .];
• stepping_iterator takes a sequence [x0 , x1 , . . .] and a step m and generates the sequence
[x0 , xm , x2m , . . .]
Examples
A few examples of using the QuantLib library can be found in chapter 11 of the reference manual.
60 Examples
Reference Manual
Chapter 4
Frankfurt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Helsinki . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Johannesburg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
JointCalendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
London . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Milan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
NewYork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
NullCalendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Oslo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Stockholm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
Sydney . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
TARGET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Tokyo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
Toronto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
Warsaw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Wellington . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Zurich . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
Bridge< Constraint, ConstraintImpl > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Constraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
BoundaryConstraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
CompositeConstraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
NoConstraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
PositiveConstraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Bridge< DayCounter, DayCounterImpl > . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
DayCounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Actual360 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Actual365 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
ActualActual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
SimpleDayCounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
Thirty360 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Bridge< Interpolation, InterpolationImpl > . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
CubicSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
MonotonicCubicSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
NaturalCubicSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
NaturalMonotonicCubicSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
LinearInterpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
LogLinearInterpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Bridge< Interpolation2D, Interpolation2DImpl > . . . . . . . . . . . . . . . . . . . . . . . 179
Interpolation2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
BicubicSpline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
BilinearInterpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Bridge< Parameter, ParameterImpl > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
ConstantParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
NullParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
PiecewiseConstantParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
TermStructureFittingParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
ExtendedCoxIngersollRoss::FittingParameter . . . . . . . . . . . . . . . . . . . 287
G2::FittingParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
HullWhite::FittingParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
BrownianBridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
CalendarImpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Calendar::WesternImpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
CalibrationSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
CLGaussianRng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
CliquetOption::arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
CliquetOptionPricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
combining_iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Composite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
ConstraintImpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
CostFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
LeastSquareFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
coupling_iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
CoxIngersollRoss::Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
ExtendedCoxIngersollRoss::Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Cubic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
CumulativeBinomialDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
CumulativeNormalDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
CumulativePoissonDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
CuriouslyRecurringTemplate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
CuriouslyRecurringTemplate< Bisection > . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< Bisection > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Bisection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
CuriouslyRecurringTemplate< Brent > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< Brent > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Brent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
CuriouslyRecurringTemplate< FalsePosition > . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< FalsePosition > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
FalsePosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
CuriouslyRecurringTemplate< Newton > . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< Newton > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Newton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
CuriouslyRecurringTemplate< NewtonSafe > . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< NewtonSafe > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
NewtonSafe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
CuriouslyRecurringTemplate< Ridder > . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< Ridder > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Ridder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
CuriouslyRecurringTemplate< Secant > . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solver1D< Secant > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Secant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544
CurrencyFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
DateFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
DayCounterImpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
DiffusionProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
BlackScholesProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
OrnsteinUhlenbeckProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
SquareRootProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
DiscreteAveragingAsianOption::arguments . . . . . . . . . . . . . . . . . . . . . . . . . . 257
DiscretizedAsset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
DiscretizedDiscountBond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
DiscretizedOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Disposable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
DoubleFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
EndCriteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
AssertionFailedError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
IllegalArgumentError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
IllegalResultError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
IndexError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
OutOfMemoryError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
PostconditionNotSatisfiedError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
PreconditionNotSatisfiedError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
ErrorFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
EuroFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
EarlyExercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
AmericanExercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
BermudanExercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
EuropeanExercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Factorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
FdBermudanOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
FdDividendAmericanOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
FdDividendShoutOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
filtering_iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
FiniteDifferenceModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
ForwardOptionArguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
GammaFunction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
GaussianStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
GeneralStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
GenericRiskStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
HaltonRsg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< AffineModel > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< BlackModel > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< Impl > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< Lattice > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< Link< TermStructure > > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
RelinkableHandle< TermStructure > . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Handle< Link< Type > > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
RelinkableHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
Handle< MonteCarloModel< MultiAsset< RNG >, S > > . . . . . . . . . . . . . . . . . . 339
Handle< MonteCarloModel< MultiAsset_old< PseudoRandomSequence_old >, Statis-
tics > > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< MonteCarloModel< SingleAsset< RNG >, S > > . . . . . . . . . . . . . . . . . . 339
Handle< MonteCarloModel< SingleAsset_old< PseudoRandom_old >, Statistics > > . . 339
Handle< OneFactorAffineModel > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< path_generator_type > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< path_pricer_type > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Handle< ShortRateModel > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
ExplicitEuler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
ImplicitEuler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
MonteCarloModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
MonteCarloModel< MultiAsset< RNG >, S > . . . . . . . . . . . . . . . . . . . . . . . . . 448
MonteCarloModel< MultiAsset_old< PseudoRandomSequence_old >, Statistics > . . . 448
MonteCarloModel< SingleAsset< RNG >, S > . . . . . . . . . . . . . . . . . . . . . . . . 448
MonteCarloModel< SingleAsset_old< PseudoRandom_old >, Statistics > . . . . . . . . 448
MoroInverseCumulativeNormal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
MultiPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
MultiPathGenerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
MultiPathGenerator_old . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
NonLinearLeastSquare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
NormalDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
NumericalMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Lattice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
BlackScholesLattice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Lattice2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
TwoFactorModel::ShortRateTree . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
OneFactorModel::ShortRateTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Observable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
AffineModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
G2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
OneFactorAffineModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
CoxIngersollRoss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
ExtendedCoxIngersollRoss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Vasicek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
HullWhite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
BlackModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
BlackVolTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
BlackVarianceTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
BlackVarianceCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
BlackVarianceSurface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
ImpliedVolTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
BlackVolatilityTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
BlackConstantVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
CalibrationHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
CapFlatVolatilityStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
CapFlatVolatilityVector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
CapletForwardVolatilityStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
CashFlow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Coupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
FixedRateCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
FloatingRateCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
IndexedCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
InArrearIndexedCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
UpFrontIndexedCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
ParCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
ShortFloatingRateCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
SimpleCashFlow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Xibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
AUDLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
CADLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
CHFLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Euribor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
GBPLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
JPYLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
USDLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
ZARLibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
LazyObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Instrument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
CapFloor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Cap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Collar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
MultiAssetOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
BasketOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
OneAssetOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
OneAssetStrikedOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
BarrierOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
DiscreteAveragingAsianOption . . . . . . . . . . . . . . . . . . . . . . . . 255
VanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
ForwardVanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
QuantoVanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
QuantoForwardVanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . 524
Swaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Stock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
SimpleSwap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556
PiecewiseFlatForward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Link< TermStructure > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
LocalVolTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
LocalConstantVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
LocalVolCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
LocalVolSurface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
PricingEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
GenericEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
BarrierEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
AnalyticBarrierEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
MCBarrierEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
BasketEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
MCAmericanBasketEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
MCBasketEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
StulzEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
CliquetEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
DiscreteAveragingAsianEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
AnalyticDiscreteAveragingAsianEngine . . . . . . . . . . . . . . . . . . . . . 122
GenericModelEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
AnalyticalCapFloor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
BlackCapFloor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
BlackSwaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
JamshidianSwaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
LatticeShortRateModelEngine< CapFloor::arguments, CapFloor::results > . 389
LatticeShortRateModelEngine< Swaption::arguments, Swaption::results > . 389
GenericModelEngine< AffineModel, CapFloor::arguments, CapFloor::results > 333
GenericModelEngine< BlackModel, CapFloor::arguments, CapFloor::results > 333
GenericModelEngine< BlackModel, Swaption::arguments, Swaption::results > 333
GenericModelEngine< OneFactorAffineModel, Swaption::arguments, Swap-
tion::results > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
GenericModelEngine< ShortRateModel, CapFloor::arguments, Cap-
Floor::results > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
GenericModelEngine< ShortRateModel, Swaption::arguments, Swap-
tion::results > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
VanillaEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
AnalyticDigitalAmericanEngine . . . . . . . . . . . . . . . . . . . . . . . . . 121
AnalyticEuropeanEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
BaroneAdesiWhaleyApproximationEngine . . . . . . . . . . . . . . . . . . . 133
BinomialVanillaEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
BjerksundStenslandApproximationEngine . . . . . . . . . . . . . . . . . . . 153
IntegralEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
MCVanillaEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
GenericEngine< Arguments, Results > . . . . . . . . . . . . . . . . . . . . . . . . . 332
GenericModelEngine< ShortRateModel, Arguments, Results > . . . . . . . . . 333
LatticeShortRateModelEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
TreeCapFloor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
TreeSwaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609
GenericEngine< BarrierOption::arguments, BarrierOption::results > . . . . . . . . 332
GenericEngine< BasketOption::arguments, BasketOption::results > . . . . . . . . 332
GenericEngine< CapFloor::arguments, CapFloor::results > . . . . . . . . . . . . . 332
GenericEngine< CliquetOption::arguments, VanillaOption::results > . . . . . . . 332
GenericEngine< DiscreteAveragingAsianOption::arguments, DiscreteAveraging-
AsianOption::results > . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
GenericEngine< ForwardOptionArguments< ArgumentsType >, ResultsType > . 332
ForwardEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
ForwardPerformanceEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
GenericEngine< QuantoOptionArguments< ArgumentsType >, QuantoOption-
Results< ResultsType > > . . . . . . . . . . . . . . . . . . . . . . . . . . 332
QuantoEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
GenericEngine< Swaption::arguments, Swaption::results > . . . . . . . . . . . . . 332
GenericEngine< VanillaOption::arguments, VanillaOption::results > . . . . . . . . 332
Quote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
CompositeQuote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
DerivedQuote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
SimpleQuote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
RateHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
DepositRateHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
FraRateHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
FuturesRateHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
SwapRateHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
ShortRateModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
OneFactorModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
BlackKarasinski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
OneFactorAffineModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
TwoFactorModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
G2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
StochasticProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
SwaptionVolatilityStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
SwaptionVolatilityMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
TermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594
DiscountStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
AffineTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
DiscountCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
ExtendedDiscountCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
ImpliedTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
ForwardRateStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
ForwardSpreadedTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . 313
PiecewiseFlatForward . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
ZeroYieldStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
DriftTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
QuantoTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
ZeroCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
ZeroSpreadedTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
TermStructureConsistentModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
BlackKarasinski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
ExtendedCoxIngersollRoss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
G2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
HullWhite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Observer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
AffineTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
BlackConstantVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
BlackModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
BlackVarianceCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
BlackVarianceSurface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
CalibrationHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
CompositeQuote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
DerivedQuote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
DriftTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
ExtendedDiscountCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
ForwardSpreadedTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
GenericModelEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
GenericModelEngine< AffineModel, CapFloor::arguments, CapFloor::results > . . . 333
GenericModelEngine< BlackModel, CapFloor::arguments, CapFloor::results > . . . . 333
GenericModelEngine< BlackModel, Swaption::arguments, Swaption::results > . . . 333
GenericModelEngine< OneFactorAffineModel, Swaption::arguments, Swap-
tion::results > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
GenericModelEngine< ShortRateModel, Arguments, Results > . . . . . . . . . . . . . 333
GenericModelEngine< ShortRateModel, CapFloor::arguments, CapFloor::results > . 333
GenericModelEngine< ShortRateModel, Swaption::arguments, Swaption::results > . 333
ImpliedTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
ImpliedVolTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
IndexedCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
LazyObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Link< TermStructure > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
LocalConstantVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
LocalVolCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
LocalVolSurface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
ParCoupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
QuantoTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
RateHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
ShortRateModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
StochasticProcess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Xibor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
ZeroSpreadedTermStructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
OneFactorModel::ShortRateDynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
OptimizationMethod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
ConjugateGradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Simplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560
SteepestDescent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
OptionTypeFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
ParameterImpl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
PathGenerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502
PathGenerator_old . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503
PathPricer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
PathPricer< MultiPath > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
PathPricer< Path > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
PathPricer_old . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Payoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
TypePayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
StrikedTypePayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
AssetOrNothingPayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
CashOrNothingPayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
GapPayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
PercentageStrikePayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
PlainVanillaPayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
SuperSharePayoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
PerformanceOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
PoissonDistribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
PrimeNumbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
processing_iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
QuantoOptionArguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
QuantoOptionResults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
RandomArrayGenerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
RandomSequenceGenerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
RateFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Greeks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
MultiAssetOption::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
OneAssetOption::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
MoreGreeks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
OneAssetOption::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
CapFloor::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
MultiAssetOption::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
OneAssetOption::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
SimpleSwap::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Swaption::results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
SalvagingAlgorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
SegmentIntegral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
SequenceStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
SequenceStatistics< Statistics > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
DiscrepancyStatistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Short . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
SingleAssetOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
DiscreteGeometricAPO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
DiscreteGeometricASO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
EuropeanOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
ContinuousGeometricAPO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
FdDividendEuropeanOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
FdBsmOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
FdEuropean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
FdStepConditionOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
FdAmericanOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
SobolRsg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
StatsHolder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
StepCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
AmericanCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
ShoutCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
StepCondition< Array > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
stepping_iterator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
StringFormatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
SVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
SymmetricSchurDecomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
TimeBasket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
TimeGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
TrapezoidIntegral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
SimpsonIntegral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
BinomialTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
EqualJumpsBinomialTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
CoxRossRubinstein . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Trigeorgis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
EqualProbabilitiesBinomialTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
AdditiveEQPBinomialTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
JarrowRudd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
LeisenReimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Tian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
TrinomialTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
TridiagonalOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
BSMOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
DMinus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
DPlus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
DPlusDMinus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
DZero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
OneFactorOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
TridiagonalOperator::TimeSetter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
TrinomialBranching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
TwoFactorModel::ShortRateDynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
Vasicek::Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
Visitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Visitor< BlackConstantVol > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Visitor< BlackVarianceCurve > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Visitor< BlackVolTermStructure > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
Visitor< CashFlow > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
BPSBasketCalculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
BPSCalculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Visitor< Coupon > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
BPSBasketCalculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
BPSCalculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Visitor< FixedRateCoupon > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628
BPSBasketCalculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
XiborManager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
Here are the classes, structs, unions and interfaces with brief descriptions:
Actual360 (Actual/360 day count convention ) . . . . . . . . . . . . . . . . . . . . . . . . 107
Actual365 (Actual/365 day count convention ) . . . . . . . . . . . . . . . . . . . . . . . . 108
ActualActual (Actual/Actual day count ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
AcyclicVisitor (Degenerate base class for the Acyclic Visitor pattern ) . . . . . . . . . . . 110
AdditiveEQPBinomialTree (Additive equal probabilities binomial tree ) . . . . . . . . . 111
AffineModel (Affine model class ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
AffineTermStructure (Term-structure implied by an affine model ) . . . . . . . . . . . . 113
AmericanCondition (American exercise condition ) . . . . . . . . . . . . . . . . . . . . . 115
AmericanExercise (American exercise ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
AmericanPayoffAtExpiry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
AmericanPayoffAtHit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
AnalyticalCapFloor (Analytical pricer for cap/floor ) . . . . . . . . . . . . . . . . . . . . . 119
AnalyticBarrierEngine (Pricing engine for barrier options using analytical formulae ) . 120
AnalyticDigitalAmericanEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
AnalyticDiscreteAveragingAsianEngine (Pricing engine for European discrete geomet-
ric average Asian option ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
AnalyticEuropeanEngine (Pricing engine for European vanilla options using analytical
formulae ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Arguments (Base class for generic argument groups ) . . . . . . . . . . . . . . . . . . . . 124
ArmijoLineSearch (Armijo line search ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Array (1-D array used in linear algebra ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
ArrayFormatter (Formats arrays for output ) . . . . . . . . . . . . . . . . . . . . . . . . . 128
AssertionFailedError (Specialized error ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
AssetOrNothingPayoff (Binary asset-or-nothing payoff ) . . . . . . . . . . . . . . . . . . 130
AUDLibor (AUD Libor index, also known as SIBOR ) . . . . . . . . . . . . . . . . . . . . 131
Average (Placeholder for enumerated averaging types ) . . . . . . . . . . . . . . . . . . . 132
BaroneAdesiWhaleyApproximationEngine . . . . . . . . . . . . . . . . . . . . . . . . . 133
Barrier (Placeholder for enumerated barrier types ) . . . . . . . . . . . . . . . . . . . . . 134
BarrierEngine (Barrier engine base class ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
BarrierOption (Barrier option on a single asset ) . . . . . . . . . . . . . . . . . . . . . . . 136
BarrierOption::arguments (Arguments for barrier option calculation ) . . . . . . . . . . 138
BasketEngine (Basket option engine base class ) . . . . . . . . . . . . . . . . . . . . . . . 139
BasketOption (Basket option on a number of assets ) . . . . . . . . . . . . . . . . . . . . 140
78 QuantLib Class Index
Global definitions and quite a few macros which help porting the code to different compilers
Defines
• #define QL_DUMMY_RETURN(x)
specific per-compiler definitions Is a dummy return statement required?
• #define QL_IO_INIT
I/O initialization.
if (condition)
return validResult;
else
QL_FAIL("whatever the reason");
96 QuantLib Module Documentation
On the other hand, other compilers will issue a warning if it is present because it cannot be
reached. For the code to be portable this macro should be used after the block.
I/O initialization.
Sometimes, programs compiled with the free Borland compiler will crash miserably upon at-
tempting to write on std::cout. Strangely enough, issuing the instruction
at the beginning of the program will prevent other accesses to std::cout from crashing the program.
This macro, to be called at the beginning of main(), encapsulates the above enchantment for
Borland and is defined as empty for the other compilers.
Some compilers still define math functions them in the global namespace. For the code to be
portable these macros should be used instead of the actual functions.
Defines
• #define QL_SQRT std::sqrt
square root
Some compilers do not give an implementation of yet. For the code to be portable these macros
should be used instead of the corresponding method of std::numeric_limits or the corresponding
macro defined in <limits.h>.
Defines
• #define QL_MIN_INT ((std::numeric_limits<int>::min)())
• #define QL_MAX_INT ((std::numeric_limits<int>::max)())
• #define QL_MIN_DOUBLE -((std::numeric_limits<double>::max)())
• #define QL_MIN_POSITIVE_DOUBLE ((std::numeric_limits<double>::min)())
• #define QL_MAX_DOUBLE ((std::numeric_limits<double>::max)())
• #define QL_EPSILON ((std::numeric_limits<double>::epsilon)())
Some compilers still define time functions in the global namespace. For the code to be portable
these macros should be used instead of the actual functions.
Defines
• #define QL_CLOCK std::clock
clock value
Some compilers still define string functions in the global namespace. For the code to be portable
these macros should be used instead of the actual functions.
Defines
• #define QL_STRLEN std::strlen
string length
Some compilers still define character functions in the global namespace. For the code to be
portable these macros should be used instead of the actual functions.
Defines
• #define QL_TOUPPER std::toupper
convert to uppercase
Some compilers still define i/o functions in the global namespace. For the code to be portable
these macros should be used instead of the actual functions.
Defines
• #define QL_SPRINTF std::sprintf
print to string
Some compilers still do not define std::min and std::max. Moreover, Visual C++ defines them but
for unfathomable reasons garble their names. For the code to be portable these macros should be
used instead of the actual functions.
Defines
• #define QL_MIN std::min
minimum between two elements
Some compilers still do not fully implement the template syntax. These macros can be used to
select between alternate implementations of blocks of code, namely, one that takes advantage of
template programming techniques and a less efficient one which is compatible with all compilers.
Defines
• #define QL_DECLARE_TEMPLATE_SPECIALIZATIONS
Blame Microsoft for this one...
• #define QL_ALLOW_TEMPLATE_METHOD_CALLS 1
Blame Microsoft for this one...
• #define QL_TEMPLATE_METAPROGRAMMING_WORKS 1
Handle<Type1> h1(whatever);
h2 = h1.downcast<Type2>();
For compatibility, a workaround should be implemented (which of course will be less solid or
more comples - as I said, blame Microsoft...)
Some compilers still define the iterator struct outside the std namespace, only partially implement
it, or do not implement it at all. For the code to be portable these macros should be used instead
of the actual functions.
Defines
• #define QL_ITERATOR std::iterator
• #define QL_ITERATOR_TRAITS std::iterator_traits
• #define QL_SPECIALIZE_ITERATOR_TRAITS(T)
• #define QL_REVERSE_ITERATOR(iterator, type) std::reverse_iterator< iterator >
Blame Microsoft for this one...
• #define QL_FULL_ITERATOR_SUPPORT
Custom iterators should be derived from this struct for the code to be portable.
For the code to be portable this macro should be used instead of the actual struct.
When using the QuantLib implementation of iterator_traits or Visual C++ .Net, this macro might
be needed to specialize QL_ITERATOR_TRAITS for a pointer to a user-defined type.
Some compilers (most notably, Visual C++) still do not fully support iterators in their STL
implementation. This macro can be used to select between alternate implementations of blocks
of code, namely, one that takes advantage of full iterator support and a less efficient one which is
compatible with all compilers.
DayCounter
Actual360
DayCounter
Actual365
DayCounter
ActualActual
Public Types
• enum Convention {
ISMA, Bond, ISDA, Historical,
AFB, Euro }
AcyclicVisitor
BPSBasketCalculator BPSCalculator
Tree
BinomialTree
EqualProbabilitiesBinomialTree
AdditiveEQPBinomialTree
Observable
AffineModel
G2 OneFactorAffineModel
CoxIngersollRoss Vasicek
ExtendedCoxIngersollRoss HullWhite
• virtual double discountBondOption (Option::Type type, double strike, Time maturity, Time
bondMaturity) const=0
Observable
TermStructure
DiscountStructure Observer
AffineTermStructure
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
StandardStepCondition
AmericanCondition
Todo
Unify the intrinsicValues/Payoff thing
Exercise
EarlyExercise
AmericanExercise
American exercise.
An American option can be exercised at any time between two predefined dates
Todo
check that everywhere the American condition is applied from the earliestDate and not earlier
Todo
calculate greeks
Todo
calculate greeks
Observable
PricingEngine
AnalyticalCapFloor
Observable
PricingEngine
BarrierEngine
AnalyticBarrierEngine
Observable
PricingEngine
VanillaEngine
AnalyticDigitalAmericanEngine
Pricing engine for American vanilla options with digital payoff using analytic formulae
Todo
add more greeks (as of now only delta and rho available)
Observable
PricingEngine
DiscreteAveragingAsianEngine
AnalyticDiscreteAveragingAsianEngine
Observable
PricingEngine
VanillaEngine
AnalyticEuropeanEngine
Arguments
arguments
LineSearch
ArmijoLineSearch
• virtual ∼ArmijoLineSearch ()
Destructor.
Public Types
• typedef double ∗ iterator
• typedef const double ∗ const_iterator
Vector algebra
v += x and similar operation involving a scalar value are shortcuts for ∀i : vi = vi + x
v ∗= w and similar operation involving two vectors are shortcuts for ∀i : vi = vi × wi
Precondition:
all arrays involved in an algebraic expression must have the same size.
Element access
• double operator[ ] (Size) const
read-only
Inspectors
• Size size () const
dimension of the array
Iterator access
• const_iterator begin () const
• iterator begin ()
• const_iterator end () const
• iterator end ()
• const_reverse_iterator rbegin () const
• reverse_iterator rbegin ()
• const_reverse_iterator rend () const
• reverse_iterator rend ()
Utilities
• void swap (Array &)
Related Functions
Error
AssertionFailedError
Specialized error.
Thrown upon a failed assertion.
Payoff
TypePayoff
StrikedTypePayoff
AssetOrNothingPayoff
Observable
Index Observer
Xibor
AUDLibor
Todo
check settlement days
Public Types
• enum Type { Arithmetic, Geometric }
Observable
PricingEngine
VanillaEngine
BaroneAdesiWhaleyApproximationEngine
Pricing engine for American vanilla options with Barone-Adesi and Whaley approximation (1987)
Public Types
• enum Type { DownIn, UpIn, DownOut, UpOut }
Observable
PricingEngine
BarrierEngine
AnalyticBarrierEngine MCBarrierEngine
#include <ql/Instruments/barrieroption.hpp>
Inheritance diagram for BarrierOption:
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
BarrierOption
Protected Attributes
• Barrier::Type barrierType_
• double barrier_
• double rebate_
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from OneAssetStrikedOption (p. 482).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from OneAssetStrikedOption (p. 482).
Public Attributes
• Barrier::Type barrierType
• double barrier
• double rebate
Observable
PricingEngine
BasketEngine
Observable Observer
LazyObject
Instrument
Option
MultiAssetOption
BasketOption
Public Types
• enum BasketType { Min, Max }
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from MultiAssetOption (p. 452).
Arguments
arguments
arguments
BasketOption::arguments
Public Attributes
• BasketType basketType
Exercise
EarlyExercise
BermudanExercise
Bermudan exercise.
A Bermudan option can only be exercised at a set of fixed dates.
Todo
it would be nice to have a way for making a Bermudan with one exercise date equivalent to
an European
Interpolation2D
BicubicSpline
Todo
revise end conditions
9.34.2.1 BicubicSpline (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin, const I2 &
yEnd, const M & zData)
Precondition:
the x and y values must be sorted.
Interpolation2DImpl
templateImpl<I1,I2,M>
BicubicSpline::Impl
template<class I1, class I2, class M> class QuantLib::BicubicSpline::Impl< I1, I2, M >
Interpolation2D
BilinearInterpolation
9.36.2.1 BilinearInterpolation (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin, const I2
& yEnd, const M & zData)
Precondition:
the x and y values must be sorted.
Interpolation2DImpl
templateImpl<I1,I2,M>
BilinearInterpolation::Impl
template<class I1, class I2, class M> class QuantLib::BilinearInterpolation::Impl< I1, I2, M >
Tree
BinomialTree
Protected Attributes
• double x0_
• double driftPerStep_
• Time dt_
Observable
PricingEngine
VanillaEngine
BinomialVanillaEngine
Bisection
Todo
check accuracy of this algorithm and compare with: 1) Drezner, Z, (1978), Computation of the
bivariate normal integral, Mathematics of Computation 32, pp. 277-279. 2) Drezner, Z. and
Wesolowsky, G. O. (1990) ‘On the Computation of the Bivariate Normal Integral’, Journal of
Statistical Computation and Simulation 35, pp. 101-107. 3) Drezner, Z (1992) Computation
of the Multivariate Normal Integral, ACM Transactions on Mathematics Software 18, pp.
450-460. 4) Drezner, Z (1994) Computation of the Trivariate Normal Integral, Mathematics of
Computation 62, pp. 289-294. 5) Genz, A. (1992) ‘Numerical Computation of the Multivariate
Normal Probabilities’, J. Comput. Graph. Stat. 1, pp. 141-150.
Observable
PricingEngine
VanillaEngine
BjerksundStenslandApproximationEngine
Pricing engine for American vanilla options with Bjerksund and Stensland approximation (1993)
Observable
PricingEngine
BlackCapFloor
Observable
BlackVolTermStructure
BlackVolatilityTermStructure Observer
BlackConstantVol
BlackVolTermStructure interface
• double blackForwardVol (Time t1, Time t2, double strike, bool extrapolate=false) const
future (a.k.a. forward) volatility
Observer interface
• void update ()
Visitability
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observer Observable
ShortRateModel
OneFactorModel TermStructureConsistentModel
BlackKarasinski
Observable Observer
BlackModel
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
where
ln( f /k) + v2 /2
d1 ( f, k, v) =
v
and
d2 ( f, k, v) = d1 ( f, k, v) − v.
NumericalMethod
Lattice
BlackScholesLattice
DiffusionProcess
BlackScholesProcess
σ(t, S)2
dS(t, S) = (r(t) − q(t) − )dt + σdWt .
2
Todo
revise extrapolation
Observable
PricingEngine
BlackSwaption
Observable
BlackVolTermStructure
BlackVarianceTermStructure Observer
BlackVarianceCurve
Todo
check time extrapolation
BlackVolTermStructure interface
Modifiers
Observer interface
• void update ()
Visitability
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable
BlackVolTermStructure
BlackVarianceTermStructure Observer
BlackVarianceSurface
Todo
check time extrapolation
Public Types
• enum Extrapolation { ConstantExtrapolation, InterpolatorDefaultExtrapolation }
BlackVolTermStructure interface
Modifiers
Observer interface
• void update ()
Visitability
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable
BlackVolTermStructure
BlackVarianceTermStructure
9.54.2.1 double blackVolImpl (Time maturity, double strike, bool extrapolate = false) const
[protected, virtual]
Returns the volatility for the given strike and date calculating it from the variance.
Implements BlackVolTermStructure (p. 171).
Observable
BlackVolTermStructure
BlackVolatilityTermStructure
BlackConstantVol
9.55.2.1 double blackVarianceImpl (Time maturity, double strike, bool extrapolate = false)
const [protected, virtual]
Returns the variance for the given strike and date calculating it from the volatility.
Implements BlackVolTermStructure (p. 171).
Observable
BlackVolTermStructure
BlackVarianceTermStructure BlackVolatilityTermStructure
• double blackVol (const Date &maturity, double strike, bool extrapolate=false) const
present (a.k.a spot) volatility
• double blackVariance (const Date &maturity, double strike, bool extrapolate=false) const
• double blackForwardVol (const Date &date1, const Date &date2, double strike, bool
extrapolate=false) const
future (a.k.a. forward) volatility
• double blackForwardVol (Time time1, Time time2, double strike, bool extrapolate=false)
const
future (a.k.a. forward) volatility
• double blackForwardVariance (const Date &date1, const Date &date2, double strike,
bool extrapolate=false) const
• double blackForwardVariance (Time time1, Time time2, double strike, bool extrapo-
late=false) const
future (a.k.a. forward) variance
Dates
Visitability
Public Types
• typedef Operator operatorType
• typedef Operator::arrayType arrayType
• enum Side { None, Upper, Lower }
Todo
Generalize for n-dimensional conditions
This method modifies an operator L before it is applied to an array u so that v = Lu will satisfy
the given condition.
9.57.3.3 virtual void applyBeforeSolving (operatorType &, arrayType & rhs) const [pure
virtual]
This method modifies an operator L before the linear system Lu0 = u is solved so that u0 will
satisfy the given condition.
This method sets the current time for time-dependent boundary conditions.
Implemented in NeumannBC (p. 460), and DirichletBC (p. 248).
Constraint
BoundaryConstraint
Public Types
• typedef Sample< double > sample_type
Deprecated
initialize with a random number generator instead.
AcyclicVisitor Visitor< CashFlow > Visitor< Coupon > Visitor< FixedRateCoupon >
BPSBasketCalculator
Visitor interface
BPSCalculator
Visitor interface
Brent
class FooImpl;
class Foo : public Bridge<Foo,FooImpl> {
...
};
which makes it possible to pass instances of class Foo by value while retaining polymorphic
behavior.
Public Types
• typedef T_impl Impl
Protected Attributes
• Handle< Impl > impl_
Public Types
• typedef Sample< std::vector< double > > sample_type
• BrownianBridge (const std::vector< double > &sigma, const TimeGrid &timeGrid, const
GSG &generator)
general Wiener process paths
inspectors
TridiagonalOperator
BSMOperator
Calendar
Budapest
Budapest calendar
Holidays:
• Saturdays
• Sundays
• Easter Monday
• Whit(Pentecost) Monday
• New Year’s Day, January 1st
• National Day, March 15th
• Labour Day, May 1st
• Constitution Day, August 20th
• Republic Day, October 23rd
• All Saints Day, November 1st
• Christmas, December 25th
• 2nd Day of Christmas, December 26th
Observable
Index Observer
Xibor
CADLibor
Todo
check settlement days
Budapest
Copenhagen
Frankfurt
Helsinki
Johannesburg
JointCalendar
London
Milan
NewYork
Oslo
Stockholm
Sydney
TARGET
Tokyo
Toronto
Warsaw
Wellington
Zurich
calendar class
This class provides methods for determining whether a date is a business day or a holiday for a
given market, and for incrementing/decrementing a date of a given number of business days.
The Bridge(p. 179) pattern is used to provide the base behavior of the calendar, namely, to
determine whether a date is a business day.
Calendar interface
Related Functions
9.68.2.1 Calendar ()
This default constructor returns a calendar with a null implementation, which is therefore unus-
able except as a placeholder.
This protected constructor will only be invoked by derived classes which define a given Calen-
dar(p. 184) implementation
Warning:
This method is used for output and comparison between calendars. It is not meant to be
used for writing switch-on-type code.
Returns true iff the date is a business day for the given market.
Returns true iff the date is last business day for the month in given market.
Returns true iff the date is a holiday for the given market.
9.68.3.5 Date roll (const Date &, RollingConvention convention = Following, const Date &
origin = Date()) const
Returns the next business day on the given market with respect to the given date and convention.
9.68.3.6 Date advance (const Date &, int n, TimeUnit unit, RollingConvention convention =
Following) const
Advances the given date of the given number of business days and returns the result.
Note:
The input date is not modified.
9.68.3.7 Date advance (const Date & date, const Period & period, RollingConvention
convention) const
Advances the given date as specified by the given period and returns the result.
Note:
The input date is not modified.
9.68.4.1 bool operator== (const Calendar &, const Calendar &) [related]
Returns true iff the two calendars belong to the same derived class.
CalendarImpl
Calendar::WesternImpl
CalendarImpl
WesternImpl
#include <ql/ShortRateModels/calibrationhelper.hpp>
Inheritance diagram for CalibrationHelper:
Observer Observable
CalibrationHelper
Protected Attributes
• double marketValue_
• RelinkableHandle< Quote > volatility_
• RelinkableHandle< TermStructure > termStructure_
• Handle< BlackModel > blackModel_
• Handle< PricingEngine > engine_
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable Observer
LazyObject
Instrument
CapFloor
Cap
Observable
CapFlatVolatilityStructure
CapFlatVolatilityVector
Observable
CapFlatVolatilityStructure
CapFlatVolatilityVector
Todo
Either add correct copy behavior or inhibit copy. Right now, a copied instance would end up
with its own copy of the length vector but an interpolation pointing to the original ones.
Observable Observer
LazyObject
Instrument
CapFloor
Public Types
• enum Type { Cap, Floor, Collar }
Instrument interface
Inspectors
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument (p. 368).
Arguments
CapFloor::arguments
Public Attributes
• CapFloor::Type type
• std::vector< Time > startTimes
• std::vector< Time > fixingTimes
• std::vector< Time > endTimes
• std::vector< Time > accrualTimes
• std::vector< Rate > capRates
• std::vector< Rate > floorRates
• std::vector< Rate > forwards
• std::vector< double > nominals
Results
Value
CapFloor::results
Observable
CapletForwardVolatilityStructure
Observable
CashFlow
Coupon SimpleCashFlow
FixedRateCoupon FloatingRateCoupon
IndexedCoupon ParCoupon
Visitability
• virtual void accept (AcyclicVisitor &)
Implemented in FixedRateCoupon (p. 304), IndexedCoupon (p. 365), ParCoupon (p. 500), Short-
FloatingRateCoupon (p. 549), and SimpleCashFlow (p. 553).
Payoff
TypePayoff
StrikedTypePayoff
CashOrNothingPayoff
Observable
Index Observer
Xibor
CHFLibor
Todo
check settlement days and day-count
Public Types
• typedef Sample< double > sample_type
Deprecated
initialize with a random number generator instead.
Observable
PricingEngine
CliquetEngine
Public Attributes
• double moneyness
• double accruedCoupon
• double lastFixing
• double localCap
• double localFloor
• double globalCap
• double globalFloor
• std::vector< Date > resetDates
Observable Observer
LazyObject
Instrument
CapFloor
Collar
Public Types
• typedef Function::result_type value_type
• typedef const Function::result_type ∗ pointer
• typedef const Function::result_type & reference
Dereferencing
Random access
Difference
Comparisons
Public Attributes
• typedef< Iterator >::difference_type difference_type
Related Functions
Composite pattern.
The typical use of this class is:
which causes CompositeFoo to inherit from Foo and provides it with methods for adding com-
ponents. Of course, any abstract Foo interface must still be implemented.
Protected Types
• typedef std::list< Handle< T > >::iterator iterator
• typedef std::list< Handle< T > >::const_iterator const_iterator
Protected Attributes
• std::list< Handle< T > > components_
Constraint
CompositeConstraint
Observable
Quote Observer
CompositeQuote
Quote interface
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
OptimizationMethod
ConjugateGradient
Parameter
ConstantParameter
Constraint
SingleAssetOption
EuropeanOption
ContinuousGeometricAPO
Todo
add Average(p. 132) Strike version and make it backward starting
Calendar
Copenhagen
Copenhagen calendar
Holidays:
• Saturdays
• Sundays
• Maunday Thursday
• Good Friday
• Easter Monday
• General Prayer Day, 25 days after Easter Monday
• Ascension
• Whit (Pentecost) Monday
• New Year’s Day, January 1st
• Constitution Day, June 5th
• Christmas, December 25th
• Boxing Day, December 26th
CostFunction
LeastSquareFunction
Public Types
• typedef Function::result_type value_type
• typedef const Function::result_type ∗ pointer
• typedef const Function::result_type & reference
Dereferencing
Random access
Difference
Comparisons
Public Attributes
• typedef< Iterator1 >::difference_type difference_type
Related Functions
• coupling_iterator< It1, It2, Function > make_coupling_iterator (It1 it1, It2 it2, Function f)
helper function to create combining iterators
Observable
CashFlow
Coupon
FixedRateCoupon FloatingRateCoupon
IndexedCoupon ParCoupon
Inspectors
Visitability
Protected Attributes
• double nominal_
• Date paymentDate_
• Date accrualStartDate_
• Date accrualEndDate_
• Date refPeriodStart_
• Date refPeriodEnd_
9.100.2.1 Coupon (double nominal, const Date & paymentDate, const Date &
accrualStartDate, const Date & accrualEndDate, const Date & refPeriodStart =
Date(), const Date & refPeriodEnd = Date())
Warning:
the coupon does not roll the payment date which must already be a business day.
Observer Observable
ShortRateModel
OneFactorModel AffineModel
OneFactorAffineModel
CoxIngersollRoss
ExtendedCoxIngersollRoss
Bug
This class was not tested enough to guarantee its functionality.
CoxIngersollRoss::Dynamics
Dynamics
Tree
BinomialTree
EqualJumpsBinomialTree
CoxRossRubinstein
MixedScheme<Operator>
CrankNicolson
// copy constructor/assignment
// (these will be provided by the compiler if none is defined)
Operator(const Operator&);
Operator& operator=(const Operator&);
// inspectors
Size size();
// modifiers
void setTime(Time t);
// operator interface
arrayType applyTo(const arrayType&);
arrayType solveFor(const arrayType&);
static Operator identity(Size size);
// operator algebra
Operator operator*(double, const Operator&);
Operator operator+(const Operator&, const Operator&);
Operator operator+(const Operator&, const Operator&);
Warning:
The differential operator must be linear for this evolver to work.
Friends
• class FiniteDifferenceModel< CrankNicolson< Operator > >
#include <ql/Math/cubicspline.hpp>
Inheritance diagram for CubicSpline:
Interpolation
CubicSpline
Public Types
• enum BoundaryCondition {
NotAKnot, FirstDerivative, SecondDerivative, Periodic,
Lagrange }
• template<class I1, class I2> CubicSpline (const I1 &xBegin, const I1 &xEnd, const
I2 &yBegin, CubicSpline::BoundaryCondition leftCondition, double leftConditionValue,
CubicSpline::BoundaryCondition rightCondition, double rightConditionValue, bool
monotonicityConstraint)
• const std::vector< double > & aCoefficients () const
• const std::vector< double > & bCoefficients () const
• const std::vector< double > & cCoefficients () const
Enumeration values:
NotAKnot Make second(-last) point an inactive knot.
FirstDerivative Match value of end-slope.
SecondDerivative Match value of second derivative at end.
Periodic Match first and second derivative at either end.
Lagrange Match end-slope to the slope of the cubic that matches the first four data at the
respective end
9.106.3.1 CubicSpline (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin,
CubicSpline::BoundaryCondition leftCondition, double leftConditionValue,
CubicSpline::BoundaryCondition rightCondition, double rightConditionValue,
bool monotonicityConstraint)
Precondition:
the x values must be sorted.
CuriouslyRecurringTemplate
• Date ()
Default constructor returning a null date.
inspectors
date algebra
• Date maxDate ()
latest allowed date
• Date todaysDate ()
today’s date.
Related Functions
Public Types
• enum Format { Long, Short, ISO }
DayCounter
DayCounter interface
• Time yearFraction (const Date &, const Date &, const Date &refPeriodStart=Date(), const
Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Related Functions
9.114.2.1 DayCounter ()
This default constructor returns a day counter with a null implementation, which is therefore
unusable except as a placeholder.
This protected constructor will only be invoked by derived classes which define a given Day-
Counter(p. 240) implementation
Warning:
This method is used for output and comparison between day counters. It is not meant to be
used for writing switch-on-type code.
9.114.4.1 bool operator== (const DayCounter &, const DayCounter &) [related]
Returns true iff the two day counters belong to the same derived class.
Observer Observable
RateHelper
DepositRateHelper
Deposit rate.
Warning:
This class assumes that the reference date does not change between calls of setTerm-
Structure()(p. 243).
Warning:
Being a pointer and not a Handle(p. 339), the term structure is not guaranteed to remain
allocated for the whole life of the rate helper. It is responsibility of the programmer to ensure
that the pointer remains valid. It is advised that rate helpers be used only in term structure
constructors, setting the term structure to this, i.e., the one being constructed.
Observable
Quote Observer
DerivedQuote
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
DiffusionProcess
• virtual double variance (Time t0, double x0, Time dt) const
returns the variance of the process after a time interval
9.118.2.2 virtual double expectation (Time t0, double x0, Time dt) const [virtual]
9.118.2.3 virtual double variance (Time t0, double x0, Time dt) const [virtual]
DirichletBC
Todo
generalize to time-dependent conditions.
This method sets the current time for time-dependent boundary conditions.
Implements BoundaryCondition< TridiagonalOperator > (p. 173).
Observable
TermStructure
DiscountStructure
DiscountCurve
ExtendedDiscountCurve
Protected Attributes
• Date todaysDate_
• Date referenceDate_
• DayCounter dayCounter_
• std::vector< Date > dates_
• std::vector< DiscountFactor > discounts_
• std::vector< Time > times_
• Interpolation interpolation_
#include <ql/termstructure.hpp>
Inheritance diagram for DiscountStructure:
Observable
TermStructure
DiscountStructure
ExtendedDiscountCurve
9.121.2.1 Rate zeroYieldImpl (Time, bool extrapolate = false) const [protected, virtual]
Returns the zero yield rate for the given date calculating it from the discount.
Implements TermStructure (p. 595).
9.121.2.2 Rate forwardImpl (Time, bool extrapolate = false) const [protected, virtual]
Returns the instantaneous forward rate for the given date calculating it from the discount.
Implements TermStructure (p. 595).
Returns the forward rate at a specified compound frequency for the given date calculating it from
the zero yield.
Implements TermStructure (p. 595).
Reimplemented in ExtendedDiscountCurve (p. 289).
DiscrepancyStatistics
1-dimensional inspectors
Observable
PricingEngine
DiscreteAveragingAsianEngine
AnalyticDiscreteAveragingAsianEngine
#include <ql/Instruments/asianoption.hpp>
Inheritance diagram for DiscreteAveragingAsianOption:
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
DiscreteAveragingAsianOption
Asian option.
Protected Attributes
• Average::Type averageType_
• double runningProduct_
• Size pastFixings_
• std::vector< Date > fixingDates_
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from OneAssetStrikedOption (p. 482).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from OneAssetStrikedOption (p. 482).
Public Attributes
• Average::Type averageType
• double runningProduct
• Size pastFixings
• std::vector< Date > fixingDates
SingleAssetOption
DiscreteGeometricAPO
Todo
add analytical greeks
SingleAssetOption
DiscreteGeometricASO
Todo
add analytical greeks
#include <ql/discretizedasset.hpp>
Inheritance diagram for DiscretizedAsset:
DiscretizedAsset
DiscretizedDiscountBond DiscretizedOption
Protected Attributes
• Time time_
• Array values_
This method will be invoked after rollback and before any other asset (i.e., an option on this one)
has any chance to look at the values. For instance, payments happening at times already spanned
by the rollback will be added here.
This method will be invoked after rollback and after any other asset had their chance to look at
the values. For instance, payments happening at the present time (and therefore not included in
an option to be exercised at this time) will be added here.
Reimplemented in DiscretizedOption (p. 263).
DiscretizedAsset
DiscretizedDiscountBond
DiscretizedAsset
DiscretizedOption
Precondition:
The underlying asset must be initialized
Protected Attributes
• Handle< DiscretizedAsset > underlying_
• Exercise::Type exerciseType_
• std::vector< Time > exerciseTimes_
This method will be invoked after rollback and after any other asset had their chance to look at
the values. For instance, payments happening at the present time (and therefore not included in
an option to be exercised at this time) will be added here.
Reimplemented from DiscretizedAsset (p. 261).
Disposable<Foo> bar(int i) {
Foo f(i*2);
return f;
}
Warning:
In order to avoid copies in code such as shown above, the conversion from T to Dispos-
able(p. 264)<T> is destructive, i.e., it does not preserve the state of the original object. There-
fore, it is necessary for the developer to avoid code such as
Disposable<Foo> bar(Foo& f) {
return f;
}
which would likely render the passed object unusable. The correct way to obtain the desired
behavior would be:
Disposable<Foo> bar(Foo& f) {
Foo temp = f;
return temp;
}
TridiagonalOperator
DMinus
D− matricial representation
The differential operator D− discretizes the first derivative with the first-order formula
∂ui ui − ui−1
≈ = D− ui
∂x h
TridiagonalOperator
DPlus
D+ matricial representation
The differential operator D+ discretizes the first derivative with the first-order formula
∂ui ui+1 − ui
≈ = D+ ui
∂x h
TridiagonalOperator
DPlusDMinus
D+ D− matricial representation
The differential operator D+ D− discretizes the second derivative with the second-order formula
Observable
TermStructure
ZeroYieldStructure Observer
DriftTermStructure
Note:
This term structure will remain linked to the original structures, i.e., any changes in the latters
will be reflected in this structure as well.
TermStructure interface
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
TridiagonalOperator
DZero
D0 matricial representation
The differential operator D0 discretizes the first derivative with the second-order formula
Exercise
EarlyExercise
AmericanExercise BermudanExercise
Todo
derive a plain American Exercise(p. 283) class (no earliestDate, no payoffAtExpiry)
• stationary point
– stationary gradient
– maximum number of iterations ....
Public Types
• enum Type { maxIter, statPt, statGd }
• void setPositiveOptimization ()
• bool checkIterationNumber (int iteration)
• bool checkStationaryValue (double fold, double fnew)
• bool checkAccuracyValue (double f)
• bool checkStationaryGradientNorm (double normDiff)
• bool checkAccuracyGradientNorm (double norm)
• bool operator() (int iteration, double fold, double normgold, double fnew, double nor-
mgnew, double normdiff)
test if the number of iteration is not too big and if we don’t
Protected Attributes
• int maxIteration_
Maximum number of iterations.
• double functionEpsilon_
function and gradient epsilons
• double gradientEpsilon_
• int maxIterStatPt_
Maximun number of iterations in stationary state.
• int statState_
Maximun number of iterations in stationary state.
• int endCriteria_
• bool positiveOptimization_
Tree
BinomialTree
EqualJumpsBinomialTree
CoxRossRubinstein Trigeorgis
Protected Attributes
• double dx_
• double pu_
• double pd_
Tree
BinomialTree
EqualProbabilitiesBinomialTree
AdditiveEQPBinomialTree JarrowRudd
Protected Attributes
• double up_
AssertionFailedError
IllegalArgumentError
IllegalResultError
Error IndexError
OutOfMemoryError
PostconditionNotSatisfiedError
PreconditionNotSatisfiedError
The explicit use of this constructor is not advised. Use the QL_FAIL macro instead.
Error function
formula here ... Used to calculate the cumulative normal distribution function
Observable
Index Observer
Xibor
Euribor
Euribor index
Exercise
EuropeanExercise
European exercise.
A European option can only be exercised at one (expiry) date.
SingleAssetOption
EuropeanOption
ContinuousGeometricAPO FdDividendEuropeanOption
Deprecated
use VanillaOption(p. 624) with EuropeanAnalyticEngine
Exercise
EarlyExercise EuropeanExercise
AmericanExercise BermudanExercise
Public Types
• enum Type { American, Bermudan, European }
Protected Attributes
• std::vector< Date > dates_
• Type type_
MixedScheme<Operator>
ExplicitEuler
// copy constructor/assignment
// (these will be provided by the compiler if none is defined)
Operator(const Operator&);
Operator& operator=(const Operator&);
// inspectors
Size size();
// modifiers
void setTime(Time t);
// operator interface
arrayType applyTo(const arrayType&);
static Operator identity(Size size);
// operator algebra
Operator operator*(double, const Operator&);
Operator operator-(const Operator&, const Operator&);
Todo
add Richardson extrapolation
Friends
• class FiniteDifferenceModel< ExplicitEuler< Operator > >
Observer Observable
ShortRateModel
OneFactorModel AffineModel
OneFactorAffineModel TermStructureConsistentModel
CoxIngersollRoss
ExtendedCoxIngersollRoss
Bug
This class was not tested enough to guarantee its functionality.
• double discountBondOption (Option::Type type, double strike, Time maturity, Time bond-
Maturity) const
Dynamics
ExtendedCoxIngersollRoss::Dynamics
Parameter
TermStructureFittingParameter
ExtendedCoxIngersollRoss::FittingParameter
#include <ql/TermStructures/extendeddiscountcurve.hpp>
Inheritance diagram for ExtendedDiscountCurve:
Observable
TermStructure
DiscountStructure
DiscountCurve Observer
ExtendedDiscountCurve
• ExtendedDiscountCurve (const Date &todaysDate, const std::vector< Date > &dates, const
std::vector< DiscountFactor > &dfs, const Calendar &calendar, const RollingConvention
roll, const DayCounter &dayCounter=Actual365())
• Calendar calendar () const
• RollingConvention roll () const
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Returns the forward rate at a specified compound frequency for the given date calculating it from
the zero yield.
Reimplemented from DiscountStructure (p. 252).
FalsePosition
SingleAssetOption
FdBsmOption
FdStepConditionOption
FdAmericanOption
American option.
Bermudan option.
Protected Attributes
• double extraTermInBermudan
SingleAssetOption
FdBsmOption
FdEuropean FdStepConditionOption
FdAmericanOption
Protected Types
• typedef BoundaryCondition< TridiagonalOperator > BoundaryCondition
Protected Attributes
• Size gridPoints_
• double value_
• double delta_
• double gamma_
• Array grid_
• BSMOperator finiteDifferenceOperator_
• Array intrinsicValues_
• std::vector< Handle< BoundaryCondition > > BCs_
• double sMin_
• double center_
• double sMax_
Bug
sometimes yields negative vega when deeply in-the-money
method impliedVolatility() utterly fails
SingleAssetOption
EuropeanOption
FdDividendEuropeanOption
SingleAssetOption
FdBsmOption
FdEuropean
SingleAssetOption
FdBsmOption
FdStepConditionOption
FdAmericanOption
Protected Attributes
• Handle< StandardStepCondition > stepCondition_
• int timeSteps_
Dereferencing
Comparisons
Public Attributes
• typedef< Iterator >::pointer pointer
• typedef< Iterator >::reference reference
Related Functions
Public Types
• typedef Evolver::arrayType arrayType
• typedef Evolver::operatorType operatorType
• typedef BoundaryCondition< operatorType > bcType
• typedef StepCondition< arrayType > conditionType
9.165.2.1 void rollback (arrayType & a, Time from, Time to, Size steps, const Handle<
conditionType > & condition = Handle< conditionType >())
solves the problem between the given times, possibly applying a condition at every step.
Warning:
being this a rollback, from must be a later time than to.
Observable
CashFlow
Coupon
FixedRateCoupon
CashFlow interface
Coupon interface
Inspectors
Visitability
Note:
The amount is not discounted, i.e., it is the actual amount paid at the cash flow date.
Observable
CashFlow
Coupon
FloatingRateCoupon
IndexedCoupon ParCoupon
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
Coupon interface
Inspectors
Visitability
Protected Attributes
• int fixingDays_
• Spread spread_
Observable Observer
LazyObject
Instrument
CapFloor
Floor
Observable
PricingEngine
ForwardEngine
Protected Attributes
• Handle< GenericEngine< ArgumentsType, ResultsType > > originalEngine_
• ArgumentsType ∗ originalArguments_
• const ResultsType ∗ originalResults_
Public Attributes
• double moneyness
• Date resetDate
Observable
PricingEngine
ForwardEngine<ArgumentsType, ResultsType>
ForwardPerformanceEngine
Observable
TermStructure
ForwardRateStructure
ForwardSpreadedTermStructure
9.172.2.1 Rate zeroYieldImpl (Time, bool extrapolate = false) const [protected, virtual]
Returns the zero yield rate for the given date calculating it from the instantaneous forward rate.
Warning:
This is just a default, highly inefficient implementation. Derived classes should implement
their own zeroYield method.
Returns the discount factor for the given date calculating it from the instantaneous forward rate.
Implements TermStructure (p. 595).
Returns the forward rate at a specified compound frequency for the given date calculating it from
the zero yield.
Implements TermStructure (p. 595).
Observable
TermStructure
ForwardRateStructure Observer
ForwardSpreadedTermStructure
Note:
This term structure will remain linked to the original structure, i.e., any changes in the latter
will be reflected in this structure as well.
TermStructure interface
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
9.173.2.2 Rate zeroYieldImpl (Time, bool extrapolate = false) const [protected, virtual]
Warning:
This method must disappear should the spread become a curve
#include <ql/Instruments/forwardvanillaoption.hpp>
Inheritance diagram for ForwardVanillaOption:
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
VanillaOption
ForwardVanillaOption
Public Types
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from OneAssetStrikedOption (p. 482).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from VanillaOption (p. 624).
Calendar
Frankfurt
Frankfurt calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Good Friday
• Easter Monday
• Ascension Thursday
• Whit Monday
• Corpus Christi
• Labour Day, May 1st
• National Day, October 3rd
• Christmas Eve, December 24th
• Christmas, December 25th
• Boxing Day, December 26th
#include <ql/TermStructures/ratehelpers.hpp>
Inheritance diagram for FraRateHelper:
Observer Observable
RateHelper
FraRateHelper
Warning:
This class assumes that the reference date does not change between calls of setTerm-
Structure()(p. 318).
Todo
convexity adjustment should be implemented.
• FraRateHelper (const RelinkableHandle< Quote > &rate, int monthsToStart, int months-
ToEnd, int settlementDays, const Calendar &calendar, RollingConvention convention, const
DayCounter &dayCounter)
• FraRateHelper (double rate, int monthsToStart, int monthsToEnd, int settlementDays, const
Calendar &calendar, RollingConvention convention, const DayCounter &dayCounter)
• double impliedQuote () const
• DiscountFactor discountGuess () const
• void setTermStructure (TermStructure ∗)
sets the term structure to be used for pricing
Warning:
Being a pointer and not a Handle(p. 339), the term structure is not guaranteed to remain
allocated for the whole life of the rate helper. It is responsibility of the programmer to ensure
that the pointer remains valid. It is advised that rate helpers be used only in term structure
constructors, setting the term structure to this, i.e., the one being constructed.
Observer Observable
RateHelper
FuturesRateHelper
Interest-rate futures.
Warning:
This class assumes that the reference date does not change between calls of setTerm-
Structure()(p. 537).
Observer Observable
ShortRateModel TermStructureConsistentModel
TwoFactorModel AffineModel
G2
Bug
This class was not tested enough to guarantee its functionality.
• double discountBondOption (Option::Type type, double strike, Time maturity, Time bond-
Maturity) const
• double swaption (const Swaption::arguments &arguments) const
• DiscountFactor discount (Time t) const
Implied discount curve.
Friends
• class SwaptionPricingFunction
Parameter
TermStructureFittingParameter
G2::FittingParameter
The implementation of the algorithm was inspired by "Numerical Recipes in C", 2nd edition,
Press, Teukolsky, Vetterling, Flannery, chapter 6
Payoff
TypePayoff
StrikedTypePayoff
GapPayoff
#include <ql/Math/gaussianstatistics.hpp>
returns the downside deviation, defined as the square root of the downside variance.
wi (min(0, xi − tar1et))2
P
P .
wi
Precondition:
percentile must be in range [90%-100%)
Precondition:
percentile must be in range [90%-100%)
Precondition:
percentile must be in range 90%-100%
Observable
Index Observer
Xibor
GBPLibor
Statistics tool.
This class accumulates a set of data and returns their statistics (e.g: mean, variance, skewness,
kurtosis, error estimation, percentile, etc.) based on the empirical distribution (no gaussian
assumption)
It doesn’t suffer the numerical instability problem of IncrementalStatistics(p. 360). The downside
is that it stores all samples, thus increasing the memory requirements.
• const std::vector< std::pair< double, double > > & data () const
collected data
Modifiers
• void reset ()
returns the standard deviation σ, defined as the square root of the variance.
The range is passed as a boolean function returning true if the argument belongs to the range or
false otherwise.
The function returns a pair made of the result and the number of observations in the given range.
Precondition:
y must be in the range (0 − 1].
Precondition:
y must be in the range (0 − 1].
Precondition:
weights must be positive or null
Protected Attributes
• ArgumentsType arguments_
• ResultsType results_
Protected Attributes
• Handle< ModelType > model_
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Reimplemented in LatticeShortRateModelEngine (p. 389), LatticeShortRateModelEngine<
CapFloor::arguments, CapFloor::results > (p. 389), and LatticeShortRateModelEngine< Swap-
tion::arguments, Swaption::results > (p. 389).
Todo
add historical annualized volatility
returns the semi deviation, defined as the square root of the semi variance.
returns the downside deviation, defined as the square root of the downside variance.
N h i
E (x − t)2 | x < t .
N−1
Precondition:
percentile must be in range [90%-100%)
Precondition:
percentile must be in range [90%-100%)
E x | x < VaR(p) ,
that is the average of observations below the given percentile p. Also know as conditional
value-at-risk.
See Artzner, Delbaen, Eber and Heath, "Coherent measures of risk", Mathematical Finance 9
(1999)
E [Θ | (−∞, ∞)]
where
1 x<t
(
Θ(x) =
0 x≥t
Results
Greeks
results results
Public Attributes
• double delta
• double gamma
• double theta
• double vega
• double rho
• double dividendRho
Public Types
• typedef Sample< Array > sample_type
Reference-counted pointer.
This class acts as a proxy to a pointer contained in it. Such pointer is owned by the handle, i.e.,
the handle will be responsible for its deletion, unless explicitly stated by the programmer.
A count of the references to the contained pointer is incremented every time a handle is copied,
and decremented every time a handle is deleted or goes out of scope. When the handle owns the
pointer, this mechanism ensures on one hand, that the pointer will not be deallocated as long as
a handle refers to it, and on the other hand, that it will be deallocated when no more handles do.
Note:
The implementation of this class was originally taken from "The C++ Programming Lan-
guage", 3rd ed., B.Stroustrup, Addison-Wesley, 1997.
Warning:
This mechanism will break and result in untimely deallocation of the pointer (and very
possible death of your executable) if two handles are explicitly initialized with the same
pointer, as in
SomeObj* so = new SomeObj;
Handle<SomeObj> h1(so);
Handle<SomeObj> h2 = h1; // this is safe.
Handle<SomeObj> h3(so); // this is definitely not.
It is good practice to create the pointer and immediately pass it to the handle, as in
Handle<SomeObj> h1(new SomeObj); // this is as safe as can be.
When the programmer keeps the ownership of the pointer, as explicitly declared in
SomeObj so;
Handle<SomeObj> h(&so,false);
it is responsibility of the programmer to make sure that the object remain in scope as long
as there are handles pointing to it. Also, the programmer must explicitly delete the object if
required.
Dereferencing
Inspectors
Friends
• class HandleCopier
Calendar
Helsinki
Helsinki calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Epiphany, January 6th
• Good Friday
• Easter Monday
• Ascension Thursday
• Labour Day, May 1st
• Midsummer Eve (Friday between June 18-24)
• Independence Day, December 6th
• Christmas Eve, December 24th
• Christmas, December 25th
• Boxing Day, December 26th
Public Types
• typedef filtering_iterator< const_iterator, DataValidator > const_valid_iterator
bidirectional iterator on non-null history entries
Inspectors
Iterator access
Four different types of iterators are provided, namely, const_iterator, const_valid_iterator, const_data_-
iterator, and const_valid_data_iterator.
const_iterator and const_valid_iterator point to an Entry structure, the difference being that the latter
only iterates over valid entries - i.e., entries whose data are not null. The same difference exists between
const_data_iterator and const_valid_data_iterator which point directly to historical values without
reference to the date they are associated to.
9.192.2.1 History ()
Default constructor
9.192.2.2 History (const Date & firstDate, const Date & lastDate, Iterator begin, Iterator end)
This constructor initializes the history with the given set of values, corresponding to the date
range between firstDate and lastDate included.
Precondition:
begin-end must equal the number of days from firstDate to lastDate included.
9.192.2.3 History (const Date & firstDate, const Date & lastDate, const std::vector< double >
& values)
This constructor initializes the history with the given set of values, corresponding to the date
range between firstDate and lastDate included.
Precondition:
The size of values must equal the number of days from firstDate to lastDate included.
9.192.2.4 History (const std::vector< Date > & dates, const std::vector< double > & values)
This constructor initializes the history with the given set of values, corresponding each to the
element with the same index in the given set of dates. The whole date range between dates[0]
and dates[N-1] will be automatically filled by inserting null values where a date is missing from
the given set.
Precondition:
dates must be sorted.
There can be no pairs (dates[i],values[i]) and (dates[j],values[j]) such that dates[i] ==
dates[j] && values[i] != values[j]. Pairs with dates[i] == dates[j] && values[i]
== values[j] are allowed; the duplicated entries will be discarded.
The size of values must equal the number of days from firstDate to lastDate included.
Public Types
• typedef Entry value_type
• typedef int difference_type
• typedef const Entry ∗ pointer
• typedef const Entry & reference
Random access
Difference
Comparisons
Friends
• class History
Friends
• class const_iterator
Observer Observable
ShortRateModel
OneFactorModel AffineModel
OneFactorAffineModel TermStructureConsistentModel
Vasicek
HullWhite
• double discountBondOption (Option::Type type, double strike, Time maturity, Time bond-
Maturity) const
Parameter
TermStructureFittingParameter
HullWhite::FittingParameter
I::I();
double I::operator() const;
Public Types
• typedef Sample< double > sample_type
Deprecated
initialize with a random number generator instead.
I::I();
double I::operator() const;
Public Types
• typedef Sample< Array > sample_type
Error
IllegalArgumentError
Specialized error.
Thrown upon passing an argument with an illegal value.
Error
IllegalResultError
Specialized error.
Thrown upon obtaining a result outside the allowed range.
MixedScheme<Operator>
ImplicitEuler
// copy constructor/assignment
// (these will be provided by the compiler if none is defined)
Operator(const Operator&);
Operator& operator=(const Operator&);
// inspectors
Size size();
// modifiers
void setTime(Time t);
// operator interface
arrayType solveFor(const arrayType&);
static Operator identity(Size size);
// operator algebra
Operator operator*(double, const Operator&);
Operator operator+(const Operator&, const Operator&);
Friends
• class FiniteDifferenceModel< ImplicitEuler< Operator > >
Observable
TermStructure
DiscountStructure Observer
ImpliedTermStructure
Note:
This term structure will remain linked to the original structure, i.e., any changes in the latter
will be reflected in this structure as well.
TermStructure interface
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable
BlackVolTermStructure
BlackVarianceTermStructure Observer
ImpliedVolTermStructure
Note:
This term structure will remain linked to the original structure, i.e., any changes in the latter
will be reflected in this structure as well.
Warning:
It doesn’t make financial sense to have an asset-dependant implied Vol Term Structure. This
class should be used with term structures that are time dependant only
BlackVolTermStructure interface
• Date referenceDate () const
returns the reference date for which t=0
Observer interface
• void update ()
Visitability
• virtual void accept (AcyclicVisitor &)
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable
CashFlow
Coupon
FloatingRateCoupon Observer
IndexedCoupon
InArrearIndexedCoupon
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
FloatingRateCoupon interface
Visitability
#include <ql/Math/incrementalstatistics.hpp>
Warning:
high moments are numerically unstable for high average/standardDeviation ratios
Inspectors
Modifiers
• void reset ()
resets the data to a null set
Protected Attributes
• Size sampleNumber_
• Size downsideSampleNumber_
• double sampleWeight_
• double downsideSampleWeight_
• double sum_
• double quadraticSum_
• double downsideQuadraticSum_
• double cubicSum_
• double fourthPowerSum_
• double min_
• double max_
returns the standard deviation σ, defined as the square root of the variance.
returns the downside deviation, defined as the square root of the downside variance.
returns the error estimate , defined as the square root of the ratio of the variance to the number
of samples.
Precondition:
weight must be positive or null
Precondition:
weights must be positive or null
Observable
Index
Xibor
Warning:
This method is used for output and comparison between indexes. It is not meant to be used
for writing switch-on-type code.
9.207.2.2 virtual Rate fixing (const Date & fixingDate) const [pure virtual]
Note:
any date passed as arguments must be a value date, i.e., the real calendar date advanced by
a number of settlement days.
Observable
CashFlow
Coupon
FloatingRateCoupon Observer
IndexedCoupon
InArrearIndexedCoupon UpFrontIndexedCoupon
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
CashFlow interface
Coupon interface
FloatingRateCoupon interface
Inspectors
Observer interface
• void update ()
Visitability
Note:
The amount is not discounted, i.e., it is the actual amount paid at the cash flow date.
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Error
IndexError
Specialized error.
Thrown upon accessing an array or container outside its range.
Observable Observer
LazyObject
Instrument
BasketOption OneAssetStrikedOption
ForwardVanillaOption QuantoVanillaOption
Inspectors
Modifiers
Protected Attributes
• Handle< PricingEngine > engine_
Results
The value of this attribute and any other that derived classes might declare must be set during calculation.
• double NPV_
• double errorEstimate_
Warning:
calling this method will have no effects in case the performCalculation method was overrid-
den in a derived class.
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented in DiscreteAveragingAsianOption (p. 256), BarrierOption (p. 137), Basket-
Option (p. 140), CapFloor (p. 196), ForwardVanillaOption (p. 316), MultiAssetOption (p. 452),
OneAssetOption (p. 478), OneAssetStrikedOption (p. 482), QuantoForwardVanillaOption
(p. 525), QuantoVanillaOption (p. 531), SimpleSwap (p. 557), and Swaption (p. 585).
This method performs all needed calculations by calling the performCalculations method.
Warning:
Objects cache the results of the previous calculation. Such results will be returned upon
later invocations of calculate. When the results depend on arguments which could change
between invocations, the lazy object must register itself as observer of such objects for the
calculations to be performed again when they change.
Should this method be redefined in derived classes, LazyObject::calculate()(p. 392) should
be called in the overriding method.
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented in MultiAssetOption (p. 452), OneAssetOption (p. 478), QuantoVanillaOption
(p. 531), and Swap (p. 582).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Implements LazyObject (p. 392).
Reimplemented in DiscreteAveragingAsianOption (p. 256), BarrierOption (p. 137), Basket-
Option (p. 141), ForwardVanillaOption (p. 316), MultiAssetOption (p. 452), OneAssetOption
(p. 478), OneAssetStrikedOption (p. 482), QuantoVanillaOption (p. 531), Stock (p. 574), Swap
(p. 582), Swaption (p. 586), and VanillaOption (p. 624).
Observable
PricingEngine
VanillaEngine
IntegralEngine
Todo
define tolerance for calculate()
Interpolation
Public Types
• typedef double argument_type
• typedef double result_type
Interpolation2D
BicubicSpline BilinearInterpolation
Public Types
• typedef double first_argument_type
• typedef double second_argument_type
• typedef double result_type
Interpolation2DImpl
Interpolation2D::templateImpl
template<class I1, class I2, class M> class QuantLib::Interpolation2D::templateImpl< I1, I2, M
>
Protected Attributes
• I1 xBegin_
• I1 xEnd_
• I2 yBegin_
• I2 yEnd_
• const M & zData_
Interpolation2DImpl
templateImpl
InterpolationImpl
Interpolation::templateImpl
Protected Attributes
• I1 xBegin_
• I1 xEnd_
• I2 yBegin_
InterpolationImpl
templateImpl
Observable
PricingEngine
JamshidianSwaption
Friends
• class rStarFinder
Tree
BinomialTree
EqualProbabilitiesBinomialTree
JarrowRudd
Calendar
Johannesburg
Johannesburg calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st (possibly moved to Monday)
• Good Friday
• Family Day, Easter Monday
• Human Rights Day, March 21st (possibly moved to Monday)
• Freedom Day, April 27th (possibly moved to Monday)
• Workers Day, May 1st (possibly moved to Monday)
• Youth Day, June 16th (possibly moved to Monday)
• National Women’s Day, August 9th (possibly moved to Monday)
• Heritage Day, September 24th (possibly moved to Monday)
• Day of Reconciliation, December 16th (possibly moved to Monday)
• Christmas December 25th
Calendar
JointCalendar
Joint calendar.
Depending on the chosen rule, this calendar has a set of business days given by either the union
or the intersection of the sets of business days of the given calendars.
Observable
Index Observer
Xibor
JPYLibor
Todo
check settlement days
Note:
This is not Knuth’s original implementation which is available at
http://www-cs-faculty.stanford.edu/∼knuth/programs.html, but rather a slightly
modified version wrapped in a C++ class. Such modifications did not affect the code but
only the data structures used, which were converted to their standard C++ equivalents.
Public Types
• typedef Sample< double > sample_type
returns a sample with weight 1.0 containing a random number uniformly chosen from (0.0,1.0)
NumericalMethod
Lattice
ShortRateTree
• void rollback (const Handle< DiscretizedAsset > &asset, Time to) const
• void rollAlmostBack (const Handle< DiscretizedAsset > &asset, Time to) const
• virtual Size size (Size i) const=0
• virtual DiscountFactor discount (Size i, Size index) const=0
Discount factor at time t_i and node indexed by index.
Protected Attributes
• std::vector< Array > statePrices_
9.227.2.1 void rollback (const Handle< DiscretizedAsset > & asset, Time to) const
[virtual]
Roll back a DiscretizedAsset(p. 260) object until a certain time, performing any needed adjustment
Implements NumericalMethod (p. 470).
9.227.2.2 void rollAlmostBack (const Handle< DiscretizedAsset > & asset, Time to) const
[virtual]
Roll-back a DiscretizedAsset(p. 260) object until a certain time, but do not perform the final
adjustment.
Implements NumericalMethod (p. 470).
NumericalMethod
Lattice
Lattice2D
ShortRateTree
Two-dimensional lattice.
This lattice is based on two trinomial trees and primarly used for the G2(p. 321) short-rate model.
Protected Attributes
• Handle< Tree > tree1_
• Handle< Tree > tree2_
Observable
PricingEngine
LatticeShortRateModelEngine
Protected Attributes
• TimeGrid timeGrid_
• Size timeSteps_
• Handle< Lattice > lattice_
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Observable Observer
LazyObject
Instrument PiecewiseFlatForward
BasketOption OneAssetStrikedOption
ForwardVanillaOption QuantoVanillaOption
Calculations
These methods do not modify the structure of the object and are therefore declared as const. Data
members which will be calculated on demand need to be declared as mutable.
• void recalculate ()
• void freeze ()
• void unfreeze ()
• virtual void calculate () const
• virtual void performCalculations () const=0
• void update ()
Protected Attributes
• bool calculated_
• bool frozen_
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
This method force the recalculation of any results which would otherwise be cached. It is not
declared as const since it needs to call the non-const notifyObservers method.
Note:
Explicit invocation of this method is not necessary if the object registered itself as observer
with the structures on which such results depend. It is strongly advised to follow this policy
when possible.
This method constrains the object to return the presently cached results on successive invocations,
even if arguments upon which they depend should change.
This method reverts the effect of the freeze method, thus re-enabling recalculations.
This method performs all needed calculations by calling the performCalculations method.
Warning:
Objects cache the results of the previous calculation. Such results will be returned upon
later invocations of calculate. When the results depend on arguments which could change
between invocations, the lazy object must register itself as observer of such objects for the
calculations to be performed again when they change.
Should this method be redefined in derived classes, LazyObject::calculate()(p. 392) should
be called in the overriding method.
This method must implement any calculations which must be (re)done in order to calculate the
desired results.
CostFunction
LeastSquareFunction
• virtual ∼LeastSquareFunction ()
Destructor.
Protected Attributes
• LeastSquareProblem & lsp_
least square problem
• virtual void targetAndValue (const Array &x, Array &target, Array &fct2fit)=0
compute the target vector and the values of the fonction to fit
• virtual void targetValueAndGradient (const Array &x, Matrix &grad_fct2fit, Array &target,
Array &fct2fit)=0
9.232.2.1 virtual void targetValueAndGradient (const Array & x, Matrix & grad_fct2fit, Array
& target, Array & fct2fit) [pure virtual]
compute the target vector, the values of the fonction to fit and the matrix of derivatives
Public Types
• typedef Sample< double > sample_type
returns a sample with weight 1.0 containing a random number uniformly chosen from (0.0,1.0)
Tree
BinomialTree
LeisenReimer
Protected Attributes
• double up_
• double down_
• double pu_
• double pd_
Public Types
• typedef RandomAccessIterator x_iterator
iterates over vi j with j fixed.
Element access
Iterator access
Inspectors
Interpolation
LinearInterpolation
9.237.2.1 LinearInterpolation (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin)
Precondition:
the x values must be sorted.
LineSearch
ArmijoLineSearch
• virtual ∼LineSearch ()
Destructor.
• double lastFunctionValue ()
return last cost function value
• double lastGradientNorm2 ()
return square norm of last gradient
• bool succeed ()
• virtual double operator() (const Problem &P, double t_ini)=0
Perform line search.
• double update (Array ¶ms, const Array &direction, double beta, const Constraint
&constraint)
Protected Attributes
• Array xtd_
new x and its gradient
• Array gradient_
new x and its gradient
• double qt_
cost function value and gradient norm corresponding to xtd_
• double qpt_
cost function value and gradient norm corresponding to xtd_
• bool succeed_
flag to know if linesearch succeed
Observable Observer
Link
Precondition:
Class "Type" must inherit from Observable(p. 471)
• void update ()
Observer(p. 473) interface.
9.239.2.1 Link (const Handle< Type > & h = Handle< Type >(), bool registerAsObserver =
true) [explicit]
Warning:
see the documentation of the linkTo method for issues relatives to registerAsObserver.
9.239.3.1 void linkTo (const Handle< Type > & h, bool registerAsObserver = true)
Warning:
registerAsObserver is left as a backdoor in case the programmer cannot guarantee that the
object pointed to will remain alive for the whole lifetime of the handle—namely, it should be
set to false when the passed handle was created with owns = false (the latter should only
happen in a controlled environment, so that the programmer is aware of it). Failure to do so
can very likely result in a program crash. If the programmer does want the relinkable handle
to register as observer of such a handle, it is his responsibility to ensure that the relinkable
handle gets destroyed before the pointed object does.
#include <ql/Volatilities/localconstantvol.hpp>
Inheritance diagram for LocalConstantVol:
Observable
LocalVolTermStructure Observer
LocalConstantVol
LocalVolTermStructure interface
Observer interface
• void update ()
Visitability
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
#include <ql/Volatilities/localvolcurve.hpp>
Inheritance diagram for LocalVolCurve:
Observable
LocalVolTermStructure Observer
LocalVolCurve
LocalVolTermStructure interface
Observer interface
• void update ()
Visitability
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
9.241.2.2 double localVolImpl (Time t, double dummy, bool extrapolate) const [protected,
virtual]
The relation Z T
σ2L (t)dt = σ2B T
0
holds, where σL (t) is the local volatility at time t and σB (T) is the Black volatility for maturity T.
From the above, the formula r
d 2
σL (t) = σ (t)t
dt B
can be deduced which is here implemented.
Implements LocalVolTermStructure (p. 412).
Observable
LocalVolTermStructure Observer
LocalVolSurface
Bug
This class is untested, probably unreliable.
LocalVolTermStructure interface
• Date referenceDate () const
returns the reference date for which t=0
Observer interface
• void update ()
Visitability
• virtual void accept (AcyclicVisitor &)
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable
LocalVolTermStructure
Dates
• virtual Date referenceDate () const=0
returns the reference date for which t=0
Visitability
• virtual void accept (AcyclicVisitor &)
Interpolation
LogLinearInterpolation
Todo
Implement primitive, derivative, and secondDerivative functions.
9.245.2.1 LogLinearInterpolation (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin)
Precondition:
the x values must be sorted.
Calendar
London
London calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st (possibly moved to Monday)
• Good Friday
• Easter Monday
• Early May Bank Holiday, first Monday of May
• Spring Bank Holiday, last Monday of May
• Summer Bank Holiday, last Monday of August
• Christmas, December 25th (possibly moved to Monday or Tuesday)
• Boxing Day, December 26th (possibly moved to Monday or Tuesday)
See http://www.dti.gov.uk/er/bankhol.htm
helper class
This class provides a more comfortable interface to the argument list of Schedule’s constructor.
Public Types
• typedef double ∗ iterator
• typedef const double ∗ const_iterator
• typedef double ∗ row_iterator
• typedef const double ∗ const_row_iterator
• typedef stepping_iterator< double ∗ > column_iterator
• typedef stepping_iterator< const double ∗ > const_column_iterator
• Matrix ()
creates a null matrix
Algebraic operators
Iterator access
Element access
Inspectors
Utilities
Related Functions
• const Disposable< Matrix > rankReducedSqrt (const Matrix &, Size maxRank, double
componentRetainedPercentag, SalvagingAlgorithm::Type)
• const Disposable< Matrix > matrixSqrt (const Matrix &)
Precondition:
all matrices involved in an algebraic expression must have the same size.
Precondition:
the given matrix must be symmetric.
Todo
a) implement Hypersphere decomposition: 1) Jäckel "Monte Carlo Methods in Finance",
Chapter 6 2) Brigo "A Note on Correlation and Rank Reduction" 3) Rapisarda, Brigo, Mercurio
"Parameterizing correlations: a geometric interpretation" b) implement Higham algorithm:
Higham "Computing the nearest correlation matrix"
9.249.3.2 const Disposable< Matrix > rankReducedSqrt (const Matrix &, Size maxRank,
double componentRetainedPercentag, SalvagingAlgorithm::Type) [related]
Precondition:
the given matrix must be symmetric.
9.249.3.3 const Disposable< Matrix > matrixSqrt (const Matrix &) [related]
Deprecated
use CholeskyDecomposition or pseudoSqrt instead
Observable
PricingEngine
BasketEngine
MCAmericanBasketEngine
Warning:
This method is intrinsically weak for out-of-the-money options.
Bug
This engine does not yet work for put options. More problems might surface.
Observable
PricingEngine
MCBarrierEngine
Protected Types
• typedef McSimulation< SingleAsset< RNG >, S >::path_generator_type path_generator_-
type
• typedef McSimulation< SingleAsset< RNG >, S >::path_pricer_type path_pricer_type
• typedef McSimulation< SingleAsset< RNG >, S >::stats_type stats_type
Protected Attributes
• Size maxTimeStepsPerYear_
• Size requiredSamples_
• Size maxSamples_
• double requiredTolerance_
• bool isBiased_
• long seed_
McBasket
Observable
PricingEngine
MCBasketEngine
Public Types
• typedef McSimulation< MultiAsset< RNG >, S >::path_generator_type path_generator_-
type
• typedef McSimulation< MultiAsset< RNG >, S >::path_pricer_type path_pricer_type
• typedef McSimulation< MultiAsset< RNG >, S >::stats_type stats_type
Protected Attributes
• Size maxTimeStepsPerYear_
• Size requiredSamples_
• Size maxSamples_
• double requiredTolerance_
• bool brownianBridge_
• long seed_
McCliquetOption
Observable
PricingEngine
MCVanillaEngine<RNG,S>
MCDigitalEngine
Public Types
• typedef MCVanillaEngine< RNG, S >::path_generator_type path_generator_type
• typedef MCVanillaEngine< RNG, S >::path_pricer_type path_pricer_type
• typedef MCVanillaEngine< RNG, S >::stats_type stats_type
McDiscreteArithmeticAPO
Todo
Continous-averaging version
McDiscreteArithmeticASO
Todo
Continous Averaging version
Observable
PricingEngine
MCVanillaEngine<RNG,S>
MCEuropeanEngine
Public Types
• typedef MCVanillaEngine< RNG, S >::path_generator_type path_generator_type
• typedef MCVanillaEngine< RNG, S >::path_pricer_type path_pricer_type
• typedef MCVanillaEngine< RNG, S >::stats_type stats_type
McEverest
McHimalaya
McMaxBasket
McPagoda
McPerformanceOption
Protected Attributes
• Handle< MonteCarloModel< MC, S > > mcModel_
Public Types
• typedef MonteCarloModel< MC, S >::path_generator_type path_generator_type
• typedef MonteCarloModel< MC, S >::path_pricer_type path_pricer_type
• typedef MonteCarloModel< MC, S >::stats_type stats_type
Protected Attributes
• Handle< MonteCarloModel< MC, S > > mcModel_
• bool antitheticVariate_
• bool controlVariate_
Observable
PricingEngine
MCVanillaEngine
Protected Types
• typedef McSimulation< SingleAsset< RNG >, S >::path_generator_type path_generator_-
type
• typedef McSimulation< SingleAsset< RNG >, S >::path_pricer_type path_pricer_type
• typedef McSimulation< SingleAsset< RNG >, S >::stats_type stats_type
Protected Attributes
• Size maxTimeStepsPerYear_
• Size requiredSamples_
• Size maxSamples_
• double requiredTolerance_
• long seed_
Public Types
• typedef Sample< double > sample_type
returns a sample with weight 1.0 containing a random number on (0.0, 1.0)-real-interval
Calendar
Milan
Milan calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Epiphany, January 6th
• Easter Monday
• Liberation Day, April 25th
• Labour Day, May 1st
• Republic Day, June 2nd (since 2000)
• Assumption, August 15th
• All Saint’s Day, November 1st
• Immaculate Conception, December 8th
• Christmas, December 25th
• St. Stephen, December 26th
MixedScheme
// copy constructor/assignment
// (these will be provided by the compiler if none is defined)
Operator(const Operator&);
Operator& operator=(const Operator&);
// inspectors
Size size();
// modifiers
void setTime(Time t);
// operator interface
arrayType applyTo(const arrayType&);
arrayType solveFor(const arrayType&);
static Operator identity(Size size);
// operator algebra
Operator operator*(double, const Operator&);
Operator operator+(const Operator&, const Operator&);
Operator operator+(const Operator&, const Operator&);
Warning:
The differential operator must be linear for this evolver to work.
Todo
a) derive variable theta schemes b) introduce multi time-level schemes.
Protected Types
• typedef Operator::arrayType arrayType
• typedef Operator operatorType
• typedef BoundaryCondition< Operator > bcType
Protected Attributes
• Operator L_
• Operator I_
• Operator explicitPart_
• Operator implicitPart_
• Time dt_
• double theta_
• std::vector< Handle< bcType > > bcs_
Friends
• class FiniteDifferenceModel< MixedScheme< Operator > >
Interpolation
CubicSpline
MonotonicCubicSpline
9.270.2.1 MonotonicCubicSpline (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin,
CubicSpline::BoundaryCondition leftCondition, double leftConditionValue,
CubicSpline::BoundaryCondition rightCondition, double rightConditionValue)
Precondition:
the x values must be sorted.
Public Types
• typedef mc_traits::rsg_type rsg_type
• typedef mc_traits::path_generator_type path_generator_type
• typedef mc_traits::path_pricer_type path_pricer_type
• typedef path_generator_type::sample_type sample_type
• typedef path_pricer_type::result_type result_type
• typedef stats_traits stats_type
Results
MoreGreeks
results
Public Attributes
• double itmCashProbability
• double deltaForward
• double elasticity
• double thetaPerDay
• double strikeSensitivity
Observable Observer
LazyObject
Instrument
Option
MultiAssetOption
BasketOption
Instrument interface
• bool isExpired () const
returns whether the instrument is still tradable.
greeks
• double delta () const
• double gamma () const
• double theta () const
• double vega () const
• double rho () const
• double dividendRho () const
Protected Attributes
• double delta_
• double gamma_
• double theta_
• double vega_
• double rho_
• double dividendRho_
• std::vector< Handle< BlackScholesStochasticProcess > > blackScholesProcesses_
• Matrix correlation_
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument (p. 368).
Reimplemented in BasketOption (p. 140).
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented from Instrument (p. 369).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from Instrument (p. 369).
Reimplemented in BasketOption (p. 141).
Arguments
arguments
MultiAssetOption::arguments
arguments
Public Attributes
• std::vector< Handle< BlackScholesStochasticProcess > > blackScholesProcesses
• Matrix correlation
Results
Value Greeks
MultiAssetOption::results
Todo
a) make it time-aware b) rename it as MultiAssetPath
inspectors
RAG{
RAG();
RAG(Matrix& covariance,
long seed);
Sample<Array> next();
};
Todo
why store correlation Matrix(p. 418) rather than covariance?
Public Types
• typedef Sample< MultiPath > sample_type
RAG{
RAG();
RAG(Matrix& covariance,
long seed);
Sample<Array> next();
};
Public Types
• typedef Sample< MultiPath > sample_type
Interpolation
CubicSpline
NaturalCubicSpline
9.280.2.1 NaturalCubicSpline (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin)
Precondition:
the x values must be sorted.
Interpolation
CubicSpline
NaturalMonotonicCubicSpline
9.281.2.1 NaturalMonotonicCubicSpline (const I1 & xBegin, const I1 & xEnd, const I2 &
yBegin)
Precondition:
the x values must be sorted.
NeumannBC
Warning:
The value passed must not be the value of the derivative. Instead, it must be comprehensive
of the grid step between the first two points–i.e., it must be the difference between f[0] and
f[1].
Todo
generalize to time-dependent conditions.
This method sets the current time for time-dependent boundary conditions.
Implements BoundaryCondition< TridiagonalOperator > (p. 173).
Newton
Note:
This solver requires that the passed function object implement a method double
derivative(double).
NewtonSafe
Note:
This solver requires that the passed function object implement a method double
derivative(double).
Calendar
NewYork
• Saturdays
• Sundays
• New Year’s Day, January 1st (possibly moved to Monday if actually on Sunday, or to Friday
if on Saturday)
• Martin Luther King’s birthday, third Monday in January
• Washington’s birthday, third Monday in February
• Good Friday
• Memorial Day, last Monday in May
• Independence Day, July 4th (moved to Monday if Sunday or Friday if Saturday)
• Labor Day, first Monday in September
Constraint
NoConstraint
No constraint.
• ∼NonLinearLeastSquare ()
Destructor.
• double residualNorm ()
return the least square residual norm
• double lastValue ()
return last function value
• int exitFlag ()
return exit flag
• int iterationsNumber ()
return the performed number of iterations
Calendar
NullCalendar
Parameter
NullParameter
NumericalMethod
Lattice
ShortRateTree
Protected Attributes
• TimeGrid t_
#include <ql/Patterns/observable.hpp>
Inheritance diagram for Observable:
AffineModel
BlackModel
BlackVolTermStructure
CalibrationHelper
CapFlatVolatilityStructure
CapletForwardVolatilityStructure
CashFlow
Index
LazyObject
Link
LocalVolTermStructure
PricingEngine
Quote
RateHelper
ShortRateModel
StochasticProcess
SwaptionVolatilityStructure
TermStructure
TermStructureConsistentModel
• void notifyObservers ()
Friends
• class Observer
This method should be called at the end of non-const methods or when the programmer desires
to notify any changes.
#include <ql/Patterns/observable.hpp>
Inheritance diagram for Observer:
AffineTermStructure
BlackConstantVol
BlackModel
BlackVarianceCurve
BlackVarianceSurface
CalibrationHelper
CompositeQuote
DerivedQuote
DriftTermStructure
ExtendedDiscountCurve
ForwardSpreadedTermStructure
GenericModelEngine
Observer ImpliedTermStructure
ImpliedVolTermStructure
IndexedCoupon
LazyObject
Link
LocalConstantVol
LocalVolCurve
LocalVolSurface
ParCoupon
QuantoTermStructure
RateHelper
ShortRateModel
StochasticProcess
Xibor
ZeroSpreadedTermStructure
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implemented in IndexedCoupon (p. 365), ParCoupon (p. 500), Xibor (p. 632), DerivedQuote
(p. 245), CompositeQuote (p. 212), LazyObject (p. 392), BlackModel (p. 159), GenericModel-
Engine (p. 333), LatticeShortRateModelEngine (p. 389), Link (p. 404), CalibrationHelper
(p. 190), ShortRateModel (p. 551), StochasticProcess (p. 573), AffineTermStructure (p. 114),
DriftTermStructure (p. 270), ExtendedDiscountCurve (p. 289), ForwardSpreadedTermStructure
(p. 314), ImpliedTermStructure (p. 356), QuantoTermStructure (p. 529), RateHelper (p. 537),
ZeroSpreadedTermStructure (p. 637), BlackConstantVol (p. 156), BlackVarianceCurve (p. 165),
BlackVarianceSurface (p. 167), ImpliedVolTermStructure (p. 358), LocalConstantVol (p. 407),
LocalVolCurve (p. 409), LocalVolSurface (p. 411), GenericModelEngine< ShortRateModel, Ar-
guments, Results > (p. 333), GenericModelEngine< BlackModel, CapFloor::arguments, Cap-
Floor::results > (p. 333), GenericModelEngine< OneFactorAffineModel, Swaption::arguments,
Swaption::results > (p. 333), GenericModelEngine< AffineModel, CapFloor::arguments, Cap-
Floor::results > (p. 333), GenericModelEngine< ShortRateModel, CapFloor::arguments, Cap-
Floor::results > (p. 333), GenericModelEngine< BlackModel, Swaption::arguments, Swap-
tion::results > (p. 333), GenericModelEngine< ShortRateModel, Swaption::arguments, Swap-
tion::results > (p. 333), LatticeShortRateModelEngine< CapFloor::arguments, CapFloor::results
> (p. 389), LatticeShortRateModelEngine< Swaption::arguments, Swaption::results > (p. 389),
Link< LocalVolTermStructure > (p. 404), Link< BlackVarianceCurve > (p. 404), Link< Black-
VolTermStructure > (p. 404), Link< TermStructure > (p. 404), and Link< Quote > (p. 404).
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
ForwardVanillaOption QuantoVanillaOption
QuantoForwardVanillaOption
Instrument interface
greeks
Protected Attributes
• double delta_
• double deltaForward_
• double elasticity_
• double gamma_
• double theta_
• double thetaPerDay_
• double vega_
• double rho_
• double dividendRho_
• double itmCashProbability_
• Handle< BlackScholesStochasticProcess > blackScholesProcess_
Warning:
currently, this method returns the Black-Scholes implied volatility. It will give unconsistent
results if the pricing was performed with any other methods (such as jump-diffusion models.)
options with a gamma that changes sign have values that are not monotonic in the volatility,
e.g binary options. In these cases the calculation can fail and the result (if any) is almost
meaningless. Another possible source of failure is to have a target value that is not attainable
with any volatility, e.g., a target value lower than the intrinsic value in the case of American
options.
Bug
run-time crashes are possible with the Borland compiler
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument (p. 368).
Reimplemented in DiscreteAveragingAsianOption (p. 256), BarrierOption (p. 137), Forward-
VanillaOption (p. 316), OneAssetStrikedOption (p. 482), QuantoForwardVanillaOption
(p. 525), and QuantoVanillaOption (p. 531).
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented from Instrument (p. 369).
Reimplemented in QuantoVanillaOption (p. 531).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from Instrument (p. 369).
Reimplemented in DiscreteAveragingAsianOption (p. 256), BarrierOption (p. 137), Forward-
VanillaOption (p. 316), OneAssetStrikedOption (p. 482), QuantoVanillaOption (p. 531), and
VanillaOption (p. 624).
Arguments
arguments
OneAssetOption::arguments
Public Attributes
• Handle< BlackScholesStochasticProcess > blackScholesProcess
Results
OneAssetOption::results
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
ForwardVanillaOption QuantoVanillaOption
QuantoForwardVanillaOption
greeks
Protected Attributes
• double strikeSensitivity_
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from OneAssetOption (p. 478).
Reimplemented in DiscreteAveragingAsianOption (p. 256), BarrierOption (p. 137), Forward-
VanillaOption (p. 316), QuantoForwardVanillaOption (p. 525), and QuantoVanillaOption
(p. 531).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from OneAssetOption (p. 478).
Reimplemented in DiscreteAveragingAsianOption (p. 256), BarrierOption (p. 137), Forward-
VanillaOption (p. 316), QuantoVanillaOption (p. 531), and VanillaOption (p. 624).
Observer Observable
ShortRateModel
OneFactorModel AffineModel
OneFactorAffineModel
CoxIngersollRoss Vasicek
ExtendedCoxIngersollRoss HullWhite
Observer Observable
ShortRateModel
OneFactorModel
BlackKarasinski OneFactorAffineModel
CoxIngersollRoss Vasicek
ExtendedCoxIngersollRoss HullWhite
NumericalMethod
Lattice
OneFactorModel::ShortRateTree
• ShortRateTree (const Handle< Tree > &tree, const Handle< ShortRateDynamics > &dy-
namics, const Handle< TermStructureFittingParameter::NumericalImpl > &phi, const
TimeGrid &timeGrid)
Tree(p. 607) build-up + numerical fitting to term-structure.
TridiagonalOperator
OneFactorOperator
OptimizationMethod
Protected Attributes
• Array initialValue_
initial value of unknowns
• int iterationNumber_
current iteration step in the Optimization process
• EndCriteria endCriteria_
optimization end criteria
• int functionEvaluation_
number of evaluation of cost function and its gradient
• int gradientEvaluation_
number of evaluation of cost function and its gradient
• double functionValue_
function and gradient norm values of the last step
• double squaredNorm_
function and gradient norm values of the last step
• Array x_
current values of the local minimum and the search direction
• Array searchDirection_
current values of the local minimum and the search direction
Observable Observer
LazyObject
Instrument
Option
BasketOption OneAssetStrikedOption
ForwardVanillaOption QuantoVanillaOption
QuantoForwardVanillaOption
Public Types
• enum Type { Call, Put, Straddle }
Protected Attributes
• Handle< Payoff > payoff_
• Handle< Exercise > exercise_
Arguments
Option::arguments
arguments
Todo
a) remove std::vector<Time> stoppingTimes b) how to handle strike-less option (asian aver-
age strike, forward, etc.)?
Public Attributes
• Handle< Payoff > payoff
• Handle< Exercise > exercise
• std::vector< Time > stoppingTimes
#include <ql/diffusionprocess.hpp>
Inheritance diagram for OrnsteinUhlenbeckProcess:
DiffusionProcess
OrnsteinUhlenbeckProcess
dx = −axt dt + σdWt .
9.308.2.2 double expectation (Time t0, double x0, Time dt) const [virtual]
9.308.2.3 double variance (Time t0, double x0, Time dt) const [virtual]
Calendar
Oslo
Oslo calendar
Holidays:
• Saturdays
• Sundays
• Holy Thursday
• Good Friday
• Easter Monday
• Ascension
• Whit(Pentecost) Monday
• New Year’s Day, January 1st
• May Day, May 1st
• National Independence Day, May 17st
• Christmas, December 25th
• Boxing Day, December 26th
Error
OutOfMemoryError
Specialized error.
Thrown upon failed allocation.
Parameter
Protected Attributes
• Array params_
• Constraint constraint_
Observable
CashFlow
Coupon
FloatingRateCoupon Observer
ParCoupon
ShortFloatingRateCoupon
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
CashFlow interface
Coupon interface
FloatingRateCoupon interface
Inspectors
Observer interface
• void update ()
Visitability
Note:
The amount is not discounted, i.e., it is the actual amount paid at the cash flow date.
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Todo
should Path(p. 501) include the t=0.0 point? Alternatively all path pricers must be revisited.
inspectors
Public Types
• typedef Sample< Path > sample_type
inspectors
Deprecated
use PathGenerator(p. 502) instead
Public Types
• typedef Sample< Path > sample_type
inspectors
9.316.2.1 PathGenerator_old (double drift, double variance, const TimeGrid & times, long
seed = 0)
Warning:
the initial time is assumed to be zero and must not be included in the passed vector
Protected Attributes
• RelinkableHandle< TermStructure > riskFreeTS_
Deprecated
use PathPricer(p. 504) instead
Protected Attributes
• DiscountFactor discount_
• bool useAntitheticVariance_
Payoff
TypePayoff
StrikedTypePayoff
Payoff
TypePayoff
StrikedTypePayoff
PercentageStrikePayoff
Performance option.
A performance option is a variant of a cliquet option: the payoff of each forward-starting (a.k.a.
deferred strike) options is $ max(S/X- 1) $.
Related Functions
Parameter
PiecewiseConstantParameter
Piecewise-constant parameter.
a(t) = ai i f ti−1 ≥ t < ti . This kind of parameter is usually used to enhance the fitting of a model
Observable Observer
TermStructure LazyObject
PiecewiseFlatForward
Warning:
The bootstrapping algorithm will raise an exception if any two instruments have the same
maturity date.
TermStructure interface
Friends
• class FFObjFunction
9.324.2.1 PiecewiseFlatForward (const Date & todaysDate, const std::vector< Date > & dates,
const std::vector< Rate > & forwards, const DayCounter & dayCounter)
In this constructor, the first date must be the reference date of the curve, the other dates are
the nodes of the term structure. The forward rate at index i is used in the period ti−1 < t ≤ ti .
Therefore, forwards[0] is used only to compute the zero yield for t = 0.
Payoff
TypePayoff
StrikedTypePayoff
PlainVanillaPayoff
Plain-vanilla payoff.
Constraint
PositiveConstraint
Error
PostconditionNotSatisfiedError
Specialized error.
Thrown upon an unsatisfied postcondition.
Error
PreconditionNotSatisfiedError
Specialized error.
Thrown upon an unsatisfied precondition.
GenericEngine
Protected Attributes
• CostFunction & costFunction_
Unconstrained cost function.
Public Types
• typedef UnaryFunction::result_type value_type
• typedef const value_type ∗ pointer
• typedef const value_type & reference
Dereferencing
Random access
Difference
Comparisons
Public Attributes
• typedef< Iterator >::difference_type difference_type
Related Functions
Observable
PricingEngine
QuantoEngine
Protected Attributes
• Handle< GenericEngine< ArgumentsType, ResultsType > > originalEngine_
• ArgumentsType ∗ originalArguments_
• const ResultsType ∗ originalResults_
#include <ql/Instruments/quantoforwardvanillaoption.hpp>
Inheritance diagram for QuantoForwardVanillaOption:
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
VanillaOption
QuantoVanillaOption
QuantoForwardVanillaOption
Public Types
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from QuantoVanillaOption (p. 531).
Public Attributes
• double correlation
• RelinkableHandle< TermStructure > foreignRiskFreeTS
• RelinkableHandle< BlackVolTermStructure > exchRateVolTS
Public Attributes
• double qvega
• double qrho
• double qlambda
Observable
TermStructure
ZeroYieldStructure Observer
QuantoTermStructure
Note:
This term structure will remain linked to the original structures, i.e., any changes in the latters
will be reflected in this structure as well.
TermStructure interface
• DayCounter dayCounter () const
the day counter used for date/time conversion
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
#include <ql/Instruments/quantovanillaoption.hpp>
Inheritance diagram for QuantoVanillaOption:
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
VanillaOption
QuantoVanillaOption
QuantoForwardVanillaOption
Public Types
greeks
Protected Attributes
• RelinkableHandle< TermStructure > foreignRiskFreeTS_
• RelinkableHandle< BlackVolTermStructure > exchRateVolTS_
• RelinkableHandle< Quote > correlation_
• double qvega_
• double qrho_
• double qlambda_
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from OneAssetStrikedOption (p. 482).
Reimplemented in QuantoForwardVanillaOption (p. 525).
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented from OneAssetOption (p. 478).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from VanillaOption (p. 624).
Observable
Quote
Deprecated
use RandomSequenceGenerator(p. 534) instead.
Public Types
• typedef Sample< Array > sample_type
Warning:
do not use with low-discrepancy sequence generator
Public Types
• typedef Sample< Array > sample_type
#include <ql/TermStructures/ratehelpers.hpp>
Inheritance diagram for RateHelper:
Observer Observable
RateHelper
RateHelper interface
Observer interface
• void update ()
Protected Attributes
Warning:
Being a pointer and not a Handle(p. 339), the term structure is not guaranteed to remain
allocated for the whole life of the rate helper. It is responsibility of the programmer to ensure
that the pointer remains valid. It is advised that rate helpers be used only in term structure
constructors, setting the term structure to this, i.e., the one being constructed.
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
RelinkableHandle
Precondition:
Class "Type" must inherit from Observable(p. 471)
9.345.2.1 RelinkableHandle (const Handle< Type > & h = Handle< Type >(), bool
registerAsObserver = true) [explicit]
Warning:
see the documentation of Link(p. 404) for issues relatives to registerAsObserver.
9.345.3.1 void linkTo (const Handle< Type > & h, bool registerAsObserver = true)
Warning:
see the documentation of Link(p. 404) for issues relatives to registerAsObserver.
Results
Ridder
Public Types
• enum Type { None, Spectral, Hypersphere }
weighted sample
Public Types
• typedef T value_type
Public Attributes
• T value
• double weight
Payment schedule.
Iterators
• typedef std::vector< Date >::const_iterator const_iterator
• const_iterator begin () const
• const_iterator end () const
Date access
Other inspectors
Secant
Public Types
• typedef StatisticsType statistics_type
inspectors
Modifiers
Protected Attributes
• Size dimension_
• std::vector< statistics_type > stats_
• std::vector< double > results_
• Matrix quadraticSum_
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
inhibit calculation
Unlike ParCoupon(p. 499), this coupon can’t calculate its fixing for future dates, either.
Observable
CashFlow
Coupon
FloatingRateCoupon Observer
ParCoupon
ShortFloatingRateCoupon
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
Visitability
Observer Observable
ShortRateModel
OneFactorModel TwoFactorModel
BlackKarasinski OneFactorAffineModel G2
CoxIngersollRoss Vasicek
ExtendedCoxIngersollRoss HullWhite
Protected Attributes
• std::vector< Parameter > arguments_
• Handle< Constraint > constraint_
Friends
• class CalibrationFunction
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
9.356.2.2 void calibrate (const std::vector< Handle< CalibrationHelper > > & instruments,
OptimizationMethod & method, const Constraint & constraint = Constraint())
StandardStepCondition
ShoutCondition
Todo
Unify the intrinsicValues/Payoff thing
Observable
CashFlow
SimpleCashFlow
CashFlow interface
Visitability
Note:
The amount is not discounted, i.e., it is the actual amount paid at the cash flow date.
DayCounter
SimpleDayCounter
Warning:
this day counter should be used together with NullCalendar(p. 468), which ensures that
dates at whole-month distances share the same day of month. It is not guaranteed to work
with any other calendar.
Observable
Quote
SimpleQuote
Quote interface
Modifiers
#include <ql/Instruments/simpleswap.hpp>
Inheritance diagram for SimpleSwap:
Observable Observer
LazyObject
Instrument
Swap
SimpleSwap
• SimpleSwap (bool payFixedRate, const Date &startDate, int n, TimeUnit units, const Calen-
dar &calendar, RollingConvention rollingConvention, double nominal, int fixedFrequency,
Rate fixedRate, bool fixedIsAdjusted, const DayCounter &fixedDayCount, int floating-
Frequency, const Handle< Xibor > &index, int indexFixingDays, Spread spread, const
RelinkableHandle< TermStructure > &termStructure)
• SimpleSwap (bool payFixedRate, double nominal, const Schedule &fixedSchedule, Rate
fixedRate, const DayCounter &fixedDayCount, const Schedule &floatSchedule, const
Handle< Xibor > &index, int indexFixingDays, Spread spread, const RelinkableHandle<
TermStructure > &termStructure)
• Rate fairRate () const
• Spread fairSpread () const
• double fixedLegBPS () const
• double floatingLegBPS () const
• Rate fixedRate () const
• Spread spread () const
• double nominal () const
• bool payFixedRate () const
• const std::vector< Handle< CashFlow > > & fixedLeg () const
• const std::vector< Handle< CashFlow > > & floatingLeg () const
• void setupArguments (Arguments ∗args) const
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument (p. 368).
Arguments
SimpleSwap::arguments
arguments
Public Attributes
• bool payFixed
• double nominal
• std::vector< Time > fixedResetTimes
• std::vector< Time > fixedPayTimes
• std::vector< double > fixedCoupons
• std::vector< Time > floatingAccrualTimes
• std::vector< Time > floatingResetTimes
• std::vector< Time > floatingPayTimes
• std::vector< Spread > floatingSpreads
Results
Value
SimpleSwap::results
OptimizationMethod
Simplex
TrapezoidIntegral
SimpsonIntegral
SingleAssetOption
Black-Scholes-Merton option.
Protected Attributes
• double underlying_
• PlainVanillaPayoff payoff_
• Spread dividendYield_
• Rate riskFreeRate_
• Time residualTime_
• double volatility_
• bool hasBeenCalculated_
• double rho_
• double dividendRho_
• double vega_
• double theta_
• bool rhoComputed_
• bool dividendRhoComputed_
• bool vegaComputed_
• bool thetaComputed_
Friends
• class VolatilityFunction
• class DivYieldFunction
Warning:
Options with a gamma that changes sign have values that are not monotonic in the volatility,
e.g binary options. In these cases impliedVolatility can fail and in any case is meaningless.
Another possible source of failure is to have a targetValue that is not attainable with any
volatility, e.g. a targetValue lower than the intrinsic value in the case of American options.
Public Types
• typedef Sample< Array > sample_type
CuriouslyRecurringTemplate<Impl>
Solver1D
Before calling solveImpl, the base class will set its protected data members so that:
• fxMin_ and fxMax_ contain the values of the function in xMin_ and xMax_;
• root_ is a valid initial guess. The implementation of solveImpl can safely assume all of the
above.
Todo
a) Clean up the interface so that it is clear whether the accuracy is specified for x or f(x). b)
Add target value (now the target value is 0.0)
• template<class F> double solve (const F &f, double accuracy, double guess, double step)
const
• template<class F> double solve (const F &f, double accuracy, double guess, double xMin,
double xMax) const
• void setMaxEvaluations (Size evaluations)
• void setLowerBound (double lowerBound)
sets the lower bound for the function domain
Protected Attributes
• double root_
• double xMin_
• double xMax_
• double fxMin_
• double fxMax_
• Size maxEvaluations_
• Size evaluationNumber_
9.368.2.1 double solve (const F & f, double accuracy, double guess, double step) const
This method returns the zero of the function f , determined with the given accuracy (i.e., x is
considered a zero if | f (x)| < accuracy). This method contains a bracketing routine to which an
initial guess must be supplied as well as a step used to scan the range of the possible bracketing
values.
9.368.2.2 double solve (const F & f, double accuracy, double guess, double xMin, double
xMax) const
This method returns the zero of the function f , determined with the given accuracy (i.e., x is
considered a zero if | f (x)| < accuracy). An initial guess must be supplied, as well as two values
xmin and xmax which must bracket the zero (i.e., either f (xmin ) ≤ 0 ≤ f (xmax ), or f (xmax ) ≤ 0 ≤ f (xmin )
must be true).
This method sets the maximum number of function evaluations for the bracketing routine. An
error is thrown if a bracket is not found after this number of evaluations.
DiffusionProcess
SquareRootProcess
OptimizationMethod
SteepestDescent
• virtual ∼SteepestDescent ()
destructor
StepCondition
AmericanCondition ShoutCondition
#include <ql/Utilities/steppingiterator.hpp>
Dereferencing
Random access
Difference
Comparisons
Public Attributes
• typedef< RandomAccessIterator >::difference_type difference_type
• typedef< RandomAccessIterator >::pointer pointer
• typedef< RandomAccessIterator >::reference reference
Related Functions
Observer Observable
StochasticProcess
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Observable Observer
LazyObject
Instrument
Stock
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from Instrument (p. 369).
Calendar
Stockholm
Stockholm calendar
Holidays:
• Saturdays
• Sundays
• Good Friday
• Easter Monday
• Ascension
• Whit(Pentecost) Monday
• Midsummer Eve (Friday between June 18-24)
• New Year’s Day, January 1st
• Epiphany, January 6th
• May Day, May 1st
• National Day, June 6th
• Christmas Eve, December 24th
• Christmas Day, December 25th
AssetOrNothingPayoff
CashOrNothingPayoff
GapPayoff
TypePayoff StrikedTypePayoff
PercentageStrikePayoff
PlainVanillaPayoff
SuperSharePayoff
Protected Attributes
• double strike_
Observable
PricingEngine
BasketEngine
StulzEngine
Payoff
TypePayoff
StrikedTypePayoff
SuperSharePayoff
#include <ql/Instruments/swap.hpp>
Inheritance diagram for Swap:
Observable Observer
LazyObject
Instrument
Swap
SimpleSwap
• Swap (const std::vector< Handle< CashFlow > > &firstLeg, const std::vector< Handle<
CashFlow > > &secondLeg, const RelinkableHandle< TermStructure > &termStructure)
Instrument interface
Additional interface
Protected Attributes
• std::vector< Handle< CashFlow > > firstLeg_
• std::vector< Handle< CashFlow > > secondLeg_
• RelinkableHandle< TermStructure > termStructure_
• double firstLegBPS_
• double secondLegBPS_
Bug
This method must still be checked. It is not guaranteed to yield the right results.
This method must leave the instrument in a consistent state when the expiration condition is met.
Reimplemented from Instrument (p. 369).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from Instrument (p. 369).
Observer Observable
RateHelper
SwapRateHelper
Swap rate
Warning:
This class assumes that the settlement date does not change between calls of setTerm-
Structure()(p. 584).
Protected Attributes
• int n_
• TimeUnit units_
• int settlementDays_
• Calendar calendar_
• RollingConvention convention_
• int fixedFrequency_
• int floatingFrequency_
• bool fixedIsAdjusted_
• DayCounter fixedDayCount_
• Date settlement_
• Handle< SimpleSwap > swap_
• RelinkableHandle< TermStructure > termStructureHandle_
Warning:
Being a pointer and not a Handle(p. 339), the term structure is not guaranteed to remain
allocated for the whole life of the rate helper. It is responsibility of the programmer to ensure
that the pointer remains valid. It is advised that rate helpers be used only in term structure
constructors, setting the term structure to this, i.e., the one being constructed.
#include <ql/Instruments/swaption.hpp>
Inheritance diagram for Swaption:
Observable Observer
LazyObject
Instrument
Option
Swaption
Swaption class
• Swaption (const Handle< SimpleSwap > &swap, const Handle< Exercise > &exercise,
const RelinkableHandle< TermStructure > &termStructure, const Handle< PricingEngine
> &engine)
• bool isExpired () const
returns whether the instrument is still tradable.
When a derived argument structure is defined for an instrument, this method should be overrid-
den to fill it. This is mandatory in case a pricing engine is used.
Reimplemented from Instrument (p. 368).
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Reimplemented from Instrument (p. 369).
Arguments
arguments arguments
Swaption::arguments
Public Attributes
• Rate fairRate
• Rate fixedRate
• double fixedBPS
Results
Value
Swaption::results
Observable
SwaptionVolatilityStructure
SwaptionVolatilityMatrix
Todo
Either add correct copy behavior or inhibit copy. Right now, a copied instance would end up
with its own copy of the exercise date and length vector but an interpolation pointing to the
original ones.
Observable
SwaptionVolatilityStructure
SwaptionVolatilityMatrix
Swaption-volatility structure
This class is purely abstract and defines the interface of concrete swaption volatility structures
which will be derived from this one.
• double volatility (const Date &start, const Period &length, Rate strike) const
returns the volatility for a given starting date and length
• virtual std::pair< Time, Time > convertDates (const Date &start, const Period &length)
const
implements the conversion between dates and times
Calendar
Sydney
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Australia Day, January 26th (possibly moved to Monday)
• Good Friday
• Easter Monday
• ANZAC Day. April 25th (possibly moved to Monday)
• Queen’s Birthday, second Monday in June
• Bank Holiday, first Monday in August
• Labour Day, first Monday in October
• Christmas, December 25th (possibly moved to Monday or Tuesday)
• Boxing Day, December 26th (possibly moved to Monday or Tuesday)
S = U · D · UT ,
where · is the standard matrix product and T is the transpose operator. This class implements the
Schur decomposition using the symmetric threshold Jacobi algorithm. For details on the different
Jacobi transfomations see "Matrix computation," second edition, by Golub and Van Loan, The
Johns Hopkins University Press
Calendar
TARGET
TARGET calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Good Friday (since 2000)
• Easter Monday (since 2000)
• Labour Day, May 1st (since 2000)
• Christmas, December 25th
• Day of Goodwill, December 26th (since 2000)
• December 31st (1998, 1999, and 2001)
Observable
TermStructure
Todo
add derived class ParSwapTermStructure similar to ZeroYieldTermStructure, Discount-
Structure(p. 251), ForwardRateStructure(p. 311)
allow for different compounding rules and compounding frequencies
• Rate forward (const Date &, const Date &, bool extrapolate=false) const
discrete forward rate between two dates
Dates
Observable
TermStructureConsistentModel
Parameter
TermStructureFittingParameter
DayCounter
Thirty360
Public Types
• enum Convention { USA, European, Italian }
Tree
BinomialTree
Tian
Protected Attributes
• double up_
• double down_
• double pu_
• double pd_
Map interface
• typedef super::iterator iterator
• typedef super::const_iterator const_iterator
• typedef super::reverse_iterator reverse_iterator
• typedef super::const_reverse_iterator const_reverse_iterator
• bool hasDate (const Date &) const
membership
Algebra
Other methods
Todo
What was the rationale for limiting the grid to positive times? Investigate and see whether
we can use it for negative ones as well.
Calendar
Tokyo
Tokyo calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Bank Holiday, January 2nd
• Bank Holiday, January 3rd
• Coming of Age Day, 2nd Monday in January
• National Foundation Day, February 11th
• Vernal Equinox
• Greenery Day, April 29th
• Constitution Memorial Day, May 3rd
• Holiday for a Nation, May 4th
• Children’s Day, May 5th
• Marine Day, 3rd Monday in July
• Respect for the Aged Day, 3rd Monday in September
• Autumnal Equinox
• Health and Sports Day, 2nd Monday in October
• National Culture Day, November 3rd
• Labor Thanksgiving Day, November 23rd
• Emperor’s Birthday, December 23rd
• Bank Holiday, December 31st
Holidays falling on a Sunday are observed on the Monday following except for the Bank Holidays
associated with the New Year
Calendar
Toronto
Toronto calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st (possibly moved to Monday)
• Good Friday
• Easter Monday
• Victoria Day, The Monday on or preceding 24 May
• Canada Day, July 1st (possibly moved to Monday)
• Provincial Holiday, first Monday of August
• Labour Day, first Monday of September
• Thanksgiving Day, second Monday of October
• Remembrance Day, November 11th
• Christmas, December 25th (possibly moved to Monday or Tuesday)
• Boxing Day, December 26th (possibly moved to Monday or Tuesday)
#include <ql/Math/trapezoidintegral.hpp>
Inheritance diagram for TrapezoidIntegral:
TrapezoidIntegral
SimpsonIntegral
Public Types
• template<class F> double defaultIteration (const F &f, double a, double b, double I, Size
N) const
• template<class F> double midPointIteration (const F &f, double a, double b, double I, Size
N) const
Protected Attributes
• double accuracy_
• Method method_
• Size maxIterations_
Tree
BinomialTree TrinomialTree
Observable
PricingEngine
TreeCapFloor
Observable
PricingEngine
TreeSwaption
TridiagonalOperator
Warning:
to use real time-dependant algebra, you must overload the corresponding operators in the
inheriting time-dependent class
Operator interface
• Disposable< Array > applyTo (const Array &v) const
apply operator to a given array
• Disposable< Array > SOR (const Array &rhs, double tol) const
solve linear system with SOR approach
Public Types
• typedef Array arrayType
Inspectors
• bool isTimeDependent ()
• const Array & lowerDiagonal () const
• const Array & diagonal () const
• const Array & upperDiagonal () const
Modifiers
Utilities
Protected Attributes
• Array diagonal_
• Array lowerDiagonal_
• Array upperDiagonal_
• Handle< TimeSetter > timeSetter_
Friends
• Disposable< TridiagonalOperator > operator+ (const TridiagonalOperator &)
• Disposable< TridiagonalOperator > operator- (const TridiagonalOperator &)
• Disposable< TridiagonalOperator > operator+ (const TridiagonalOperator &, const
TridiagonalOperator &)
• Disposable< TridiagonalOperator > operator- (const TridiagonalOperator &, const
TridiagonalOperator &)
• Disposable< TridiagonalOperator > operator ∗ (double, const TridiagonalOperator &)
• Disposable< TridiagonalOperator > operator ∗ (const TridiagonalOperator &, double)
• Disposable< TridiagonalOperator > operator/ (const TridiagonalOperator &, double)
Tree
BinomialTree
EqualJumpsBinomialTree
Trigeorgis
Friends
• class TrinomialTree
Tree
TrinomialTree
Warning:
The diffusion term of the SDE must be independent of the underlying process.
Protected Attributes
• std::vector< Handle< TrinomialBranching > > branchings_
• double x0_
• std::vector< double > dx_
• TimeGrid timeGrid_
Observer Observable
ShortRateModel
TwoFactorModel
G2
rt = f (t, xt , yt )
and
y
yt = µ y (t, yt )dt + σ y (t, yt )dWt
where W x and W y are two brownian motions satisfying
y
dWtx dWt = ρdt
NumericalMethod
Lattice
Lattice2D
TwoFactorModel::ShortRateTree
Payoff
TypePayoff
StrikedTypePayoff
Protected Attributes
• Option::Type type_
Observable
CashFlow
Coupon
FloatingRateCoupon Observer
IndexedCoupon
UpFrontIndexedCoupon
Warning:
This class does not perform any date adjustment, i.e., the start and end date passed upon
construction should be already rolled to a business day.
FloatingRateCoupon interface
Visitability
Observable
Index Observer
Xibor
USDLibor
Results
Value
pricing results
Public Attributes
• double value
• double errorEstimate
AnalyticDigitalAmericanEngine
AnalyticEuropeanEngine
BaroneAdesiWhaleyApproximationEngine
BjerksundStenslandApproximationEngine
IntegralEngine
MCVanillaEngine
Observable Observer
LazyObject
Instrument
Option
OneAssetOption
OneAssetStrikedOption
VanillaOption
ForwardVanillaOption QuantoVanillaOption
QuantoForwardVanillaOption
In case a pricing engine is not used, this method must be overridden to perform the actual calcu-
lations and set any needed results. In case a pricing engine is used, the default implementation
can be used.
Observer Observable
ShortRateModel
OneFactorModel AffineModel
OneFactorAffineModel
Vasicek
HullWhite
Calendar
Warsaw
Warsaw calendar
Holidays:
• Saturdays
• Sundays
• Easter Monday
• Corpus Christi
• New Year’s Day, January 1st
• May Day, May 1st
• Constitution Day, May 3rd
• Assumption of the Blessed Virgin Mary, August 15th
• All Saints Day, November 1st
• Independence Day, November 11th
• Christmas, December 25th
• 2nd Day of Christmas, December 26th
Calendar
Wellington
Wellington calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st (possibly moved to Monday or Tuesday)
• Day after New Year’s Day, January 2st (possibly moved to Monday or Tuesday)
• Anniversary Day, Monday nearest January 22nd
• Waitangi Day. February 6th
• Good Friday
• Easter Monday
• ANZAC Day. April 25th
• Queen’s Birthday, first Monday in June
• Labour Day, fourth Monday in October
• Christmas, December 25th (possibly moved to Monday or Tuesday)
• Boxing Day, December 26th (possibly moved to Monday or Tuesday)
Note:
The holiday rules for Wellington(p. 630) were documented by David Gilbert for IDB
(http://www.jrefinery.com/ibd/)
#include <ql/Indexes/xibor.hpp>
Inheritance diagram for Xibor:
Index Observer
Xibor
• Xibor (const std::string &familyName, int n, TimeUnit units, int settlementDays, Cur-
rency currency, const Calendar &calendar, bool isAdjusted, RollingConvention rolling-
Convention, const DayCounter &dayCounter, const RelinkableHandle< TermStructure >
&h)
Index interface
Observer interface
• void update ()
Inspectors
Note:
any date passed as arguments must be a value date, i.e., the real calendar date advanced by
a number of settlement days.
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
Warning:
This method is used for output and comparison between indexes. It is not meant to be used
for writing switch-on-type code.
Public Types
• typedef std::map< std::string, History > HistoryMap
Observable
Index Observer
Xibor
ZARLibor
Todo
check settlement days
Observable
TermStructure
ZeroYieldStructure
ZeroCurve
Observable
TermStructure
ZeroYieldStructure Observer
ZeroSpreadedTermStructure
Note:
This term structure will remain linked to the original structure, i.e., any changes in the latter
will be reflected in this structure as well.
TermStructure interface
Observer interface
• void update ()
This method must be implemented in derived classes. An instance of Observer does not call this
method directly: instead, it will be called by the observables the instance registered with when
they need to notify any changes.
Implements Observer (p. 475).
9.428.2.2 Rate forwardImpl (Time, bool extrapolate = false) const [protected, virtual]
Warning:
This method must disappear should the spread become a curve
#include <ql/termstructure.hpp>
Inheritance diagram for ZeroYieldStructure:
Observable
TermStructure
ZeroYieldStructure
Returns the discount factor for the given date calculating it from the zero yield.
Implements TermStructure (p. 595).
9.429.2.2 Rate forwardImpl (Time, bool extrapolate = false) const [protected, virtual]
Returns the instantaneous forward rate for the given date calculating it from the zero yield.
Implements TermStructure (p. 595).
Reimplemented in ZeroSpreadedTermStructure (p. 637).
Returns the forward rate at a specified compound frequency for the given date calculating it from
the zero yield.
Implements TermStructure (p. 595).
Calendar
Zurich
Zurich calendar
Holidays:
• Saturdays
• Sundays
• New Year’s Day, January 1st
• Berchtoldstag, January 2nd
• Good Friday
• Easter Monday
• Ascension Day
• Whit Monday
• Labour Day, May 1st
• National Day, August 1st
• Christmas, December 25th
• St. Stephen’s Day, December 26th
ql/qldefines.hpp
ql/null.hpp
argsandresults.hpp
Namespaces
• namespace QuantLib
Defines
• #define QL_MIN_VOLATILITY 0.0
• #define QL_MIN_DIVYIELD 1.0e-7
• #define QL_MAX_VOLATILITY 4.0
• #define QL_MAX_DIVYIELD 4.0
642 QuantLib File Documentation
calendar class
#include <ql/date.hpp>
#include <ql/Patterns/bridge.hpp>
Include dependency graph for calendar.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
calendar.hpp
Namespaces
• namespace QuantLib
Budapest calendar.
#include <ql/calendar.hpp>
Include dependency graph for budapest.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
budapest.hpp
Namespaces
• namespace QuantLib
Copenhagen calendar.
#include <ql/calendar.hpp>
Include dependency graph for copenhagen.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
copenhagen.hpp
Namespaces
• namespace QuantLib
Frankfurt calendar.
#include <ql/calendar.hpp>
Include dependency graph for frankfurt.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
frankfurt.hpp
Namespaces
• namespace QuantLib
Helsinki calendar.
#include <ql/calendar.hpp>
Include dependency graph for helsinki.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
helsinki.hpp
Namespaces
• namespace QuantLib
Johannesburg calendar.
#include <ql/calendar.hpp>
Include dependency graph for johannesburg.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
johannesburg.hpp
Namespaces
• namespace QuantLib
Joint calendar.
#include <ql/calendar.hpp>
#include <vector>
Include dependency graph for jointcalendar.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp vector
jointcalendar.hpp
Namespaces
• namespace QuantLib
London calendar.
#include <ql/calendar.hpp>
Include dependency graph for london.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
london.hpp
Namespaces
• namespace QuantLib
Milan calendar.
#include <ql/calendar.hpp>
Include dependency graph for milan.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
milan.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
newyork.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
nullcalendar.hpp
Namespaces
• namespace QuantLib
Oslo calendar.
#include <ql/calendar.hpp>
Include dependency graph for oslo.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
oslo.hpp
Namespaces
• namespace QuantLib
Stockholm calendar.
#include <ql/calendar.hpp>
Include dependency graph for stockholm.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
stockholm.hpp
Namespaces
• namespace QuantLib
Sydney calendar.
#include <ql/calendar.hpp>
Include dependency graph for sydney.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
sydney.hpp
Namespaces
• namespace QuantLib
TARGET calendar.
#include <ql/calendar.hpp>
Include dependency graph for target.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
target.hpp
Namespaces
• namespace QuantLib
Tokyo calendar.
#include <ql/calendar.hpp>
Include dependency graph for tokyo.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
tokyo.hpp
Namespaces
• namespace QuantLib
Toronto calendar.
#include <ql/calendar.hpp>
Include dependency graph for toronto.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
toronto.hpp
Namespaces
• namespace QuantLib
Warsaw calendar.
#include <ql/calendar.hpp>
Include dependency graph for warsaw.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
warsaw.hpp
Namespaces
• namespace QuantLib
Wellington calendar.
#include <ql/calendar.hpp>
Include dependency graph for wellington.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
wellington.hpp
Namespaces
• namespace QuantLib
Zurich calendar.
#include <ql/calendar.hpp>
Include dependency graph for zurich.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/calendar.hpp
zurich.hpp
Namespaces
• namespace QuantLib
ql/Patterns/observable.hpp ql/Patterns/bridge.hpp
ql/daycounter.hpp
capvolstructures.hpp
Namespaces
• namespace QuantLib
ql/Patterns/observable.hpp ql/Patterns/visitor.hpp
cashflow.hpp
Namespaces
• namespace QuantLib
basispointsensitivity.hpp
Namespaces
• namespace QuantLib
ql/date.hpp
ql/Indexes/xibor.hpp
cashflowvectors.hpp
Namespaces
• namespace QuantLib
coupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/coupon.hpp
fixedratecoupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/coupon.hpp
floatingratecoupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
ql/CashFlows/indexedcoupon.hpp
inarrearindexedcoupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
ql/CashFlows/indexedcoupon.hpp
ql/CashFlows/shortindexedcoupon.hpp
indexcashflowvectors.hpp
Namespaces
• namespace QuantLib
indexed coupon
#include <ql/CashFlows/floatingratecoupon.hpp>
#include <ql/Indexes/xibor.hpp>
Include dependency graph for indexedcoupon.hpp:
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
indexedcoupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
parcoupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
ql/CashFlows/parcoupon.hpp
shortfloatingcoupon.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
ql/CashFlows/indexedcoupon.hpp
shortindexedcoupon.hpp
Namespaces
• namespace QuantLib
ql/Patterns/observable.hpp ql/Patterns/visitor.hpp
ql/cashflow.hpp
simplecashflow.hpp
Namespaces
• namespace QuantLib
timebasket.hpp
Namespaces
• namespace QuantLib
ql/CashFlows/floatingratecoupon.hpp ql/Indexes/xibor.hpp
ql/CashFlows/indexedcoupon.hpp
upfrontindexedcoupon.hpp
Namespaces
• namespace QuantLib
Known currencies.
#include <ql/qldefines.hpp>
Include dependency graph for currency.hpp:
ql/qldefines.hpp
currency.hpp
Namespaces
• namespace QuantLib
dataformatters.hpp
Namespaces
• namespace QuantLib
ql/date.hpp vector
dataparsers.hpp
Namespaces
• namespace QuantLib
date.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
daycounter.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/daycounter.hpp
actual360.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/daycounter.hpp
actual365.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/daycounter.hpp
actualactual.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/daycounter.hpp
simpledaycounter.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/daycounter.hpp
thirty360.hpp
Namespaces
• namespace QuantLib
Diffusion process.
#include <ql/termstructure.hpp>
#include <ql/voltermstructure.hpp>
Include dependency graph for diffusionprocess.hpp:
ql/termstructure.hpp ql/voltermstructure.hpp
diffusionprocess.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/grid.hpp ql/handle.hpp
ql/numericalmethod.hpp ql/Math/comparison.hpp
discretizedasset.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
disposable.hpp
Namespaces
• namespace QuantLib
errors.hpp
Namespaces
• namespace QuantLib
Defines
• #define QL_FAIL(message)
throw an error (possibly with file and line information)
Value:
throw QuantLib::Error(\
QuantLib::Error::where(__FILE__,__LINE__) + message)
Value:
if (!(condition)) \
throw QuantLib::AssertionFailedError(\
QuantLib::Error::where(__FILE__,__LINE__) + description); \
else
Value:
if (!(condition)) \
throw QuantLib::PreconditionNotSatisfiedError(\
QuantLib::Error::where(__FILE__,__LINE__) + description); \
else
Examples:
DiscreteHedging.cpp, and swapvaluation.cpp.
Value:
if (!(condition)) \
throw QuantLib::PostconditionNotSatisfiedError(\
QuantLib::Error::where(__FILE__,__LINE__) + description); \
else
ql/date.hpp vector
exercise.hpp
Namespaces
• namespace QuantLib
ql/FiniteDifferences/mixedscheme.hpp ql/qldefines.hpp
americancondition.hpp
Namespaces
• namespace QuantLib
ql/null.hpp ql/FiniteDifferences/tridiagonaloperator.hpp
boundarycondition.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/Math/array.hpp
ql/FiniteDifferences/tridiagonaloperator.hpp
bsmoperator.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
ql/grid.hpp ql/handle.hpp
ql/FiniteDifferences/stepcondition.hpp ql/FiniteDifferences/boundarycondition.hpp
ql/FiniteDifferences/finitedifferencemodel.hpp
ql/FiniteDifferences/mixedscheme.hpp
cranknicolson.hpp
Namespaces
• namespace QuantLib
D− matricial representation
#include <ql/FiniteDifferences/tridiagonaloperator.hpp>
Include dependency graph for dminus.hpp:
ql/handle.hpp ql/Math/array.hpp
ql/FiniteDifferences/tridiagonaloperator.hpp
dminus.hpp
Namespaces
• namespace QuantLib
D+ matricial representation
#include <ql/FiniteDifferences/tridiagonaloperator.hpp>
Include dependency graph for dplus.hpp:
ql/handle.hpp ql/Math/array.hpp
ql/FiniteDifferences/tridiagonaloperator.hpp
dplus.hpp
Namespaces
• namespace QuantLib
D+ D− matricial representation
#include <ql/FiniteDifferences/tridiagonaloperator.hpp>
Include dependency graph for dplusdminus.hpp:
ql/handle.hpp ql/Math/array.hpp
ql/FiniteDifferences/tridiagonaloperator.hpp
dplusdminus.hpp
Namespaces
• namespace QuantLib
D0 matricial representation
#include <ql/FiniteDifferences/tridiagonaloperator.hpp>
Include dependency graph for dzero.hpp:
ql/handle.hpp ql/Math/array.hpp
ql/FiniteDifferences/tridiagonaloperator.hpp
dzero.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
ql/grid.hpp ql/handle.hpp
ql/FiniteDifferences/stepcondition.hpp ql/FiniteDifferences/boundarycondition.hpp
ql/FiniteDifferences/finitedifferencemodel.hpp
ql/FiniteDifferences/mixedscheme.hpp
expliciteuler.hpp
Namespaces
• namespace QuantLib
ql/FiniteDifferences/stepcondition.hpp ql/FiniteDifferences/boundarycondition.hpp
ql/FiniteDifferences/finitedifferencemodel.hpp
ql/FiniteDifferences/mixedscheme.hpp
ql/FiniteDifferences/cranknicolson.hpp
fdtypedefs.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
ql/grid.hpp ql/handle.hpp
ql/FiniteDifferences/stepcondition.hpp ql/FiniteDifferences/boundarycondition.hpp
finitedifferencemodel.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
ql/grid.hpp ql/handle.hpp
ql/FiniteDifferences/stepcondition.hpp ql/FiniteDifferences/boundarycondition.hpp
ql/FiniteDifferences/finitedifferencemodel.hpp
ql/FiniteDifferences/mixedscheme.hpp
impliciteuler.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
ql/grid.hpp ql/handle.hpp
ql/FiniteDifferences/stepcondition.hpp ql/FiniteDifferences/boundarycondition.hpp
ql/FiniteDifferences/finitedifferencemodel.hpp
mixedscheme.hpp
Namespaces
• namespace QuantLib
ql/FiniteDifferences/tridiagonaloperator.hpp ql/ShortRateModels/onefactormodel.hpp
onefactoroperator.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/numericalmethod.hpp ql/Math/comparison.hpp
ql/FiniteDifferences/finitedifferencemodel.hpp
ql/FiniteDifferences/mixedscheme.hpp
ql/FiniteDifferences/cranknicolson.hpp
ql/FiniteDifferences/fdtypedefs.hpp
shoutcondition.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
ql/numericalmethod.hpp
stepcondition.hpp
Namespaces
• namespace QuantLib
tridiagonal operator
#include <ql/Math/array.hpp>
#include <ql/handle.hpp>
Include dependency graph for tridiagonaloperator.hpp:
ql/handle.hpp ql/Math/array.hpp
tridiagonaloperator.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
valueatcenter.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp
ql/daycounter.hpp
daycounters.hpp
Namespaces
• namespace QuantLib
math functions
#include <ql/Math/matrix.hpp>
#include <ql/Math/loglinearinterpolation.hpp>
#include <ql/Math/cubicspline.hpp>
Include dependency graph for mathf.hpp:
mathf.hpp
Namespaces
• namespace QuantLib
Volatility functions.
#include <ql/Math/matrix.hpp>
#include <ql/daycounter.hpp>
#include <vector>
Include dependency graph for vols.hpp:
ql/qldefines.hpp
ql/Patterns/bridge.hpp ql/Math/matrix.hpp
ql/daycounter.hpp vector
vols.hpp
Namespaces
• namespace QuantLib
Grid classes with useful constructors for trees and finite diffs.
#include <ql/dataformatters.hpp>
#include <list>
#include <vector>
Include dependency graph for grid.hpp:
grid.hpp
Namespaces
• namespace QuantLib
Reference-counted pointer.
#include <ql/errors.hpp>
#include <typeinfo>
Include dependency graph for handle.hpp:
ql/errors.hpp typeinfo
handle.hpp
Namespaces
• namespace QuantLib
history class
#include <ql/null.hpp>
#include <ql/Utilities/filteringiterator.hpp>
#include <ql/dataformatters.hpp>
#include <vector>
Include dependency graph for history.hpp:
ql/qldefines.hpp
history.hpp
Namespaces
• namespace QuantLib
ql/daycounter.hpp ql/calendar.hpp
index.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
audlibor.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
cadlibor.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
chflibor.hpp
Namespaces
• namespace QuantLib
Euribor index
#include <ql/Indexes/xibor.hpp>
#include <ql/Calendars/target.hpp>
#include <ql/DayCounters/actual360.hpp>
Include dependency graph for euribor.hpp:
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
euribor.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
gbplibor.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
jpylibor.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
usdlibor.hpp
Namespaces
• namespace QuantLib
ql/index.hpp ql/termstructure.hpp
xibor.hpp
Namespaces
• namespace QuantLib
xibormanager.hpp
Namespaces
• namespace QuantLib
ql/calendar.hpp ql/daycounter.hpp
ql/index.hpp ql/termstructure.hpp
zarlibor.hpp
Namespaces
• namespace QuantLib
typeinfo ql/errors.hpp
ql/Patterns/observable.hpp ql/argsandresults.hpp
ql/Patterns/lazyobject.hpp ql/pricingengine.hpp
instrument.hpp
Namespaces
• namespace QuantLib
ql/stochasticprocess.hpp ql/option.hpp
ql/Instruments/oneassetoption.hpp ql/Instruments/payoffs.hpp
ql/Instruments/oneassetstrikedoption.hpp vector
asianoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
barrieroption.hpp
Namespaces
• namespace QuantLib
ql/stochasticprocess.hpp ql/option.hpp
ql/Instruments/multiassetoption.hpp ql/Instruments/payoffs.hpp
basketoption.hpp
Namespaces
• namespace QuantLib
capfloor.hpp
Namespaces
• namespace QuantLib
Cliquet option.
#include <ql/Instruments/vanillaoption.hpp>
Include dependency graph for cliquetoption.hpp:
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
cliquetoption.hpp
Namespaces
• namespace QuantLib
Cliquet option.
#include <ql/Pricers/europeanoption.hpp>
Include dependency graph for cliquetoption.hpp:
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
ql/Pricers/europeanoption.hpp
cliquetoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
forwardvanillaoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
multiassetoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
oneassetoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
oneassetstrikedoption.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/instrument.hpp ql/exercise.hpp
ql/option.hpp
payoffs.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
ql/Instruments/quantovanillaoption.hpp ql/Instruments/forwardvanillaoption.hpp
quantoforwardvanillaoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
quantovanillaoption.hpp
Namespaces
• namespace QuantLib
simpleswap.hpp
Namespaces
• namespace QuantLib
typeinfo ql/errors.hpp
ql/Patterns/observable.hpp ql/argsandresults.hpp
ql/marketelement.hpp ql/instrument.hpp
stock.hpp
Namespaces
• namespace QuantLib
swap.hpp
Namespaces
• namespace QuantLib
Swaption class.
#include <ql/numericalmethod.hpp>
#include <ql/option.hpp>
#include <ql/Instruments/simpleswap.hpp>
Include dependency graph for swaption.hpp:
swaption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
vanillaoption.hpp
Namespaces
• namespace QuantLib
ql/diffusionprocess.hpp ql/Lattices/tree.hpp
binomialtree.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
ql/numericalmethod.hpp
ql/Lattices/tree.hpp ql/Lattices/lattice.hpp
bsmlattice.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
ql/numericalmethod.hpp
lattice.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
ql/diffusionprocess.hpp ql/Lattices/tree.hpp
lattice2d.hpp
Namespaces
• namespace QuantLib
Tree class.
#include <ql/numericalmethod.hpp>
Include dependency graph for tree.hpp:
ql/grid.hpp ql/handle.hpp
ql/numericalmethod.hpp
tree.hpp
Namespaces
• namespace QuantLib
ql/diffusionprocess.hpp ql/Lattices/tree.hpp
trinomialtree.hpp
Namespaces
• namespace QuantLib
ql/errors.hpp typeinfo
ql/handle.hpp list
ql/Patterns/observable.hpp
ql/relinkablehandle.hpp
marketelement.hpp
Namespaces
• namespace QuantLib
array.hpp
Namespaces
• namespace QuantLib
ql/Math/gammadistribution.hpp
beta.hpp
Namespaces
• namespace QuantLib
ql/Math/interpolation2D.hpp ql/Math/cubicspline.hpp
bicubicsplineinterpolation.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/Math/matrix.hpp ql/currency.hpp
ql/Patterns/bridge.hpp ql/dataformatters.hpp
ql/Math/interpolation2D.hpp
bilinearinterpolation.hpp
Namespaces
• namespace QuantLib
Binomial distribution.
#include <ql/Math/factorial.hpp>
#include <ql/Math/beta.hpp>
Include dependency graph for binomialdistribution.hpp:
ql/Math/gammadistribution.hpp
ql/Math/factorial.hpp ql/Math/beta.hpp
binomialdistribution.hpp
Namespaces
• namespace QuantLib
ql/dataformatters.hpp
bivariatenormaldistribution.hpp
Namespaces
• namespace QuantLib
ql/dataformatters.hpp
chisquaredistribution.hpp
Namespaces
• namespace QuantLib
Cholesky decomposition.
#include <ql/Math/matrix.hpp>
Include dependency graph for choleskydecomposition.hpp:
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
ql/Math/matrix.hpp
choleskydecomposition.hpp
Namespaces
• namespace QuantLib
floating-point comparisons
#include <ql/qldefines.hpp>
Include dependency graph for comparison.hpp:
ql/qldefines.hpp
comparison.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
cubicspline.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/null.hpp ql/dataformatters.hpp
ql/Math/generalstatistics.hpp
ql/Math/statistics.hpp
ql/Math/sequencestatistics.hpp
discrepancystatistics.hpp
Namespaces
• namespace QuantLib
Error function.
#include <ql/qldefines.hpp>
#include <functional>
Include dependency graph for errorfunction.hpp:
ql/qldefines.hpp functional
errorfunction.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/types.hpp
factorial.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
functional.hpp
Namespaces
• namespace QuantLib
Gamma distribution.
#include <ql/errors.hpp>
#include <ql/types.hpp>
#include <functional>
Include dependency graph for gammadistribution.hpp:
gammadistribution.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/dataformatters.hpp
ql/Math/normaldistribution.hpp
gaussianstatistics.hpp
Namespaces
• namespace QuantLib
statistics tool
#include <ql/null.hpp>
#include <ql/dataformatters.hpp>
Include dependency graph for generalstatistics.hpp:
ql/qldefines.hpp
ql/null.hpp ql/dataformatters.hpp
generalstatistics.hpp
Namespaces
• namespace QuantLib
incompletegamma.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/null.hpp ql/dataformatters.hpp
incrementalstatistics.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/Math/matrix.hpp ql/currency.hpp
ql/Patterns/bridge.hpp ql/dataformatters.hpp
interpolation.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/Math/matrix.hpp ql/currency.hpp
ql/Patterns/bridge.hpp ql/dataformatters.hpp
interpolation2D.hpp
Namespaces
• namespace QuantLib
ql/Math/linearinterpolation.hpp vector
ql/Math/bicubicsplineinterpolation.hpp ql/Math/bilinearinterpolation.hpp
interpolationtraits.hpp
Namespaces
• namespace QuantLib
ql/dataformatters.hpp
kronrodintegral.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/Utilities/steppingiterator.hpp
lexicographicalview.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/Math/matrix.hpp ql/currency.hpp
ql/Patterns/bridge.hpp ql/dataformatters.hpp
ql/Math/interpolation.hpp
linearinterpolation.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/dataformatters.hpp
ql/Math/interpolation.hpp
ql/Math/linearinterpolation.hpp vector
loglinearinterpolation.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
matrix.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/dataformatters.hpp
normaldistribution.hpp
Namespaces
• namespace QuantLib
Poisson distribution.
#include <ql/dataformatters.hpp>
#include <ql/Math/factorial.hpp>
#include <ql/Math/incompletegamma.hpp>
Include dependency graph for poissondistribution.hpp:
poissondistribution.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/types.hpp vector
primenumbers.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
ql/Math/matrix.hpp
pseudosqrt.hpp
Namespaces
• namespace QuantLib
ql/Math/generalstatistics.hpp ql/Math/gaussianstatistics.hpp
riskstatistics.hpp
Namespaces
• namespace QuantLib
ql/errors.hpp ql/types.hpp
segmentintegral.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/null.hpp ql/dataformatters.hpp
ql/Math/generalstatistics.hpp
ql/Math/statistics.hpp
sequencestatistics.hpp
Namespaces
• namespace QuantLib
Defines
• #define DEFINE_SEQUENCE_STAT_CONST_METHOD_VOID(METHOD)
• #define DEFINE_SEQUENCE_STAT_CONST_METHOD_DOUBLE(METHOD)
Value:
Value:
ql/qldefines.hpp
ql/null.hpp
ql/Math/trapezoidintegral.hpp
simpsonintegral.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/null.hpp ql/dataformatters.hpp
ql/Math/generalstatistics.hpp
statistics.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
ql/Math/matrix.hpp
svd.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
ql/Math/matrix.hpp
ql/Math/symmetricschurdecomposition.hpp
symmetriceigenvalues.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
ql/Math/matrix.hpp
symmetricschurdecomposition.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/null.hpp
trapezoidintegral.hpp
Namespaces
• namespace QuantLib
Browian bridge.
#include <ql/MonteCarlo/path.hpp>
#include <ql/MonteCarlo/sample.hpp>
Include dependency graph for brownianbridge.hpp:
ql/qldefines.hpp
ql/grid.hpp ql/handle.hpp
ql/MonteCarlo/path.hpp ql/MonteCarlo/sample.hpp
brownianbridge.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/Utilities/steppingiterator.hpp
ql/Math/matrix.hpp
getcovariance.hpp
Namespaces
• namespace QuantLib
ql/MonteCarlo/pathgenerator.hpp
ql/RandomNumbers/rngtraits.hpp
mctraits.hpp
ql/MonteCarlo/multipathgenerator.hpp
ql/MonteCarlo/pathpricer.hpp
Namespaces
• namespace QuantLib
ql/RandomNumbers/rngtypedefs.hpp
ql/MonteCarlo/montecarlomodel.hpp mctypedefs.hpp
ql/MonteCarlo/brownianbridge.hpp
Namespaces
• namespace QuantLib
montecarlomodel.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
ql/MonteCarlo/path.hpp
multipath.hpp
Namespaces
• namespace QuantLib
multipathgenerator.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
path.hpp
Namespaces
• namespace QuantLib
pathgenerator.hpp
Namespaces
• namespace QuantLib
pathpricer.hpp
Namespaces
• namespace QuantLib
weighted sample
#include <ql/qldefines.hpp>
Include dependency graph for sample.hpp:
ql/qldefines.hpp
sample.hpp
Namespaces
• namespace QuantLib
null values
#include <ql/qldefines.hpp>
Include dependency graph for null.hpp:
ql/qldefines.hpp
null.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/handle.hpp
numericalmethod.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
ql/Optimization/method.hpp
ql/Optimization/problem.hpp
ql/Optimization/linesearch.hpp
armijo.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
ql/Optimization/method.hpp
ql/Optimization/problem.hpp
ql/Optimization/linesearch.hpp
ql/Optimization/armijo.hpp
conjugategradient.hpp
Namespaces
• namespace QuantLib
ql/handle.hpp ql/Math/array.hpp
ql/Patterns/bridge.hpp
constraint.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp
costfunction.hpp
Namespaces
• namespace QuantLib
Namespaces
• namespace QuantLib
ql/Math/matrix.hpp ql/Optimization/conjugategradient.hpp
leastsquare.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
ql/Optimization/method.hpp
ql/Optimization/problem.hpp
linesearch.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
method.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
ql/Optimization/method.hpp
problem.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
ql/Optimization/method.hpp
ql/Optimization/problem.hpp vector
simplex.hpp
Namespaces
• namespace QuantLib
ql/Patterns/bridge.hpp ql/Math/array.hpp
ql/Optimization/method.hpp
ql/Optimization/problem.hpp
ql/Optimization/linesearch.hpp
ql/Optimization/armijo.hpp
steepestdescent.hpp
Namespaces
• namespace QuantLib
ql/Patterns/lazyobject.hpp ql/pricingengine.hpp
ql/instrument.hpp
option.hpp
Namespaces
• namespace QuantLib
ql/errors.hpp typeinfo
ql/handle.hpp
bridge.hpp
Namespaces
• namespace QuantLib
composite pattern
#include <ql/handle.hpp>
Include dependency graph for composite.hpp:
ql/errors.hpp typeinfo
ql/handle.hpp
composite.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
curiouslyrecurring.hpp
Namespaces
• namespace QuantLib
ql/errors.hpp typeinfo
ql/handle.hpp list
ql/Patterns/observable.hpp
lazyobject.hpp
Namespaces
• namespace QuantLib
observer/observable pattern
#include <ql/handle.hpp>
#include <list>
Include dependency graph for observable.hpp:
ql/errors.hpp typeinfo
ql/handle.hpp list
observable.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
visitor.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
payoff.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
ql/Pricers/europeanoption.hpp
continuousgeometricapo.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
discretegeometricapo.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
discretegeometricaso.hpp
Namespaces
• namespace QuantLib
european option
#include <ql/Pricers/singleassetoption.hpp>
#include <ql/Math/normaldistribution.hpp>
Include dependency graph for europeanoption.hpp:
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
europeanoption.hpp
Namespaces
• namespace QuantLib
american option
#include <ql/Pricers/fdstepconditionoption.hpp>
#include <ql/FiniteDifferences/americancondition.hpp>
Include dependency graph for fdamericanoption.hpp:
ql/Pricers/fdstepconditionoption.hpp ql/FiniteDifferences/americancondition.hpp
fdamericanoption.hpp
Namespaces
• namespace QuantLib
ql/Pricers/fdbsmoption.hpp ql/FiniteDifferences/fdtypedefs.hpp
ql/Pricers/fdmultiperiodoption.hpp
fdbermudanoption.hpp
Namespaces
• namespace QuantLib
ql/Pricers/singleassetoption.hpp
ql/FiniteDifferences/bsmoperator.hpp fdbsmoption.hpp
ql/FiniteDifferences/boundarycondition.hpp
Namespaces
• namespace QuantLib
Defines
• #define QL_NUM_OPT_MIN_GRID_POINTS 10
This is a safety check to be sure we have enough grid points.
• #define QL_NUM_OPT_GRID_POINTS_PER_YEAR 2
This is a safety check to be sure we have enough grid points.
ql/Pricers/fdbsmoption.hpp ql/FiniteDifferences/fdtypedefs.hpp
ql/Pricers/fdmultiperiodoption.hpp
ql/Pricers/fddividendoption.hpp
fddividendamericanoption.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
ql/Pricers/europeanoption.hpp
fddividendeuropeanoption.hpp
Namespaces
• namespace QuantLib
ql/Pricers/fdbsmoption.hpp ql/FiniteDifferences/fdtypedefs.hpp
ql/Pricers/fdmultiperiodoption.hpp
fddividendoption.hpp
Namespaces
• namespace QuantLib
ql/FiniteDifferences/fdtypedefs.hpp ql/discretizedasset.hpp
ql/Pricers/fdmultiperiodoption.hpp ql/FiniteDifferences/shoutcondition.hpp
ql/Pricers/fddividendoption.hpp
fddividendshoutoption.hpp
Namespaces
• namespace QuantLib
ql/Pricers/fdbsmoption.hpp ql/FiniteDifferences/fdtypedefs.hpp
fdeuropean.hpp
Namespaces
• namespace QuantLib
ql/Pricers/fdbsmoption.hpp ql/FiniteDifferences/fdtypedefs.hpp
fdmultiperiodoption.hpp
Namespaces
• namespace QuantLib
shout option
#include <ql/Pricers/fdstepconditionoption.hpp>
#include <ql/FiniteDifferences/shoutcondition.hpp>
Include dependency graph for fdshoutoption.hpp:
ql/Pricers/fdstepconditionoption.hpp ql/FiniteDifferences/shoutcondition.hpp
fdshoutoption.hpp
Namespaces
• namespace QuantLib
ql/Pricers/fdbsmoption.hpp ql/FiniteDifferences/fdtypedefs.hpp
fdstepconditionoption.hpp
Namespaces
• namespace QuantLib
ql/Pricers/mcpricer.hpp ql/MonteCarlo/mctypedefs.hpp
mcbasket.hpp
Namespaces
• namespace QuantLib
mccliquetoption.hpp
Namespaces
• namespace QuantLib
mcdiscretearithmeticapo.hpp
Namespaces
• namespace QuantLib
mcdiscretearithmeticaso.hpp
Namespaces
• namespace QuantLib
ql/Pricers/mcpricer.hpp ql/MonteCarlo/mctypedefs.hpp
mceverest.hpp
Namespaces
• namespace QuantLib
ql/dataformatters.hpp ql/MonteCarlo/montecarlomodel.hpp
ql/Pricers/mcpricer.hpp
mchimalaya.hpp
Namespaces
• namespace QuantLib
ql/Pricers/mcpricer.hpp ql/MonteCarlo/mctypedefs.hpp
mcmaxbasket.hpp
Namespaces
• namespace QuantLib
ql/Pricers/mcpricer.hpp ql/MonteCarlo/mctypedefs.hpp
mcpagoda.hpp
Namespaces
• namespace QuantLib
mcperformanceoption.hpp
Namespaces
• namespace QuantLib
ql/dataformatters.hpp ql/MonteCarlo/montecarlomodel.hpp
mcpricer.hpp
Namespaces
• namespace QuantLib
Performance option.
#include <ql/Pricers/europeanoption.hpp>
Include dependency graph for performanceoption.hpp:
ql/qldefines.hpp functional
ql/Instruments/payoffs.hpp ql/dataformatters.hpp
ql/Pricers/singleassetoption.hpp ql/Math/normaldistribution.hpp
ql/Pricers/europeanoption.hpp
performanceoption.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp functional
ql/instrument.hpp ql/exercise.hpp
ql/option.hpp
ql/Instruments/payoffs.hpp
singleassetoption.hpp
Namespaces
• namespace QuantLib
typeinfo ql/errors.hpp
ql/Patterns/observable.hpp ql/argsandresults.hpp
pricingengine.hpp
Namespaces
• namespace QuantLib
ql/option.hpp
ql/dataformatters.hpp ql/Math/errorfunction.hpp
ql/Instruments/payoffs.hpp ql/Math/normaldistribution.hpp
americanpayoffatexpiry.hpp
Namespaces
• namespace QuantLib
ql/option.hpp
ql/dataformatters.hpp ql/Math/errorfunction.hpp
ql/Instruments/payoffs.hpp ql/Math/normaldistribution.hpp
americanpayoffathit.hpp
Namespaces
• namespace QuantLib
ql/stochasticprocess.hpp ql/option.hpp
ql/Instruments/oneassetoption.hpp ql/Instruments/payoffs.hpp
ql/Instruments/oneassetstrikedoption.hpp vector
ql/Instruments/asianoption.hpp
analyticasianengine.hpp
Namespaces
• namespace QuantLib
ql/Instruments/barrieroption.hpp ql/Math/normaldistribution.hpp
analyticbarrierengine.hpp
Namespaces
• namespace QuantLib
ql/Instruments/barrieroption.hpp ql/PricingEngines/mcsimulation.hpp
mcbarrierengine.hpp
Namespaces
• namespace QuantLib
10.219 ql/PricingEngines/Basket/mcamericanbasketengine.hpp
File Reference
vector
ql/option.hpp ql/voltermstructure.hpp
ql/dataformatters.hpp list
ql/stochasticprocess.hpp ql/MonteCarlo/path.hpp
ql/Instruments/payoffs.hpp ql/Instruments/multiassetoption.hpp
ql/Instruments/basketoption.hpp
mcamericanbasketengine.hpp
Namespaces
• namespace QuantLib
ql/Instruments/basketoption.hpp ql/PricingEngines/mcsimulation.hpp
mcbasketengine.hpp
Namespaces
• namespace QuantLib
ql/stochasticprocess.hpp ql/option.hpp
ql/Instruments/multiassetoption.hpp ql/Instruments/payoffs.hpp
ql/Instruments/basketoption.hpp
stulzengine.hpp
Namespaces
• namespace QuantLib
Black formula.
#include <ql/Instruments/payoffs.hpp>
#include <ql/Math/normaldistribution.hpp>
Include dependency graph for blackformula.hpp:
ql/option.hpp
ql/dataformatters.hpp ql/Math/errorfunction.hpp
ql/Instruments/payoffs.hpp ql/Math/normaldistribution.hpp
blackformula.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/Math/normaldistribution.hpp
blackmodel.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/CapFloor/capfloorpricer.hpp
ql/PricingEngines/genericmodelengine.hpp analyticalcapfloor.hpp
ql/ShortRateModels/model.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/blackmodel.hpp
ql/PricingEngines/CapFloor/capfloorpricer.hpp blackcapfloor.hpp
ql/PricingEngines/genericmodelengine.hpp
Namespaces
• namespace QuantLib
ql/Instruments/capfloor.hpp ql/discretizedasset.hpp
capfloorpricer.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/latticeshortratemodelengine.hpp ql/Instruments/capfloor.hpp
treecapfloor.hpp
Namespaces
• namespace QuantLib
ql/Instruments/forwardvanillaoption.hpp
ql/Volatilities/impliedvoltermstructure.hpp forwardengine.hpp
ql/TermStructures/impliedtermstructure.hpp
Namespaces
• namespace QuantLib
10.229 ql/PricingEngines/Forward/forwardperformanceengine.hpp
File Reference
ql/PricingEngines/Forward/forwardengine.hpp
forwardperformanceengine.hpp
Namespaces
• namespace QuantLib
typeinfo ql/errors.hpp
ql/Patterns/observable.hpp ql/argsandresults.hpp
ql/pricingengine.hpp
genericmodelengine.hpp
Namespaces
• namespace QuantLib
ql/ShortRateModels/model.hpp ql/PricingEngines/genericmodelengine.hpp
latticeshortratemodelengine.hpp
Namespaces
• namespace QuantLib
ql/grid.hpp ql/MonteCarlo/montecarlomodel.hpp
mcsimulation.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/voltermstructure.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
ql/Instruments/quantovanillaoption.hpp
quantoengine.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/blackmodel.hpp
ql/PricingEngines/Swaption/swaptionpricer.hpp blackswaption.hpp
ql/PricingEngines/genericmodelengine.hpp
Namespaces
• namespace QuantLib
10.235 ql/PricingEngines/Swaption/jamshidianswaption.hpp
File Reference
ql/PricingEngines/Swaption/swaptionpricer.hpp
ql/ShortRateModels/onefactormodel.hpp jamshidianswaption.hpp
ql/PricingEngines/genericmodelengine.hpp
Namespaces
• namespace QuantLib
ql/Instruments/swaption.hpp ql/discretizedasset.hpp
swaptionpricer.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/latticeshortratemodelengine.hpp ql/Instruments/swaption.hpp
treeswaption.hpp
Namespaces
• namespace QuantLib
10.238 ql/PricingEngines/Vanilla/analyticdigitalamericanengine.hpp
File Reference
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
analyticdigitalamericanengine.hpp
Namespaces
• namespace QuantLib
10.239 ql/PricingEngines/Vanilla/analyticeuropeanengine.hpp
File Reference
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
analyticeuropeanengine.hpp
Namespaces
• namespace QuantLib
10.240 ql/PricingEngines/Vanilla/baroneadesiwhaleyengine.hpp
File Reference
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
baroneadesiwhaleyengine.hpp
Namespaces
• namespace QuantLib
ql/Lattices/binomialtree.hpp
ql/Math/normaldistribution.hpp
ql/PricingEngines/Vanilla/discretizedvanillaoption.hpp binomialengine.hpp
ql/TermStructures/flatforward.hpp
ql/Volatilities/blackconstantvol.hpp
Namespaces
• namespace QuantLib
10.242 ql/PricingEngines/Vanilla/bjerksundstenslandengine.hpp
File Reference
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
bjerksundstenslandengine.hpp
Namespaces
• namespace QuantLib
10.243 ql/PricingEngines/Vanilla/discretizedvanillaoption.hpp
File Reference
ql/discretizedasset.hpp
ql/Lattices/bsmlattice.hpp
discretizedvanillaoption.hpp
ql/Pricers/singleassetoption.hpp
ql/Instruments/vanillaoption.hpp
Namespaces
• namespace QuantLib
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
integralengine.hpp
Namespaces
• namespace QuantLib
10.245 ql/PricingEngines/Vanilla/jumpdiffusionengine.hpp
File Reference
ql/option.hpp ql/stochasticprocess.hpp
ql/Instruments/payoffs.hpp ql/Instruments/oneassetoption.hpp
ql/Instruments/oneassetstrikedoption.hpp
ql/Instruments/vanillaoption.hpp
jumpdiffusionengine.hpp
Namespaces
• namespace QuantLib
ql/exercise.hpp
ql/handle.hpp
ql/termstructure.hpp
mcdigitalengine.hpp
ql/voltermstructure.hpp
ql/MonteCarlo/mctraits.hpp
ql/PricingEngines/Vanilla/mcvanillaengine.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/Vanilla/mcvanillaengine.hpp
ql/Volatilities/blackconstantvol.hpp mceuropeanengine.hpp
ql/Volatilities/blackvariancecurve.hpp
Namespaces
• namespace QuantLib
ql/PricingEngines/mcsimulation.hpp ql/Instruments/vanillaoption.hpp
mcvanillaengine.hpp
Namespaces
• namespace QuantLib
qldefines.hpp
Namespaces
• namespace QuantLib
Defines
• #define QL_HEX_VERSION 0x000306f0
version hexadecimal number
• #define QL_DUMMY_RETURN(x)
specific per-compiler definitions Is a dummy return statement required?
• #define QL_IO_INIT
I/O initialization.
• #define QL_ALLOW_TEMPLATE_METHOD_CALLS 1
Blame Microsoft for this one...
• #define QL_TEMPLATE_METAPROGRAMMING_WORKS 1
• #define QL_SPECIALIZE_ITERATOR_TRAITS(T)
• #define QL_REVERSE_ITERATOR(iterator, type) std::reverse_iterator< iterator >
Blame Microsoft for this one...
• #define QL_FULL_ITERATOR_SUPPORT
ql/qldefines.hpp
ql/MonteCarlo/sample.hpp
boxmullergaussianrng.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/MonteCarlo/sample.hpp
centrallimitgaussianrng.hpp
Namespaces
• namespace QuantLib
haltonrsg.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/MonteCarlo/sample.hpp
inversecumgaussianrng.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/MonteCarlo/sample.hpp
inversecumgaussianrsg.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/MonteCarlo/sample.hpp vector
knuthuniformrng.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
lecuyeruniformrng.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
mt19937uniformrng.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
randomarraygenerator.hpp
Namespaces
• namespace QuantLib
ql/Math/array.hpp ql/MonteCarlo/sample.hpp
randomsequencegenerator.hpp
Namespaces
• namespace QuantLib
ql/MonteCarlo/pathgenerator.hpp
ql/RandomNumbers/mt19937uniformrng.hpp
ql/RandomNumbers/inversecumgaussianrng.hpp
ql/RandomNumbers/randomsequencegenerator.hpp rngtraits.hpp
ql/RandomNumbers/sobolrsg.hpp
ql/RandomNumbers/inversecumgaussianrsg.hpp
ql/Math/normaldistribution.hpp
Namespaces
• namespace QuantLib
ql/RandomNumbers/rngtraits.hpp
rngtypedefs.hpp
Namespaces
• namespace QuantLib
sobolrsg.hpp
Namespaces
• namespace QuantLib
ql/errors.hpp typeinfo
ql/handle.hpp list
ql/Patterns/observable.hpp
relinkablehandle.hpp
Namespaces
• namespace QuantLib
date scheduler
#include <ql/calendar.hpp>
#include <ql/null.hpp>
#include <vector>
Include dependency graph for scheduler.hpp:
ql/handle.hpp ql/date.hpp
ql/Patterns/bridge.hpp ql/null.hpp
ql/calendar.hpp vector
scheduler.hpp
Namespaces
• namespace QuantLib
ql/pricingengine.hpp ql/PricingEngines/blackmodel.hpp
calibrationhelper.hpp
Namespaces
• namespace QuantLib
10.266 ql/ShortRateModels/CalibrationHelpers/caphelper.hpp
File Reference
caphelper.hpp
Namespaces
• namespace QuantLib
10.267 ql/ShortRateModels/CalibrationHelpers/swaptionhelper.hpp
File Reference
ql/ShortRateModels/calibrationhelper.hpp ql/Instruments/swaption.hpp
swaptionhelper.hpp
Namespaces
• namespace QuantLib
ql/option.hpp
ql/Lattices/lattice.hpp
ql/ShortRateModels/parameter.hpp model.hpp
ql/ShortRateModels/calibrationhelper.hpp
ql/Optimization/problem.hpp
Namespaces
• namespace QuantLib
onefactormodel.hpp
Namespaces
• namespace QuantLib
10.270 ql/ShortRateModels/OneFactorModels/blackkarasinski.hpp
File Reference
Black-Karasinski model.
#include <ql/ShortRateModels/onefactormodel.hpp>
Include dependency graph for blackkarasinski.hpp:
ql/ShortRateModels/onefactormodel.hpp
blackkarasinski.hpp
Namespaces
• namespace QuantLib
10.271 ql/ShortRateModels/OneFactorModels/coxingersollross.hpp
File Reference
Cox-Ingersoll-Ross model.
#include <ql/ShortRateModels/onefactormodel.hpp>
Include dependency graph for coxingersollross.hpp:
ql/ShortRateModels/onefactormodel.hpp
coxingersollross.hpp
Namespaces
• namespace QuantLib
10.272 ql/ShortRateModels/OneFactorModels/extendedcoxingersollross.hpp
File Reference
ql/ShortRateModels/onefactormodel.hpp
ql/ShortRateModels/OneFactorModels/coxingersollross.hpp
extendedcoxingersollross.hpp
Namespaces
• namespace QuantLib
10.273 ql/ShortRateModels/OneFactorModels/hullwhite.hpp
File Reference
ql/ShortRateModels/onefactormodel.hpp
ql/ShortRateModels/OneFactorModels/vasicek.hpp
hullwhite.hpp
Namespaces
• namespace QuantLib
ql/ShortRateModels/onefactormodel.hpp
vasicek.hpp
Namespaces
• namespace QuantLib
parameter.hpp
Namespaces
• namespace QuantLib
twofactormodel.hpp
Namespaces
• namespace QuantLib
ql/ShortRateModels/twofactormodel.hpp ql/Instruments/swaption.hpp
g2.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
solver1d.hpp
Namespaces
• namespace QuantLib
Defines
• #define MAX_FUNCTION_EVALUATIONS 100
ql/qldefines.hpp
ql/solver1d.hpp
bisection.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/solver1d.hpp
brent.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/solver1d.hpp
falseposition.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/solver1d.hpp
ql/Solvers1D/newtonsafe.hpp
newton.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/solver1d.hpp
newtonsafe.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/solver1d.hpp
ridder.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/solver1d.hpp
secant.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/voltermstructure.hpp
stochasticprocess.hpp
Namespaces
• namespace QuantLib
ql/Patterns/observable.hpp ql/Patterns/bridge.hpp
ql/daycounter.hpp
swaptionvolstructure.hpp
Namespaces
• namespace QuantLib
Term structure.
#include <ql/calendar.hpp>
#include <ql/daycounter.hpp>
#include <ql/dataformatters.hpp>
#include <ql/marketelement.hpp>
#include <vector>
Include dependency graph for termstructure.hpp:
termstructure.hpp
Namespaces
• namespace QuantLib
ql/dataformatters.hpp
ql/ShortRateModels/model.hpp
affinetermstructure.hpp
ql/Optimization/method.hpp
ql/TermStructures/ratehelpers.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/Math/loglinearinterpolation.hpp
compoundforward.hpp
Namespaces
• namespace QuantLib
discountcurve.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/voltermstructure.hpp
drifttermstructure.hpp
Namespaces
• namespace QuantLib
ql/TermStructures/discountcurve.hpp map
extendeddiscountcurve.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/DayCounters/actual365.hpp
flatforward.hpp
Namespaces
• namespace QuantLib
10.295 ql/TermStructures/forwardspreadedtermstructure.hpp
File Reference
ql/termstructure.hpp
forwardspreadedtermstructure.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp
impliedtermstructure.hpp
Namespaces
• namespace QuantLib
ql/TermStructures/ratehelpers.hpp ql/solver1d.hpp
piecewiseflatforward.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp ql/voltermstructure.hpp
quantotermstructure.hpp
Namespaces
• namespace QuantLib
ql/Instruments/simpleswap.hpp
ratehelpers.hpp
Namespaces
• namespace QuantLib
zerocurve.hpp
Namespaces
• namespace QuantLib
ql/termstructure.hpp
zerospreadedtermstructure.hpp
Namespaces
• namespace QuantLib
Custom types.
#include <ql/qldefines.hpp>
Include dependency graph for types.hpp:
ql/qldefines.hpp
types.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
combiningiterator.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
ql/Utilities/iteratorcategories.hpp
couplingiterator.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
filteringiterator.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
iteratorcategories.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
processingiterator.hpp
Namespaces
• namespace QuantLib
ql/qldefines.hpp
steppingiterator.hpp
Namespaces
• namespace QuantLib
blackconstantvol.hpp
Namespaces
• namespace QuantLib
blackvariancecurve.hpp
Namespaces
• namespace QuantLib
blackvariancesurface.hpp
Namespaces
• namespace QuantLib
capflatvolvector.hpp
Namespaces
• namespace QuantLib
ql/marketelement.hpp vector
ql/voltermstructure.hpp
impliedvoltermstructure.hpp
Namespaces
• namespace QuantLib
ql/Volatilities/blackconstantvol.hpp
localconstantvol.hpp
Namespaces
• namespace QuantLib
ql/Volatilities/blackvariancecurve.hpp
localvolcurve.hpp
Namespaces
• namespace QuantLib
ql/voltermstructure.hpp ql/termstructure.hpp
localvolsurface.hpp
Namespaces
• namespace QuantLib
swaptionvolmatrix.hpp
Namespaces
• namespace QuantLib
ql/marketelement.hpp vector
voltermstructure.hpp
Namespaces
• namespace QuantLib
11.1 AmericanOption.cpp
#include <ql/quantlib.hpp>
std::cout << "Using " << QL_VERSION << std::endl << std::endl;
// our option
Option::Type type(Option::Put);
double underlying = 36;
double strike = 40;
Spread dividendYield = 0.00;
Rate riskFreeRate = 0.06;
double volatility = 0.20;
std::string method;
RelinkableHandle<Quote> underlyingH(
Handle<Quote>(new SimpleQuote(underlying)));
std::vector<Date> dates(4);
dates[0] = settlementDate.plusMonths(1);
dates[1] = exerciseDate;
dates[2] = exerciseDate.plusMonths(6);
dates[3] = exerciseDate.plusMonths(12);
std::vector<double> strikes(4);
strikes[0] = underlying*0.9;
strikes[1] = underlying;
strikes[2] = underlying*1.1;
strikes[3] = underlying*1.2;
Matrix vols(4,4);
vols[0][0] = volatility*1.1; vols[0][1] = volatility;
vols[0][2] = volatility*0.9; vols[0][3] = volatility*0.8;
vols[1][0] = volatility*1.1; vols[1][1] = volatility;
vols[1][2] = volatility*0.9; vols[1][3] = volatility*0.8;
vols[2][0] = volatility*1.1; vols[2][1] = volatility;
vols[2][2] = volatility*0.9; vols[2][3] = volatility*0.8;
vols[3][0] = volatility*1.1; vols[3][1] = volatility;
vols[3][2] = volatility*0.9; vols[3][3] = volatility*0.8;
RelinkableHandle<BlackVolTermStructure> blackSurface(
Handle<BlackVolTermStructure>(
new BlackVarianceSurface(settlementDate, dates, strikes, vols)));
Handle<StrikedTypePayoff> payoff(new
PlainVanillaPayoff(type, strike));
Handle<BlackScholesStochasticProcess> stochasticProcess(new
BlackScholesStochasticProcess(
underlyingH,
flatDividendTS,
flatTermStructure,
flatVolTS));
// European option
VanillaOption euroOption(stochasticProcess, payoff, exercise,
Handle<PricingEngine>(new AnalyticEuropeanEngine()));
// American option
VanillaOption option(stochasticProcess, payoff, amExercise);
new BinomialVanillaEngine<Trigeorgis>(timeSteps)));
value = option.NPV();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << " "
<< DoubleFormatter::toString(value, 6) << "\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;
return 0;
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
return 1;
} catch (...) {
11.2 BermudanSwaption.cpp
#include <ql/quantlib.hpp>
Size numRows = 5;
Size numCols = 10;
#if defined(QL_PATCH_DARWIN)
// to be investigated
return;
#endif
//Deposit rates
DayCounter depositDayCounter = Thirty360();
int settlementDays = 2;
Rate depositRates[12] = {
3.31, 3.32, 3.29, 3.35, 3.315, 3.33,
3.395, 3.41, 3.41, 3.49, 3.54, 3.53};
//Swap rates
Rate swapRates[13] = {
3.6425, 4.0875, 4.38, 4.5815, 4.74325, 4.87375,
4.9775, 5.07, 5.13, 5.1825, 5.36, 5.45125, 5.43875};
int swapYears[13] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30};
int swFixedLegFrequency = 1;
bool swFixedLegIsAdjusted = false;
DayCounter swFixedLegDayCounter = Thirty360(Thirty360::European);
int swFloatingLegFrequency = 2;
RelinkableHandle<TermStructure> rhTermStructure;
rhTermStructure.linkTo(myTermStructure);
std::vector<Period> swaptionMaturities;
swaptionMaturities.push_back(Period(1, Months));
swaptionMaturities.push_back(Period(3, Months));
swaptionMaturities.push_back(Period(6, Months));
swaptionMaturities.push_back(Period(1, Years));
swaptionMaturities.push_back(Period(2, Years));
swaptionMaturities.push_back(Period(3, Years));
swaptionMaturities.push_back(Period(4, Years));
swaptionMaturities.push_back(Period(5, Years));
swaptionMaturities.push_back(Period(7, Years));
swaptionMaturities.push_back(Period(10, Years));
CalibrationSet swaptions;
times.push_back(termTimes[i]);
// Building time-grid
TimeGrid grid(times.begin(), times.end(), 30);
Swaption bermudanSwaption(atmSwap,
bermudaExercise,
rhTermStructure,
Handle<PricingEngine>(new TreeSwaption(modelHW, 100)));
bermudanSwaption.setPricingEngine(
Handle<PricingEngine>(new TreeSwaption(modelHW2, 100)));
std::cout << "HW (num): " << bermudanSwaption.NPV() << std::endl;
bermudanSwaption.setPricingEngine(
Handle<PricingEngine>(new TreeSwaption(modelBK, 100)));
std::cout << "BK: " << bermudanSwaption.NPV() << std::endl;
Swaption otmBermudanSwaption(otmSwap,
bermudaExercise,
rhTermStructure,
Handle<PricingEngine>(new TreeSwaption(modelHW, 100)));
otmBermudanSwaption.setPricingEngine(
Handle<PricingEngine>(new TreeSwaption(modelHW2, 100)));
std::cout << "HW (num): " << otmBermudanSwaption.NPV() << std::endl;
otmBermudanSwaption.setPricingEngine(
Handle<PricingEngine>(new TreeSwaption(modelBK, 100)));
std::cout << "BK: " << otmBermudanSwaption.NPV() << std::endl;
Swaption itmBermudanSwaption(itmSwap,
bermudaExercise,
rhTermStructure,
Handle<PricingEngine>(new TreeSwaption(modelHW, 100)));
return 0;
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
return 1;
} catch (...) {
std::cout << "unknown error" << std::endl;
return 1;
}
}
11.3 DiscreteHedging.cpp
std::cout <<
}
// The value() method encapsulates the pricing code
double operator()(const Path& path) const;
private:
Option::Type type_;
double underlying_, strike_;
Rate r_;
Time maturity_;
double sigma_;
};
hedgesNum = 21;
rp.compute(hedgesNum, scenarios);
hedgesNum = 84;
rp.compute(hedgesNum, scenarios);
return 0;
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
return 1;
} catch (...) {
std::cout << "unknown error" << std::endl;
return 1;
}
}
// let’s start
Time t = 0;
/************************/
/*** the initial deal ***/
/************************/
// option fair price (Black-Scholes) at t=0
EuropeanOption option = EuropeanOption(type_, stock, strike_,
stockDividendYield, r_, maturity_, sigma_);
// sell the option, cash in its premium
money_account += option.value();
// compute delta
/**********************************/
/*** hedging during option life ***/
/**********************************/
for(int step = 0; step < n-1; step++){
// time flows
t += dt;
// stock growth:
// path contains the list of Gaussian variations
// and path[n] is the n-th variation
stockLogGrowth += path[step];
stock = underlying_*QL_EXP(stockLogGrowth);
// recalculate delta
delta = option.delta();
// re-hedging
money_account -= (delta - stockAmount)*stock;
stockAmount = delta;
}
/*************************/
/*** option expiration ***/
/*************************/
// last accrual on my money account
money_account *= QL_EXP( r_*dt );
// last stock growth
stockLogGrowth += path[n-1];
stock = underlying_*QL_EXP(stockLogGrowth);
// final Profit&Loss
return money_account;
}
// hedging interval
// double tau = maturity_ / nTimeSteps;
throughout time.
*/
double drift = r_ - 0.5*sigma_*sigma_;
11.4 EuropeanOption.cpp
This example calculates European options using different methods while testing call-put parity.
#include <ql/quantlib.hpp>
std::cout << "Using " << QL_VERSION << std::endl << std::endl;
// our option
Option::Type type(Option::Call);
double underlying = 7;
double strike = 8;
Spread dividendYield = 0.05;
Rate riskFreeRate = 0.05;
std::string method;
double value, discrepancy, rightValue, relativeDiscrepancy;
method ="Integral";
WeightedPayoff po(type, maturity, strike, underlying,
volatility, riskFreeRate, dividendYield);
SegmentIntegral integrator(5000);
/************************************/
RelinkableHandle<Quote> underlyingH(
Handle<Quote>(new SimpleQuote(underlying)));
std::vector<Date> dates(4);
dates[0] = settlementDate.plusMonths(1);
dates[1] = exerciseDate;
dates[2] = exerciseDate.plusMonths(6);
dates[3] = exerciseDate.plusMonths(12);
std::vector<double> strikes(4);
strikes[0] = underlying*0.9;
strikes[1] = underlying;
strikes[2] = underlying*1.1;
strikes[3] = underlying*1.2;
Matrix vols(4,4);
vols[0][0] = volatility*1.1;
vols[0][1] = volatility;
vols[0][2] = volatility*0.9;
vols[0][3] = volatility*0.8;
vols[1][0] = volatility*1.1;
vols[1][1] = volatility;
vols[1][2] = volatility*0.9;
vols[1][3] = volatility*0.8;
vols[2][0] = volatility*1.1;
vols[2][1] = volatility;
vols[2][2] = volatility*0.9;
vols[2][3] = volatility*0.8;
vols[3][0] = volatility*1.1;
vols[3][1] = volatility;
vols[3][2] = volatility*0.9;
vols[3][3] = volatility*0.8;
RelinkableHandle<BlackVolTermStructure> blackSurface(
Handle<BlackVolTermStructure>(
new BlackVarianceSurface(settlementDate, dates,
strikes, vols)));
Handle<StrikedTypePayoff> payoff(new
PlainVanillaPayoff(type, strike));
Handle<BlackScholesStochasticProcess> stochasticProcess(new
BlackScholesStochasticProcess(underlyingH, flatDividendTS,
flatTermStructure,
// blackSurface
flatVolTS));
// method: Integral
method = "Integral";
option.setPricingEngine(Handle<PricingEngine>(
new IntegralEngine()));
value = option.NPV();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << "\t"
<< DoubleFormatter::toString(value, 4) << "\t"
<< "N/A\t\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;
/*
// method: Integral
method = "Binary Cash";
option.setPricingEngine(Handle<PricingEngine>(
new IntegralCashOrNothingEngine(1.0)));
value = option.NPV();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << "\t"
<< DoubleFormatter::toString(value, 4) << "\t"
<< "N/A\t\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;
// method: Integral
method = "Binary Asset";
option.setPricingEngine(Handle<PricingEngine>(
new IntegralAssetOrNothingEngine()));
value = option.NPV();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << "\t"
<< DoubleFormatter::toString(value, 4) << "\t"
<< "N/A\t\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;
*/
Size timeSteps = 801;
value = option.NPV();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << "\t"
<< DoubleFormatter::toString(value, 4) << "\t"
<< "N/A\t\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;*/
#if defined(QL_PATCH_MICROSOFT)
Handle<PricingEngine> mcengine1(
new MCEuropeanEngine<PseudoRandom>(timeSteps, false, false,
Null<int>(), 0.02,
Null<int>(), mcSeed));
#else
Handle<PricingEngine> mcengine1 =
MakeMCEuropeanEngine<PseudoRandom>().withStepsPerYear(timeSteps)
.withTolerance(0.02)
.withSeed(mcSeed);
#endif
option.setPricingEngine(mcengine1);
value = option.NPV();
double errorEstimate = option.errorEstimate();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << "\t"
<< DoubleFormatter::toString(value, 4) << "\t"
<< DoubleFormatter::toString(errorEstimate, 4) << "\t\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;
#if defined(QL_PATCH_MICROSOFT)
Handle<PricingEngine> mcengine2(
new MCEuropeanEngine<LowDiscrepancy>(timeSteps, false, false,
nSamples, Null<double>(),
Null<int>()));
#else
Handle<PricingEngine> mcengine2 =
MakeMCEuropeanEngine<LowDiscrepancy>().withStepsPerYear(timeSteps)
.withSamples(nSamples);
#endif
option.setPricingEngine(mcengine2);
value = option.NPV();
discrepancy = QL_FABS(value-rightValue);
relativeDiscrepancy = discrepancy/rightValue;
std::cout << method << "\t"
<< DoubleFormatter::toString(value, 4) << "\t"
<< "N/A\t\t"
<< DoubleFormatter::toString(discrepancy, 6) << "\t"
<< DoubleFormatter::toString(relativeDiscrepancy, 6)
<< std::endl;
return 0;
} catch (std::exception& e) {
std::cout << e.what() << std::endl;
return 1;
} catch (...) {
std::cout << "unknown error" << std::endl;
return 1;
}
}
11.5 history_iterators.cpp
This code exemplifies how to use History iterators to perform gaussianstatistics analyses on
historical data.
// initialize a History
History h(...);
GaussianStatistics s;
s.addSequence(h.vdbegin(),h.vdend());
cout << "Historical mean: " << s.mean() << endl;
cout << "Std. deviation: " << s.standardDeviation() << endl;
History::const_valid_iterator min =
std::min_element(h.vbegin(),h.vend(),lessthan);
cout << "Minimum value: " << min->value()
<< " assumed " << DateFormatter::toString(min->date()) << endl;
11.6 swapvaluation.cpp
This is an example of using the QuantLib Term Structure for pricing a simple swap.
/* This example shows how to set up a Term Structure and then price a simple
swap.
*/
/*********************
*** MARKET DATA ***
*********************/
// deposits
double d1wQuote=0.0382;
double d1mQuote=0.0372;
double d3mQuote=0.0363;
double d6mQuote=0.0353;
double d9mQuote=0.0348;
double d1yQuote=0.0345;
// FRAs
double fra3x6Quote=0.037125;
double fra6x9Quote=0.037125;
double fra6x12Quote=0.037125;
// futures
double fut1Quote=96.2875;
double fut2Quote=96.7875;
double fut3Quote=96.9875;
double fut4Quote=96.6875;
double fut5Quote=96.4875;
double fut6Quote=96.3875;
double fut7Quote=96.2875;
double fut8Quote=96.0875;
// swaps
double s2yQuote=0.037125;
double s3yQuote=0.0398;
double s5yQuote=0.0443;
double s10yQuote=0.05165;
double s15yQuote=0.055175;
/********************
*** QUOTES ***
********************/
// deposits
Handle<Quote> d1wRate(new SimpleQuote(d1wQuote));
Handle<Quote> d1mRate(new SimpleQuote(d1mQuote));
/*********************
*** RATE HELPERS ***
*********************/
// deposits
DayCounter depositDayCounter = Actual360();
int settlementDays = 2;
// setup FRAs
Handle<RateHelper> fra3x6(new FraRateHelper(
RelinkableHandle<Quote>(fra3x6Rate),
// setup futures
int futMonths = 3;
Handle<RateHelper> fut1(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(19, December, 2001),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut2(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(20, March, 2002),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut3(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(19, June, 2002),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut4(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(18, September, 2002),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut5(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(18, December, 2002),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut6(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(19, March, 2003),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut7(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(18, June, 2003),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
Handle<RateHelper> fut8(new FuturesRateHelper(
RelinkableHandle<Quote>(fut1Price),
Date(17, September, 2003),
futMonths, calendar, ModifiedFollowing,
depositDayCounter));
// setup swaps
int swFixedLegFrequency = 1;
bool swFixedLegIsAdjusted = false;
DayCounter swFixedLegDayCounter = Thirty360(Thirty360::European);
int swFloatingLegFrequency = 2;
swFloatingLegFrequency));
Handle<RateHelper> s3y(new SwapRateHelper(
RelinkableHandle<Quote>(s3yRate),
3, Years, settlementDays,
calendar, ModifiedFollowing, swFixedLegFrequency,
swFixedLegIsAdjusted, swFixedLegDayCounter,
swFloatingLegFrequency));
Handle<RateHelper> s5y(new SwapRateHelper(
RelinkableHandle<Quote>(s5yRate),
5, Years, settlementDays,
calendar, ModifiedFollowing, swFixedLegFrequency,
swFixedLegIsAdjusted, swFixedLegDayCounter,
swFloatingLegFrequency));
Handle<RateHelper> s10y(new SwapRateHelper(
RelinkableHandle<Quote>(s10yRate),
10, Years, settlementDays,
calendar, ModifiedFollowing, swFixedLegFrequency,
swFixedLegIsAdjusted, swFixedLegDayCounter,
swFloatingLegFrequency));
Handle<RateHelper> s15y(new SwapRateHelper(
RelinkableHandle<Quote>(s15yRate),
15, Years, settlementDays,
calendar, ModifiedFollowing, swFixedLegFrequency,
swFixedLegIsAdjusted, swFixedLegDayCounter,
swFloatingLegFrequency));
/*********************
** CURVE BUILDING **
*********************/
// A depo-swap curve
std::vector<Handle<RateHelper> > depoSwapInstruments;
depoSwapInstruments.push_back(d1w);
depoSwapInstruments.push_back(d1m);
depoSwapInstruments.push_back(d3m);
depoSwapInstruments.push_back(d6m);
depoSwapInstruments.push_back(d9m);
depoSwapInstruments.push_back(d1y);
depoSwapInstruments.push_back(s2y);
depoSwapInstruments.push_back(s3y);
depoSwapInstruments.push_back(s5y);
depoSwapInstruments.push_back(s10y);
depoSwapInstruments.push_back(s15y);
Handle<TermStructure> depoSwapTermStructure(new
PiecewiseFlatForward(todaysDate, settlementDate,
depoSwapInstruments, termStructureDayCounter));
// A depo-futures-swap curve
std::vector<Handle<RateHelper> > depoFutSwapInstruments;
depoFutSwapInstruments.push_back(d1w);
depoFutSwapInstruments.push_back(d1m);
depoFutSwapInstruments.push_back(fut1);
depoFutSwapInstruments.push_back(fut2);
depoFutSwapInstruments.push_back(fut3);
depoFutSwapInstruments.push_back(fut4);
depoFutSwapInstruments.push_back(fut5);
depoFutSwapInstruments.push_back(fut6);
depoFutSwapInstruments.push_back(fut7);
depoFutSwapInstruments.push_back(fut8);
depoFutSwapInstruments.push_back(s3y);
depoFutSwapInstruments.push_back(s5y);
depoFutSwapInstruments.push_back(s10y);
depoFutSwapInstruments.push_back(s15y);
Handle<TermStructure> depoFutSwapTermStructure(new
PiecewiseFlatForward(todaysDate, settlementDate,
depoFutSwapInstruments, termStructureDayCounter));
// A depo-FRA-swap curve
std::vector<Handle<RateHelper> > depoFRASwapInstruments;
depoFRASwapInstruments.push_back(d1w);
depoFRASwapInstruments.push_back(d1m);
depoFRASwapInstruments.push_back(d3m);
depoFRASwapInstruments.push_back(fra3x6);
depoFRASwapInstruments.push_back(fra6x9);
depoFRASwapInstruments.push_back(fra6x12);
depoFRASwapInstruments.push_back(s2y);
depoFRASwapInstruments.push_back(s3y);
depoFRASwapInstruments.push_back(s5y);
depoFRASwapInstruments.push_back(s10y);
depoFRASwapInstruments.push_back(s15y);
Handle<TermStructure> depoFRASwapTermStructure(new
PiecewiseFlatForward(todaysDate, settlementDate,
depoFRASwapInstruments, termStructureDayCounter));
/*********************
* SWAPS TO BE PRICED *
**********************/
// floating leg
int floatingLegFrequency = 2;
Handle<Xibor> euriborIndex(new Euribor(6, Months,
forecastingTermStructure)); // using the forecasting curve
Spread spread = 0.0;
int lenghtInYears = 5;
bool payFixedRate = true;
SimpleSwap spot5YearSwap(payFixedRate, settlementDate, lenghtInYears,
Years, calendar, roll, nominal, fixedLegFrequency, fixedRate,
fixedLegIsAdjusted, fixedLegDayCounter, floatingLegFrequency,
euriborIndex, fixingDays, spread,
discountingTermStructure); // using the discounting curve
SimpleSwap oneYearForward5YearSwap(payFixedRate,
calendar.advance(settlementDate, 1, Years, ModifiedFollowing),
lenghtInYears, Years,
calendar, roll, nominal, fixedLegFrequency, fixedRate,
fixedLegIsAdjusted, fixedLegDayCounter, floatingLegFrequency,
euriborIndex, fixingDays, spread,
/***************
* SWAP PRICING *
****************/
// calculations
double NPV;
Rate fairRate;
Spread fairSpread;
NPV = spot5YearSwap.NPV();
fairSpread = spot5YearSwap.fairSpread();
fairRate = spot5YearSwap.fairRate();
// let’s check that the 5 years swap has been correctly re-priced
QL_REQUIRE(QL_FABS(fairRate-s5yQuote)<1e-8,
"5-years swap mispriced!");
forecastingTermStructure.linkTo(depoFutSwapTermStructure);
discountingTermStructure.linkTo(depoFutSwapTermStructure);
NPV = spot5YearSwap.NPV();
fairSpread = spot5YearSwap.fairSpread();
fairRate = spot5YearSwap.fairRate();
QL_REQUIRE(QL_FABS(fairRate-s5yQuote)<1e-8,
"5-years swap mispriced!");
forecastingTermStructure.linkTo(depoFRASwapTermStructure);
discountingTermStructure.linkTo(depoFRASwapTermStructure);
NPV = spot5YearSwap.NPV();
fairSpread = spot5YearSwap.fairSpread();
fairRate = spot5YearSwap.fairRate();
QL_REQUIRE(QL_FABS(fairRate-s5yQuote)<1e-8,
"5-years swap mispriced!");
std::cout << tab << "5-years, 1-year forward swap paying "
<< RateFormatter::toString(fixedRate,2) << std::endl;
std::cout << headers[0] << separator
<< headers[1] << separator
<< headers[2] << separator
<< headers[3] << separator << std::endl;
std::cout << rule << std::endl;
forecastingTermStructure.linkTo(depoSwapTermStructure);
discountingTermStructure.linkTo(depoSwapTermStructure);
NPV = oneYearForward5YearSwap.NPV();
fairSpread = oneYearForward5YearSwap.fairSpread();
fairRate = oneYearForward5YearSwap.fairRate();
forecastingTermStructure.linkTo(depoFutSwapTermStructure);
discountingTermStructure.linkTo(depoFutSwapTermStructure);
NPV = oneYearForward5YearSwap.NPV();
fairSpread = oneYearForward5YearSwap.fairSpread();
fairRate = oneYearForward5YearSwap.fairRate();
forecastingTermStructure.linkTo(depoFRASwapTermStructure);
discountingTermStructure.linkTo(depoFRASwapTermStructure);
NPV = oneYearForward5YearSwap.NPV();
fairSpread = oneYearForward5YearSwap.fairSpread();
fairRate = oneYearForward5YearSwap.fairRate();
// now let’s say that the 5-years swap rate goes up to 4.60%.
// A smarter market element--say, connected to a data source-- would
// notice the change itself. Since we’re using SimpleQuotes,
// we’ll have to change the value manually--which forces us to
// downcast the handle and use the SimpleQuote
// interface. In any case, the point here is that a change in the
// value contained in the Quote triggers a new bootstrapping
// of the curve and a repricing of the swap.
#if defined(HAVE_BOOST)
Handle<SimpleQuote> fiveYearsRate =
boost::dynamic_pointer_cast<SimpleQuote>(s5yRate);
#else
Handle<SimpleQuote> fiveYearsRate = s5yRate;
#endif
fiveYearsRate->setValue(0.0460);
NPV = spot5YearSwap.NPV();
fairSpread = spot5YearSwap.fairSpread();
fairRate = spot5YearSwap.fairRate();
QL_REQUIRE(QL_FABS(fairRate-s5yRate->value())<1e-8,
"5-years swap mispriced!");
forecastingTermStructure.linkTo(depoFutSwapTermStructure);
discountingTermStructure.linkTo(depoFutSwapTermStructure);
NPV = spot5YearSwap.NPV();
fairSpread = spot5YearSwap.fairSpread();
fairRate = spot5YearSwap.fairRate();
QL_REQUIRE(QL_FABS(fairRate-s5yRate->value())<1e-8,
"5-years swap mispriced!");
forecastingTermStructure.linkTo(depoFRASwapTermStructure);
discountingTermStructure.linkTo(depoFRASwapTermStructure);
NPV = spot5YearSwap.NPV();
fairSpread = spot5YearSwap.fairSpread();
fairRate = spot5YearSwap.fairRate();
QL_REQUIRE(QL_FABS(fairRate-s5yRate->value())<1e-8,
"5-years swap mispriced!");
std::cout << tab << "5-years, 1-year forward swap paying "
<< RateFormatter::toString(fixedRate,2) << std::endl;
std::cout << headers[0] << separator
<< headers[1] << separator
<< headers[2] << separator
<< headers[3] << separator << std::endl;
std::cout << rule << std::endl;
forecastingTermStructure.linkTo(depoSwapTermStructure);
discountingTermStructure.linkTo(depoSwapTermStructure);
NPV = oneYearForward5YearSwap.NPV();
fairSpread = oneYearForward5YearSwap.fairSpread();
fairRate = oneYearForward5YearSwap.fairRate();
forecastingTermStructure.linkTo(depoFutSwapTermStructure);
discountingTermStructure.linkTo(depoFutSwapTermStructure);
NPV = oneYearForward5YearSwap.NPV();
fairSpread = oneYearForward5YearSwap.fairSpread();
fairRate = oneYearForward5YearSwap.fairRate();
forecastingTermStructure.linkTo(depoFRASwapTermStructure);
discountingTermStructure.linkTo(depoFRASwapTermStructure);
NPV = oneYearForward5YearSwap.NPV();
fairSpread = oneYearForward5YearSwap.fairSpread();
fairRate = oneYearForward5YearSwap.fairRate();
return 0;
} catch (std::exception& e) {
Todo List
Class AmericanExercise(p. 116) check that everywhere the American condition is applied from
the earliestDate and not earlier
Class AnalyticDigitalAmericanEngine(p. 121) add more greeks (as of now only delta and rho
available)
Class BermudanExercise(p. 143) it would be nice to have a way for making a Bermudan with
one exercise date equivalent to an European
Class CapFlatVolatilityVector(p. 194) Either add correct copy behavior or inhibit copy. Right
now, a copied instance would end up with its own copy of the length vector but an interpo-
lation pointing to the original ones.
Class ContinuousGeometricAPO(p. 217) add Average Strike version and make it backward
starting
Class EarlyExercise(p. 272) derive a plain American Exercise class (no earliestDate, no payoff-
AtExpiry)
Class MixedScheme(p. 445) a) derive variable theta schemes b) introduce multi time-level
schemes.
Class MultiPathGenerator(p. 456) why store correlation Matrix rather than covariance?
Class Path(p. 501) should Path include the t=0.0 point? Alternatively all path pricers must be
revisited.
Class Solver1D(p. 565) a) Clean up the interface so that it is clear whether the accuracy is speci-
fied for x or f(x). b) Add target value (now the target value is 0.0)
Class SwaptionVolatilityMatrix(p. 589) Either add correct copy behavior or inhibit copy. Right
now, a copied instance would end up with its own copy of the exercise date and length
vector but an interpolation pointing to the original ones.
Class TimeGrid(p. 601) What was the rationale for limiting the grid to positive times? Investi-
gate and see whether we can use it for negative ones as well.
Deprecated List
Member CLGaussianRng(p. 203)(long seed=0) initialize with a random number generator in-
stead.
Member ICGaussianRng(p. 350)(long seed=0) initialize with a random number generator in-
stead.
Bug List
Class BPSBasketCalculator(p. 176) This class must still be checked. It is not guaranteed to yield
the right results.
Class CoxIngersollRoss(p. 224) This class was not tested enough to guarantee its functionality.
Class ExtendedCoxIngersollRoss(p. 285) This class was not tested enough to guarantee its func-
tionality.
Class FdDividendAmericanOption(p. 296) sometimes yields negative vega when deeply in-
the-money
method impliedVolatility() utterly fails
Class G2(p. 321) This class was not tested enough to guarantee its functionality.
Class MCAmericanBasketEngine(p. 422) This engine does not yet work for put options. More
problems might surface.
Member impliedVolatility(p. 477)(double price, double accuracy=1.0e-4, Size maxEvaluations=100, double minV
run-time crashes are possible with the Borland compiler
Member sensitivity(p. 582)(int basis=2) const This method must still be checked. It is not guar-
anteed to yield the right results.
Index
add calibrate
QuantLib::GeneralStatistics, 331 QuantLib::ShortRateModel, 551
QuantLib::IncrementalStatistics, 362 Character functions, 101
addSequence CLGaussianRng
QuantLib::IncrementalStatistics, 362 QuantLib::CLGaussianRng, 203
advance compoundForwardImpl
QuantLib::Calendar, 186 QuantLib::DiscountStructure, 251
amount QuantLib::ExtendedDiscountCurve,
QuantLib::CashFlow, 200 289
QuantLib::FixedRateCoupon, 304 QuantLib::ForwardRateStructure, 311
QuantLib::IndexedCoupon, 365 QuantLib::ZeroYieldStructure, 638
QuantLib::ParCoupon, 500 Coupon
QuantLib::Short, 548 QuantLib::Coupon, 223
QuantLib::SimpleCashFlow, 553 CubicSpline
applyAfterApplying QuantLib::CubicSpline, 231
QuantLib::BoundaryCondition, 172
applyAfterSolving DayCounter
QuantLib::BoundaryCondition, 172 QuantLib::DayCounter, 241
applyBeforeApplying DEFINE_SEQUENCE_STAT_CONST_-
QuantLib::BoundaryCondition, 172 METHOD_DOUBLE
applyBeforeSolving sequencestatistics.hpp, 788
QuantLib::BoundaryCondition, 172 DEFINE_SEQUENCE_STAT_CONST_-
averageShortfall METHOD_VOID
QuantLib::GenericRiskStatistics, 336 sequencestatistics.hpp, 788
diffusion
BicubicSpline QuantLib::BlackScholesProcess, 162
QuantLib::BicubicSpline, 144 QuantLib::DiffusionProcess, 246
BilinearInterpolation QuantLib::OrnsteinUhlenbeckProcess,
QuantLib::BilinearInterpolation, 146 493
blackVarianceImpl QuantLib::SquareRootProcess, 567
QuantLib::BlackVolatilityTerm- discountImpl
Structure, 169 QuantLib::ForwardRateStructure, 311
blackVolImpl QuantLib::ZeroYieldStructure, 638
QuantLib::BlackVarianceTerm- downsideDeviation
Structure, 168 QuantLib::GenericRiskStatistics, 335
BoundaryCondition QuantLib::IncrementalStatistics, 361
QuantLib::CubicSpline, 231 downsideVariance
BoxMullerGaussianRng QuantLib::GenericRiskStatistics, 334
QuantLib::BoxMullerGaussianRng, 175 QuantLib::IncrementalStatistics, 361
calculate Error
QuantLib::Instrument, 368 QuantLib::Error, 277
QuantLib::LazyObject, 392 errorEstimate
Calendar QuantLib::GeneralStatistics, 330
QuantLib::Calendar, 185 QuantLib::IncrementalStatistics, 361
INDEX 1007
QuantLib::GeneralStatistics, 331
unfreeze
QuantLib::LazyObject, 392
update
QuantLib::AffineTermStructure, 114
QuantLib::BlackConstantVol, 156
QuantLib::BlackModel, 159
QuantLib::BlackVarianceCurve, 165
QuantLib::BlackVarianceSurface, 167
QuantLib::CalibrationHelper, 190
QuantLib::CompositeQuote, 212
QuantLib::DerivedQuote, 245
QuantLib::DriftTermStructure, 270
QuantLib::ExtendedDiscountCurve,
289
QuantLib::ForwardSpreadedTerm-
Structure, 314
QuantLib::GenericModelEngine, 333
QuantLib::ImpliedTermStructure, 356
QuantLib::ImpliedVolTermStructure,
358
QuantLib::IndexedCoupon, 365
QuantLib::LatticeShortRateModel-
Engine, 389
QuantLib::LazyObject, 392
QuantLib::LocalConstantVol, 407
QuantLib::LocalVolCurve, 409
QuantLib::LocalVolSurface, 411
QuantLib::Observer, 475
QuantLib::ParCoupon, 500
QuantLib::QuantoTermStructure, 529
QuantLib::RateHelper, 537
QuantLib::ShortRateModel, 551
QuantLib::StochasticProcess, 573
QuantLib::Xibor, 632
QuantLib::ZeroSpreadedTerm-
Structure, 637
valueAtRisk
QuantLib::GenericRiskStatistics, 335
variance
QuantLib::DiffusionProcess, 246
QuantLib::GeneralStatistics, 330
QuantLib::IncrementalStatistics, 361
QuantLib::OrnsteinUhlenbeckProcess,
493
zeroYieldImpl
QuantLib::DiscountStructure, 251
QuantLib::ForwardRateStructure, 311
QuantLib::ForwardSpreadedTerm-
Structure, 314