Package multiassetoptions

Similar documents
Finite Difference Approximation of Hedging Quantities in the Heston model

MATH60082 Example Sheet 6 Explicit Finite Difference

AN OPERATOR SPLITTING METHOD FOR PRICING THE ELS OPTION

Package GenOrd. September 12, 2015

Research Article Exponential Time Integration and Second-Order Difference Scheme for a Generalized Black-Scholes Equation

An IMEX-method for pricing options under Bates model using adaptive finite differences Rapport i Teknisk-vetenskapliga datorberäkningar

Package scenario. February 17, 2016

Infinite Reload Options: Pricing and Analysis

Numerical Methods in Option Pricing (Part III)

The RQuantLib Package

Pricing American Options Using a Space-time Adaptive Finite Difference Method

A Study on Numerical Solution of Black-Scholes Model

Numerical Methods and Volatility Models for Valuing Cliquet Options

Package cbinom. June 10, 2018

CONVERGENCE OF NUMERICAL METHODS FOR VALUING PATH-DEPENDENT OPTIONS USING INTERPOLATION

FX Smile Modelling. 9 September September 9, 2008

PDE Methods for Option Pricing under Jump Diffusion Processes

Calibration Lecture 4: LSV and Model Uncertainty

Package tailloss. August 29, 2016

SPREAD OPTION PRICING USING ADI METHODS

Finite Element Method

Chapter 20: An Introduction to ADI and Splitting Schemes

Application of an Interval Backward Finite Difference Method for Solving the One-Dimensional Heat Conduction Problem

Richardson Extrapolation Techniques for the Pricing of American-style Options

Package optimstrat. September 10, 2018

Package ELMSO. September 3, 2018

American Equity Option Valuation Practical Guide

Matrix-based numerical modelling of financial differential equations. Robert Piché and Juho Kanniainen

On coordinate transformation and grid stretching for sparse grid pricing of basket options

Lecture 4 - Finite differences methods for PDEs

A local RBF method based on a finite collocation approach

CS 774 Project: Fall 2009 Version: November 27, 2009

Improved radial basis function methods for multi-dimensional option pricing

A distributed Laplace transform algorithm for European options

FINITE DIFFERENCE METHODS

Valuation of performance-dependent options in a Black- Scholes framework

Heston Stochastic Local Volatility Model

Reduced models for sparse grid discretizations of the multi-asset Black-Scholes equation

Boundary conditions for options

An Adjusted Trinomial Lattice for Pricing Arithmetic Average Based Asian Option

PDE Methods for the Maximum Drawdown

Package ragtop. September 28, 2016

Advanced Numerical Techniques for Financial Engineering

THE USE OF NUMERAIRES IN MULTI-DIMENSIONAL BLACK- SCHOLES PARTIAL DIFFERENTIAL EQUATIONS. Hyong-chol O *, Yong-hwa Ro **, Ning Wan*** 1.

Intensity-based framework for optimal stopping

NUMERICAL METHODS OF PARTIAL INTEGRO-DIFFERENTIAL EQUATIONS FOR OPTION PRICE

FE610 Stochastic Calculus for Financial Engineers. Stevens Institute of Technology

Finite difference method for the Black and Scholes PDE (TP-1)

Package smam. October 1, 2016

Computational Finance Finite Difference Methods

A GAUSS Implementation of Non Uniform Grids for PDE The PDE library

1. Introduction. Options having a payo which depends on the average of the underlying asset are termed Asian options. Typically the average is arithme

Package FADA. May 20, 2016

Hedging Derivative Securities with VIX Derivatives: A Discrete-Time -Arbitrage Approach

EFFICIENT MONTE CARLO ALGORITHM FOR PRICING BARRIER OPTIONS

Using radial basis functions for option pricing

Option pricing using TR-BDF2 time stepping method

Monte Carlo Methods in Structuring and Derivatives Pricing

Accelerated Option Pricing Multiple Scenarios

A High-order Front-tracking Finite Difference Method for Pricing American Options under Jump-Diffusion Models

Modeling multi-factor financial derivatives by a Partial Differential Equation approach with efficient implementation on Graphics Processing Units

