Learn R Programming

fOptions (version 3042.86)

PlainVanillaOptions: Valuation of Plain Vanilla Options

Description

A collection and description of functions to valuate plain vanilla options. Included are functions for the Generalized Black-Scholes option pricing model, for options on futures, some utility functions, and print and summary methods for options.

The functions are:

GBS* the generalized Black-Scholes option,
BlackScholesOption a synonyme for the GBSOption,
Black76Option options on Futures,
MiltersenSchwartzOption options on commodity futures,
NDF, CND, CBND distribution functions,
print print method for Options,

Usage

GBSOption(TypeFlag, S, X, Time, r, b, sigma,
    title = NULL, description = NULL)
GBSGreeks(Selection, TypeFlag, S, X, Time, r, b, sigma)
GBSCharacteristics(TypeFlag, S, X, Time, r, b, sigma)
GBSVolatility(price, TypeFlag, S, X, Time, r, b, tol, maxiter)
BlackScholesOption(…)

Black76Option(TypeFlag, FT, X, Time, r, sigma, title = NULL, description = NULL)

MiltersenSchwartzOption(TypeFlag, Pt, FT, X, time, Time, sigmaS, sigmaE, sigmaF, rhoSE, rhoSF, rhoEF, KappaE, KappaF, title = NULL, description = NULL)

NDF(x) CND(x) CBND(x1, x2, rho)

# S4 method for fOPTION show(object) # S3 method for fOPTION summary(object, …)

# S3 method for option print(x, …) # S3 method for option summary(object, …)

Arguments

b

the annualized cost-of-carry rate, a numeric value; e.g. 0.1 means 10% pa.

description

a character string which allows for a brief description.

FT

[Black76*][MiltersenSchwartz*] - the futures price, a numeric value.

KappaE, KappaF

[MiltersenSchwartz*] - the speed of mean reversion of the forward interest rate (E), the speed of mean reversion of the convenience yield (F), a numeric value.

maxiter, tol

[GBSVolatility*] - the maximum number of iterations and the tolerance to compute the root of the GBS volatility equation, see uniroot.

object

an object of class "option".

price

[GBSVolatility*] - the price of the GBS option, a numerical value.

Pt

[MiltersenSchwartz*] - the zero coupon bond that expires on the option maturity; a numeric value.

r

the annualized rate of interest, a numeric value; e.g. 0.25 means 25% pa.

rhoSE, rhoSF, rhoEF

[MiltersenSchwartz*] - the correlations between the spot commodity price and the future convenience yield (SE), between the spot commodity price and the forward interest rate (SF), between the forward interest rate and the future convenience yield (EF), a numeric value.

S

the asset price, a numeric value.

Selection

[GBSGreeks] - sensitivity to be computed, one of "delta", "gamma", "vega", "theta", "rho", or "CoC", a string value.

sigma

the annualized volatility of the underlying security, a numeric value; e.g. 0.3 means 30% volatility pa.

sigmaS, sigmaE, sigmaF

[MiltersenSchwartz*] - numeric values, the annualized volatility of the spot commodity price (S), of the future convenience yield (E), and of the forward interest rate (F), e.g. 0.25 means 25% pa.

time, Time

the time to maturity measured in years, a numeric value.

title

a character string which allows for a project title.

TypeFlag

a character string either "c" for a call option or a "p" for a put option.

x, x1, x2, rho

[NDF][CND][CBND] - the function argument x for the normal distribution function NDF and the cumulated normal distribution CND. The arguments for the bivariate function are named x1 and x2; rho is the correlation coefficient. [print] - the object x to be printed.

X

a numeric value, the exercise price.

arguments to be passed.

Value

GBSOption BlackScholesOption returns an object of class "fOption".

GBSGreeks returns the option sensitivity for the selected Greek, a numeric value.

GBSCharacteristics returns a list with the following entries: premium, the option price, delta, the delta sensitivity, gamma, the gamma sensitivity, theta, the theta sensitivity, vega, the vega sensitivity, rho, the rho sensitivity, lambda, the lambda sensitivity.

GBSVolatility returns the GBS option implied volatility for a given price.

Black76Option, MiltersenSchwartzOption return an object of class "fOption".

The option valuation programs return an object of class "fOPTION" with the following slots:

@call

the function call.

@parameters

a list with the input parameters.

@price

a numeric value with the value of the option.

@title

a character string with the name of the test.

@description

a character string with a brief description of the test.

Details

Generalized Black Scholes Options:

GBSOption calculates the option price, GBSGreeks calculates option sensitivities delta, theta, vega, rho, lambda and gamma, and GBScharacterisitics does both. GBSVolatility computes the implied volatility.

Note, that setting b = r we get Black and Scholes' stock option model, b = r-q we get Merton's stock option model with continuous dividend yield q, b = 0 we get Black's futures option model, and b = r-rf we get Garman and Kohlhagen's currency option model with foreign interest rate rf.

Options on Futures:

The Black76Option pricing formula is applicable for valuing European call and European put options on commodity futures. The exact nature of the underlying commodity varies and may be anything from a precious metal such as gold or silver to agricultural products.

