Newsletter ~ Spring 2008
Here is the latest news from SciComp on SciFinance®, the complete solution that automates coding and delivers source code (C/C++) for derivatives pricing and risk models.
Table of Contents
Technical Article
Recent technical article
"General Monte Carlo Greeks in Practice" published in
Wilmott Magazine
Upcoming Events
SciComp to exhibit at ICBI Global Derivatives 2008 in Paris, France
SciFinance How-To Example
How to specify vectors of PDEs
New SciFinance Examples
Expanded SciFinance Examples Catalogs
New SciFinance ASPEN Language/ Numerical Method Features
MicroGrid available
inside Discrete Events - SciPDE
Sobol has been extended to 1110 dimensions - SciMC
Technical Articles
Technical Article on "The Greeks" in Monte Carlo
A recent technical article, "General Monte Carlo Greeks in Practice", By SciComp's Qimou Su and Curt Randall was published in Wilmott Magazine.
The article suggests three Monte Carlo algorithms for the computation o derivative price sensititives (the "Greeks). The first algorithm is a finite difference implementation of the likelihood ratio method introduced by Broadie and Glasserman (1996). Two additional schemes further improve the performance and applicability.
"...The simplest general approach for estimating the Greeks is based on finite differences, in which the Monte Carlo pricing function is called to revalue the derivative at perturbed parameters and a finite difference is applied to approximate the partial derivatives (price sensitivities). The advantage of such estimation lies in its independence of the underlying model and payoff structure, enabling a generic implementation with little additional programming..."
To read the entire technical article, you can download it here:
Download "General
Monte Carlo Greeks in Practice" article.
Upcoming Events
SciComp to Exhibit at ICBI Global Derivatives 2008 - Paris
SciComp will demonstrate its products at the ICBI Global Derivatives 2008 meeting in Paris on May 20-22. Attended by leading industry players, Global Derivatives 208 is Europe's largest, longest running, and most internationally recognized derivatives and risk management event.
If you are interested in attending the show, let us know. SciComp contacts receive a nice discount. For more information, click to email SciComp sales.
SciFinance How-to Example
How to specify vectors of PDEs
How do you specify vectors of PDEs in SciFinance?
This example will
show you how, with vectors of strikes. PdeEuropeanVec1 simultaneously
prices multiple European options under a simple Black-Scholes model.
Instead of inputting a single strike K, we input an array of strikes
K(iK). The option value V and the array K are declared to be Vectors
of the same index iK.
The SciFinance-synthesized code will be identical to that for a
non-Vector version except that an extra index iK is appended to the
arrays for V (replicating the pricing PDE nK times) and for any outputs
that depend on V.
In an application where a series of different payoffs for the same
pricing PDE is needed, this code style can save computation
time because each PDE solution can make use of the common finite
difference matrix elements, which need be computed only once. The
computation savings are greatest for problems with time-dependent PDEs
for which matrix elements are recomputed each time step. In order to use
this code style, the same pricing PDE must be used for each payoff in the Vector.
Only the payoff may be dependent on the Vector index iK, not
any of the parameters of the PDE or associated boundary conditions.
(* pdeEuropeanVec1.s *)
PDE[]; CrankNicholson;
Region[xMin<=x<=xMax && 0<=tau<=TMax, GeneralCoordinates[{x},tau]];
OldCoordinates[{{S},t}];
S==Spot Sinh[x];
t==tau;
When[Interior,
BlackScholes1D[D0->q]];
payoff==if[call, Max[S-K,0], Max[K-S,0]];
When[Boundary, AutomaticBC];
When[max[tau], V==MicroGrid[payoff]];
Vector[{V,K}, {iK,1,nK}];
ReadArray[{K}, {iK,1,nK}, "Strikes.dat"];
Default[TaggedInputFile["pdeinit.dat"], NoInitialOutput, Labelled];
Output[V, S==Spot, CubicSpline, "atSpot.out"];
ReadOrCompute[{xMin,xMax,iMax,nMax}];
stddev==Max[4 sigma Sqrt[TMax], 0.1];
xMinK==Exp[-stddev - r TMax];
xMaxK==Exp[ stddev + q TMax];
xMin==Log[xMinK + Sqrt[1 + xMinK^2]];
xMax==Log[xMaxK + Sqrt[1 + xMaxK^2]];
delx0==Min[xMax-xMin,4]/100;
iMax0==Round[(xMax-xMin)/delx0];
iMax==Round[iMax0 Sqrt[Accuracy]];
delx==(xMax-xMin)/iMax;
ndiff==Round[sigma^2 TMax/(10 delx^2)];
nconv==Round[2 Abs[r-q] TMax/delx];
nMax==Max[20, ndiff, nconv];
GridSize[{{iMax},nMax}];
Figure 1: Specification file for pdeEuropeanVec1.s.
Numerical Results
The table below presents computed option value V and
error relative to the theoretical Black-Scholes value
VBS, versus strike K.
| K | V | V–VBS |
| 70 | 0.2500 | 0.0003 |
| 75 | 0.5621 | 0.0004 |
| 80 | 1.1144 | 0.0003 |
| 85 | 1.9909 | 0.0003 |
| 90 | 3.2640 | 0.0002 |
| 95 | 4.9824 | 0.0001 |
| 100 | 7.1659 | 0.0000 |
| 105 | 9.8060 | 0.0000 |
| 110 | 12.8713 | 0.0001 |
| 115 | 16.3148 | 0.0002 |
| 120 | 20.0816 | 0.0003 |
| 125 | 24.1155 | 0.0004 |
| 130 | 28.3635 | 0.0004 |
| 135 | 32.7786 | 0.0005 |
| 140 | 37.3213 | 0.0005 |
Table 1: ATM European put value versus strike K. Parameters:
TMax=0.5, q=0, sigma=0.3, r=0.05,
Spot=100, iMax=nMax=xMin=Max=-999, Accuracy=4
New SciFinance Examples
The SciFinance Examples Catalogs provide hundreds of
pricing and risk
model templates for all asset classes. The latest release includes
many new model templates across asset classes.
Commodities
pdeCSFutOpt1 - This example prices a European or American option on
either a commodity future or commodity spot price under the one-factor
spot rate model of Clewlow and Strickland.
pdeCSCommodSwaption1 - This example prices a European or Bermudan
swaption on commodity futures under the one factor spot rate model
of Clewlow and Strickland.
PDE Vectors
pdeEuropeanVec1 – This example simultaneously prices multiple European
options under a simple Black-Scholes model. The option model is similar
to pdeEuropean2, but instead of inputting a single strike K, we input
an array of strikes K(iK).
pdeBasket2DVec1 - The pdeBasket2DVec1.s file simultaneously prices
multiple European two-asset basket options under a simple Black-Scholes
model. The option model is similar to pdeTwoAsset1, but instead of
inputting a single strike K, we input an array of strikes K(iK).
Volatility and variance swaps
mcVolSwaption1 - This example prices a European or Bermudan volatility
swaption using a simple Black-Scholes model in a quasi-random Monte
Carlo framework.
mcSVForVarSwap1 - This example prices a forward starting volatility
swap under a Heston stochastic volatility model in a quasi-random
Monte Carlo framework.
mcVarSwap1 - This example prices a variance swap using a simple
Black-Scholes model in a quasi-random Monte Carlo framework. The
model is the Monte Carlo analog of the pdeVolSwap1 example.
mcVolContract - This example generalizes the mcVarSwap1 example
to
price six types of volatility contracts using a simple Black-Scholes
model in a quasi-random Monte Carlo framework.
Fixed Income
mcG1CallRatchetNote1 – This example prices a bullet callable (Bermudan
callable) ratchet cap note under a one-factor Gaussian short-rate model.
It is the Monte Carlo analog of the example pdeG1RatchetNote1.
mcG1CallFRN1 - The mcG1CallFRN1 specification prices a bullet
callable
(Bermudan callable) floating rate note under a one-factor additive
Gaussian short-rate model.
pdeG1RatchetNote1 – The pdeG1RachetNote1.s specification prices a bullet
callable (Bermudan callable) ratchet cap note under a one-factor
additive Gaussian short-rate model.
pdeG1CallFRN1 – The pdeG1CallFRN1.s specification prices a bullet
callable (Bermudan callable) floating rate note (FRN) under a one-factor additive
Gaussian short-rate model.
Americans
mcBermBasket1 – This example illustrates how to synthesize a PDE
model with an outer wrapper that varies one parameter of the model to
generate a value, i.e. to calibrate a single parameter of the model to
a market price.
mcBermBasket2 – This specification prices Bermudan options on an
nD-asset basket using the Longstaff-Schwartz regression method,
where nD (the number of assets on the basket) is an arbitrary
run-time
parameter.
mcBermBasket3 – This specification prices Bermudan options on an
nD-asset basket using the Longstaff-Schwartz regression method,
where
nD (the number of assets on the basket) is an arbitrary run-time
parameter.
Vanilla with complex stock process
mcMilstein1 - This example illustrates the use of the Milstein
discretization scheme. We compare numerical results of the Milstein
scheme to those for Euler and LogEuler.
Vanilla
pdeImpliedVol1 – Illustrates how to synthesize a PDE model with an outer
wrapper that varies one parameter of the model to generate a particular
value, i.e. to calibrate a single parameter of the model to a market price.
Credit
mcCLO - This example shows how to price a CLO with Monte Carlo
simulation& Li’s method, how to specify cashflow CDOs, floating rate
loans as underlying collateral, interest coverage, and
overcollateralization tests.
Calibration
calATMGabillon1 – This example calibrates (in a least-squares sense)
a
constant coefficient Gabillon model to a collection of at-the-money
futures options.
calATMCS991 - This example calibrates (in a least-squares sense) a one-
factor constant coefficient Clewlow and Strickland to a collection of
at-the-money futures options.
calCEVLeaseSqr1PDE1 - This specification demonstrates a Levenberg-
Marquardt least-squares calibration of a constant coefficient Heston
Stochastic volatility model.
calHestonLeastSqrPDE1 - This specification demonstrates a Levenberg-
Marquardt least-squares calibration of a constant elasticity of variance
(CEV) model.
New SciFinance ASPEN Language/ Numerical Method Features
ASPEN (Algorithm
SPEcification Notation) is a concise, flexible, and
extensible language for specifying the derivatives structures you want
to model with SciFinance. Below are some of ASPEN's newest features,
for the finite difference module of SciFinance (SciPDE) and the Monte
Carlo module of SciFinance (SciMC).
MicroGrid available inside Discrete Events - SciPDE
In SciPDE, MicroGrid is
now allowed inside the DiscreteEvents
statement. The use of MicroGrid inside discrete events is similar to its
use in defining payoffs. For an example, the new pdeCSCommodSwaption1
includes the following specification fragment:
ExerciseAtEnd[functions[ if[bermudan || ie==1, ExerPrem==MicroGrid[Max[VSwap-VOpt,0]]; VOpt==VOpt + ExerPrem]], tsample==ExerDates],
Note however that when MicroGrid is used inside a discrete event, the variables
in the first argument are *not* expanded, even if they are defined by other
equations.
Also, MicroGrid is now allowed on variables of the same size as a
Spatial dimension as well as on spatial dimensions themselves; its
efficiency is improved by moving user-defined stub functions outside
of the MicroGrid subroutine and omitting loops over dimensions not
used in the payoff or path.
Sobol has been extended to 1110 dimensions - SciMC
A new Sobol algorithm that
handles up to 1110 dimensions has
replaced the previous 360-dimension method.[1] The Sobol specification statement is:
Sobol;The algorithm is unchanged, but there are new initial direction numbers taken
from tables that may be found at:
http://www.math.waikato.ac.nz/~stephenj/soboltab.txt
The previous method using the previous set of initial direction numbers
is available via the specification statement:
OldSobol;
ExtendQR still works the same way it did previously.
[1] References
1. Stephen Joe, Frances Kuo
"Remark on Algorithm 659: Implementing Sobol's Quasirandom
Sequence Generator", ACM Transactions on Mathematical Software,
Volume 29, Number 1, p. 49-57, 2003.
2. Paul Bratley, Bennett Fox,
"Algorithm 659: Implementing Sobol's Quasirandom
Sequence Generator",
ACM Transactions on Mathematical Software,
Volume 14, Number 1, p. 88-100, 1988.