Package dng. November 22, 2017

Yao s Minimax Principle

Cash Accumulation Strategy based on Optimal Replication of Random Claims with Ordinary Integrals

MAFS Computational Methods for Pricing Structured Products

AEM Computational Fluid Dynamics Instructor: Dr. M. A. R. Sharif

Financial Computing with Python

A model reduction approach to numerical inversion for parabolic partial differential equations

Chapter 5 Finite Difference Methods. Math6911 W07, HM Zhu

Continuous-time Stochastic Control and Optimization with Financial Applications

Remarks on stochastic automatic adjoint differentiation and financial models calibration

Numerical Solution of Two Asset Jump Diffusion Models for Option Valuation

MATH3075/3975 FINANCIAL MATHEMATICS TUTORIAL PROBLEMS

Pricing with a Smile. Bruno Dupire. Bloomberg

As an example, we consider the following PDE with one variable; Finite difference method is one of numerical method for the PDE.

Numerical schemes for SDEs

Evaluation of Asian option by using RBF approximation

1 The Hull-White Interest Rate Model

Galerkin Least Square FEM for the European option price with CEV model

Robust Numerical Methods for Contingent Claims under Jump Diffusion Processes

MATH6911: Numerical Methods in Finance. Final exam Time: 2:00pm - 5:00pm, April 11, Student Name (print): Student Signature: Student ID:

A Crank-Nicolson finite difference approach on the numerical estimation of rebate barrier option prices

Comparative Study between Linear and Graphical Methods in Solving Optimization Problems

A model reduction approach to numerical inversion for parabolic partial differential equations

Final Exam Key, JDEP 384H, Spring 2006

Math Computational Finance Barrier option pricing using Finite Difference Methods (FDM)

Lecture 4. Finite difference and finite element methods

Project 1: Double Pendulum

Package quantileda. R topics documented: February 2, 2016

Option Pricing Using Bayesian Neural Networks

Package EMT. February 19, 2015

Write legibly. Unreadable answers are worthless.

Some Important Optimizations of Binomial and Trinomial Option Pricing Models, Implemented in MATLAB

ADAPTIVE PARTIAL DIFFERENTIAL EQUATION METHODS FOR OPTION PRICING

American Options; an American delayed- Exercise model and the free boundary. Business Analytics Paper. Nadra Abdalla

Numerical Methods For American Option Pricing. Peng Liu. June 2008

Fitob R Package: Manual & Tutorial

Implementing Models in Quantitative Finance: Methods and Cases

MFE/3F Questions Answer Key

1.12 Exercises EXERCISES Use integration by parts to compute. ln(x) dx. 2. Compute 1 x ln(x) dx. Hint: Use the substitution u = ln(x).

Transcription:

Package multiassetoptions February 20, 2015 Type Package Title Finite Difference Method for Multi-Asset Option Valuation Version 0.1-1 Date 2015-01-31 Author Maintainer Michael Eichenberger <mike.eichenberger@gmail.com> Depends Matrix Efficient finite difference method for valuing European and American multi-asset options. License GPL-2 GPL-3 NeedsCompilation no Repository CRAN Date/Publication 2015-01-31 11:39:28 R topics documented: multiassetoptions-package................................. 1 matrixfdm......................................... 2 multiassetoption...................................... 3 nodespacer......................................... 6 payoff............................................ 7 plotoptionvalues...................................... 8 Index 10 multiassetoptions-package Finite Difference Method for Multi-Asset Option Valuation 1