The Miltersen Schwartz Option model is a three factor model with stochastic futures prices, term structures and convenience yields, and interest rates. The model is based on lognormal distributed commodity prices and normal distributed continuously compounded forward interest rates and future convenience yields.

Miltersen Schwartz Options:

The MiltersenSchwartzOption function allows for pricing options on commodity futures. The model is a three factor model with stochastic futures prices, term structures of convenience yields, and interest rates. The model is based on lognormal distributed commodity prices and normal distributed continuously compounded forward interest rates and futures convenience yields.

Distribution Functions:

The functions NDF, CND, and CBND compute vlues for the Normal density functions, for the normal probability function, and for the bivariate normal probability functions. The functions are implemented as described in the book of E.G. Haug.

Print and Summary Method:

Thes are two methods to print and sumarize an object of class "fOPTION" or of "option". The second is used for the older class representation.

References

Black F., Scholes M. (1973); The Pricing of Options and Corporate Liabilities, Journal of Political Economy 81, 637--654.

Haug E.G. (1997); The Complete Guide to Option Pricing Formulas, Chapter 1, McGraw-Hill, New York.

Hull J.C. (1998); Introduction to Futures and Options Markets, Prentice Hall, London.

Miltersen K., Schwartz E.S. (1998); Pricing of Options on Commodity Futures with Stochastic Term Structuures of Convenience Yields and Interest Rates, Journal of Financial and Quantitative Analysis 33, 33--59.

Examples

Run this code
# NOT RUN {
## All the examples are from Haug's Option Guide (1997)

## CHAPTER 1.1: ANALYTICAL FORMULAS FOR EUROPEAN OPTIONS:

## Black Scholes Option [Haug 1.1.1]
   GBSOption(TypeFlag = "c", S = 60, X = 65, Time = 1/4, r = 0.08,
     b = 0.08, sigma = 0.30)

## European Option on a Stock with Cash Dividends [Haug 1.1.2]
   S0  =  100; r  =  0.10; D1  =  D2  =  2; t1  =  1/4; t2  =  1/2
   S  =  S0 - 2*exp(-r*t1) - 2*exp(-r*t2)
   GBSOption(TypeFlag = "c", S = S, X = 90, Time = 3/4, r = r, b = r,
     sigma = 0.25)

## Options on Stock Indexes [Haug 1.2.3]
   GBSOption(TypeFlag = "p", S = 100, X = 95, Time = 1/2, r = 0.10,
     b = 0.10-0.05, sigma = 0.20)

## Option on Futures [Haug 1.1.4]
   FuturesPrice  =  19
   GBSOption(TypeFlag = "c", S = FuturesPrice, X = 19, Time = 3/4,
     r = 0.10, b = 0, sigma = 0.28)

## Currency Option [Haug 1.1.5]
   r  =  0.06; rf  =  0.08
   GBSOption(TypeFlag = "c", S = 1.5600, X = 1.6000,
     Time = 1/2, r = 0.06, b = 0.06-0.08, sigma = 0.12)

## Delta of GBS Option [Haug 1.3.1]
   GBSGreeks(Selection = "delta", TypeFlag = "c", S = 105, X = 100,
     Time = 1/2, r = 0.10, b = 0, sigma = 0.36)

## Gamma of GBS Option [Haug 1.3.3]
   GBSGreeks(Selection = "gamma", TypeFlag = "c", S = 55, X = 60,
     Time = 0.75, r = 0.10, b = 0.10, sigma = 0.30)

## Vega of GBS Option [Haug 1.3.4]
   GBSGreeks(Selection = "vega", TypeFlag = "c", S = 55, X = 60,
     Time = 0.75, r = 0.10, b = 0.10, sigma = 0.30)

## Theta of GBS Option [Haug 1.3.5]
    GBSGreeks(Selection = "theta", TypeFlag = "p", S = 430, X = 405,
     Time = 0.0833, r = 0.07, b = 0.07-0.05, sigma = 0.20)

## Rho of GBS Option [Haug 1.3.5]
   GBSGreeks(Selection = "rho", TypeFlag = "c", S = 72, X = 75,
     Time = 1, r = 0.09, b = 0.09, sigma = 0.19)

## CHAPTER 1.3 OPTIONS SENSITIVITIES:

## The Generalized Black Scholes Option Formula
   GBSCharacteristics(TypeFlag = "p", S = 1.5600, X = 1.6000,
     Time = 1, r = 0.09, b = 0.09, sigma = 0.19)

## CHAPTER 1.5: RECENT DEVELOPMENTS IN COMMODITY OPTIONS

## Miltersen Schwartz Option vs. Black76 Option on Futures:
   MiltersenSchwartzOption(TypeFlag = "c", Pt = exp(-0.05/4), FT = 95,
     X = 80, time = 1/4, Time = 1/2, sigmaS = 0.2660, sigmaE = 0.2490,
     sigmaF = 0.0096, rhoSE = 0.805, rhoSF = 0.0805, rhoEF = 0.1243,
     KappaE = 1.045, KappaF = 0.200)
   Black76Option(TypeFlag = "c", FT = 95, X = 80, Time = 1/2, r = 0.05,
     sigma = 0.266)

# }

Run the code above in your browser using DataLab