2 matrixfdm Details This package implements an efficient finite difference method for valuing multi-asset options in the Black-Scholes world. The model assumes static volatilities and correlations. The implementation allows users to vary the option setup (number of underlying assets, call vs. put, European vs. American, etc.) as well as some of the features of the numerical method (mesh spacing, timestepping scheme, etc.). Package: multiassetoptions Type: Package Version: 0.1-1 Date: 2015-01-31 License: GPL-2 GPL-3 This package contains the function multiassetoption, which implements a generalized version of the finite difference method for option valuation. Several sub-functions are included in this package to improve code clarity and presentation. Maintainer: Michael Eichenberger <mike.eichenberger@gmail.com> matrixfdm Finite Difference Matrix Generator Usage Generates a modified coefficient matrix (M-matrix) used in the finite difference method from the option inputs. See Tavella and Randall (2000) for more on the standard formulation of the M-matrix. matrixfdm(s, rf, q, vol, rho) Arguments S rf q vol rho list containing the vectors of spatial grid points associated with each underlying. Vector sizes of underlying spatial grid points need not be equal. scalar; applicable risk-free rate (domestic risk-free rate). vector; holding costs of the option s underlyings (dividends, foreign risk-free rates, etc.). vector; volatilities of the option s underlyings. matrix; correlation matrix of the option s underlyings.

multiassetoption 3 Details matrixfdm first constructs the non-zero diagonals of the M-matrix and stores them as columns. The bandsparse function from the Matrix package then constructs a sparse banded matrix from the columns of the previously contructed matrix. Spatial domain boundaries are calculated firstorder inwards with second difference terms dropped, maintaining block tridiagonality. Value matrixfdm returns a CsparseMatrix-class matrix used for timestepping in the finite difference method. References Tavella, D., Randall, C., 2000. Pricing Financial Instruments: The Finite Difference Method. John Wiley & Sons, Inc., New York. Examples # finite difference matrix for uniformly-spaced two-asset option require("matrix") S1 <- list(seq(0, 5, by=1), seq(0, 5, by=1)) rf <- 0.1 q <- c(0.05, 0.04) vol <- c(0.20, 0.25) rho <- matrix(c(1,-0.5,-0.5,1), 2, 2) matrixfdm(s1, rf, q, vol, rho) multiassetoption Finite Difference Method for Multi-Asset Option Valuation multiassetoption generalizes the standard finite difference method to handle mulitple underlying assets, non-uniform grid spacing, non-uniform timestepping, and American exercise. The implementation allows users to vary the option setup (number of underlying assets, call vs. put, European vs. American, etc.) as well as the features of the numerical method (grid spacing, timestepping scheme, etc.). Strike shifting the mesh and Rannacher smoothing are optionally included to remedy problems arising from potential spurious oscillations in the solution. Usage multiassetoption(x)

4 multiassetoption Arguments X list of inputs. List items given in the Details section. Details Items of the input list X are as follows: X$opt$nAsset integer; number of underlying assets. X$opt$payType case; if 0, digital payoff, if 1, best-of payoff, if 2, worst-of payoff. X$opt$exerType case; if 0, European exercise, if 1, American exercise. X$opt$pcFlag case vector; if 0, call, if 1, put. X$opt$ttm scalar; time to maturity. X$opt$strike vector; option strikes. X$opt$rf scalar; applicable risk-free rate (domestic risk-free rate). X$opt$q vector; holding costs of the option s underlyings (dividends, foreign risk-free rates, etc.). X$opt$vol vector; volatilities of the option s underlyings. X$opt$rho matrix; correlation matrix of the option s underlyings. X$fd$m vector; number of spatial steps for each underlying s domain discretization. X$fd$leftBound vector; near spatial boundaries of each underlying s domain. X$fd$kMult vector; right boundary strike multiples. If 0, far domain boundary calculated via formula given in Kangro and Nicolaides (2000). Otherwise, far domain boundary calculated as the strike multiplied by the strike multiple. X$fd$density vector; impacts the concentration of nodes around the option strike. At 0, nodes are uniformly distributed between the near and far boundaries. Increasing the parameter increases the node concentration around the strike. X$fd$kShift case vector; if 0, no mesh shifting, if 1, adjusts the node spacing such that the strike falls exactly between two nodes, if 2, adjusts the node spacing such that the strike falls exactly on a node. See Tavella and Randall (2000). X$fd$theta scalar; implicitness parameter of the theta method. Chosen between 0 (fully explicit) and 1 (fully implicit). X$fd$maxSmooth integer; number of Rannacher smoothing steps. See Rannacher (1984). X$fd$tol scalar; error tolerance in penalty iteration for American exercise. X$fd$maxIter integer; maximum number of iterations per penalty loop for American exercise. X$time$tsType case; if 0, constant timestep size, if 1, adaptive timestep size. See Forsyth and Vetzal (2002). X$time$N integer; number of total timesteps if not using adaptive timesteps. X$time$dtInit scalar; inital timestep size for adaptive timesteps. X$time$dNorm scalar; target relative change for adaptive timesteps. X$time$D scalar; normalizing parameter for adaptive timesteps. The classical order for the state vectors output from the function is illustrated by example. With two underlying assets, option values in each state vector are stored in the order: [11, 21, 31,..., M1, 12, 22,..., MN] with M being the total number of nodes used in the first asset spatial discretization and N being the total number of nodes in the second.

multiassetoption 5 Value multiassetoption returns a list: value S dims time matrix of per-unit option values. Each column stores the state of the option value array (collection of option values for all nodes of the spatial mesh) as a vector following the classical order (see Details section). The columns of the matrix are indexed over time, with the first column beginning at option maturity, and subsequent columns moving backward in time. list containing the vectors of spatial grid points associated with each underlying. Vector sizes of underlying spatial grid points need not be equal. dimension of option value array. This item can be used to reshape the column vectors in value into an appropriately dimensioned array using array(..., dim=dims). vector of times associated with each column of the value item. For each column (time) of the value item, the option value at that time can be calculated as the option s notional amount multiplied by the unit option value interpolated over the S item at the current underlying prices. References Forsyth, P.A., Vetzal, K.R., 2002. Quadratic convergence for valuing American options using a penalty method. SIAM Journal on Scientific Computing, 23 (6), 2095 2122. Kangro, R., Nicolaides, R., 2000. Far field boundary conditions for Black-Scholes equations. SIAM Journal on Numerical Analysis, 38 (4), 1357 1368. Rannacher, R., 1984. Finite element solution of diffusion problems with irregular data. Numberische Mathematik, 43, 309 327. Tavella, D., Randall, C., 2000. Pricing Financial Instruments: The Finite Difference Method. John Wiley & Sons, Inc., New York. Examples # european dual-asset digital option example # initialize inputs list X <- list() # option inputs X$opt$nAsset <- 2 X$opt$payType <- 0 X$opt$exerType <- 0 X$opt$pcFlag <- c(0, 0) X$opt$ttm <- 0.5 X$opt$strike <- c(110, 90) X$opt$rf <- 0.10 X$opt$q <- c(0.05, 0.04)

6 nodespacer X$opt$vol <- c(0.20, 0.25) X$opt$rho <- matrix(c(1, -0.5, -0.5, 1), X$opt$nAsset, X$opt$nAsset) # finite difference inputs X$fd$m <- c(10, 10) X$fd$leftBound <- c(0, 0) X$fd$kMult <- c(0, 0) X$fd$density <- c(5, 5) X$fd$kShift <- c(1, 1) X$fd$theta <- 0.5 X$fd$maxSmooth <- 2 X$fd$tol <- 1e-7 X$fd$maxIter <- 3 # timestep inputs X$time$tsType <- 0 X$time$N <- min(x$fd$m) * 4 X$time$dtInit <- 0.1 / 4^log2(min(X$fd$m)/5) X$time$dNorm <- 5 / 2^log2(min(X$fd$m)/5) X$time$D <- 0.05 # function check output <- multiassetoption(x) nodespacer Non-Uniform Finite Difference Node Spacer Usage nodespacer implements the spatial discretization scheme from Hout and Foulon (2010) with arbitrary left and right bounds. The function additionally includes logic for mesh shifting. nodespacer(k, leftbound, rightbound, nodes, density, kshift) Arguments K leftbound rightbound nodes density kshift scalar; option strike. scalar; near spatial boundary of the underlying domain. scalar; far spatial boundary of the underlying domain. integer; number of nodes used in the spatial discretization. scalar; impacts the concentration of nodes around the option strike. At 0, nodes are uniformly distributed between the leftbound and rightbound. Increasing the parameter increases the node concentration around the strike. case; if 0, no mesh shifting, if 1, adjusts the node spacing such that the strike falls exactly between two nodes, if 2, adjusts the node spacing such that the strike falls exactly on a node. See Tavella and Randall (2000).

payoff 7 Details Value Mesh shifting is accomplished by multiplying the vector of gridpoints by a scalar. For multi-asset options, this nodespacer is called iteratively to discretize each underlying s spatial domain. nodespacer returns a vector of gridpoints used in spatial discretization in the finite difference method. The nodes input determines the length of the output vector. References Hout, K. J., Foulon, S., 2010. ADI finite difference schemes for option pricing in the Heston model with correlation. International Journal of Numerical Analysis and Modeling, 7 (2), 303 320. http://www.math.ualberta.ca/ijnam/volume-7-2010/no-2-10/2010-02-06.pdf Pooley, D. M., Vetzal, K. R., Forsyth, P. A., 2002. Convergence remedies for non-smooth payoffs in option pricing. http://www.cs.uwaterloo.ca/~paforsyt/report.pdf Tavella, D., Randall, C., 2000. Pricing Financial Instruments: The Finite Difference Method. John Wiley & Sons, Inc., New York. Examples # sample mesh spacing plot(nodespacer(100, 0, 500, 26, 5, 1), rep(0, times=26), main= Non-Uniform Mesh Spacing, xlab= Underlying Price (Strike = 100), ylab=, yaxt= n, type= p, cex=0.5, pch=16) payoff Multi-Asset Option Payoff Calculator payoff calculates the per-unit option payoff for digital, best-of, and worst-of multi-asset options. Usage payoff(paytype, pcflag, strike, S) Arguments paytype pcflag strike S case; if 0, digital payoff, if 1, best-of payoff, if 2, worst-of payoff. case vector; if 0, call, if 1, put. vector; option strikes. list containing the vectors of spatial grid points associated with each underlying. Vector sizes of underlying spatial grid points need not be equal.

8 plotoptionvalues Value payoff returns an array of the unit option values at each point spanned by the list of underlying vectors. Dimension of array is inhereted from S. Examples # payoff of a dual-asset digital call with strikes at 100 and 90. S <- list(seq(0, 500, by=1), seq(0, 500, by=1)) payoff(0, c(0, 0), c(100, 90), S) plotoptionvalues Plot Option Values Over Time plotoptionvalues plots the solution of the option PDE over time. Usage plotoptionvalues(y, fps) Arguments Y fps list containing the items resulting from the multiassetoption function. integer; number of frames per second of the animation. Details Animation occurs in backwards time, beginning from the option s expiry date, moving toward time = 0. This function applies only to options written on one or two underlying assets. Higher dimensional options are not plotted. See Also multiassetoption

plotoptionvalues 9 Examples # plot test # initialize inputs list X <- list() # option inputs X$opt$nAsset <- 2 X$opt$payType <- 0 X$opt$exerType <- 0 X$opt$pcFlag <- c(0, 0) X$opt$ttm <- 0.5 X$opt$strike <- c(110, 90) X$opt$rf <- 0.10 X$opt$q <- c(0.05, 0.04) X$opt$vol <- c(0.20, 0.25) X$opt$rho <- matrix(c(1, -0.5, -0.5, 1), X$opt$nAsset, X$opt$nAsset) # finite difference inputs X$fd$m <- c(10, 10) X$fd$leftBound <- c(0, 0) X$fd$kMult <- c(0, 0) X$fd$density <- c(5, 5) X$fd$kShift <- c(1, 1) X$fd$theta <- 0.5 X$fd$maxSmooth <- 2 X$fd$tol <- 1e-7 X$fd$maxIter <- 3 # timestep inputs X$time$tsType <- 0 X$time$N <- min(x$fd$m) * 4 X$time$dtInit <- 0.1 / 4^log2(min(X$fd$m)/5) X$time$dNorm <- 5 / 2^log2(min(X$fd$m)/5) X$time$D <- 0.05 Y <- multiassetoption(x) # function check plotoptionvalues(y, 40)

Index Topic package multiassetoptions-package, 1 matrixfdm, 2 multiassetoption, 3, 8 multiassetoptions (multiassetoptions-package), 1 multiassetoptions-package, 1 nodespacer, 6 payoff, 7 plotoptionvalues, 8 10