Finance - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Finance : Financial Instruments : Greeks : Finance/BlackScholesGamma

Finance

  

BlackScholesGamma

  

compute the Gamma of a European-style option with given payoff

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

BlackScholesGamma(S0, K, T, sigma, r, d, optiontype)

BlackScholesGamma(S0, P, T, sigma, r, d)

Parameters

S0

-

algebraic expression; initial (current) value of the underlying asset

K

-

algebraic expression; strike price

T

-

algebraic expression; time to maturity

sigma

-

algebraic expression; volatility

r

-

algebraic expression; continuously compounded risk-free rate

d

-

algebraic expression; continuously compounded dividend yield

P

-

operator or procedure; payoff function

optiontype

-

call or put; option type

Description

• 

The Gamma of an option or a portfolio of options is the sensitivity of the Delta to changes in the value of the underlying asset

Γ=2S02S

• 

The BlackScholesGamma command computes the Gamma of a European-style option with the specified payoff function.

• 

The parameter S0 is the initial (current) value of the underlying asset. The parameter T is the time to maturity in years.

• 

The parameter K specifies the strike price if this is a vanilla put or call option. Any payoff function can be specified using the second calling sequence. In this case the parameter P must be given in the form of an operator, which accepts one parameter (spot price at maturity) and returns the corresponding payoff.

• 

The sigma, r, and d parameters are the volatility, the risk-free rate, and the dividend yield of the underlying asset. These parameters can be given in either the algebraic form or the operator form.  The parameter d is optional. By default, the dividend yield is taken to be 0.

Examples

withFinance:

First you compute the Gamma of a European call option with strike price 100, which matures in 1 year. This will define the Gamma as a function of the risk-free rate, the dividend yield, and the volatility.

BlackScholesGamma100,100,1,σ,r,d,'call'

12002ⅇ18σ4+4dσ2+4rσ2+4d28dr+4r2σ2σπ

(1)

In this example you will use numeric values for the risk-free rate, the dividend yield, and the volatility.

BlackScholesGamma100,100,1,0.3,0.05,0.03,'call'

0.01260567542

(2)

You can also use the generic method in which the option is defined through its payoff function.

BlackScholesGamma100,t→maxt100,0,1,σ,r,d

12002ⅇ18σ4+4dσ2+4rσ2+4d28dr+4r2σ2σπ

(3)

BlackScholesGamma100,t→maxt100,0,1,0.3,0.05,0.03

0.01260567513

(4)

BSGammaexpandBlackScholesGamma100,100,1,σ,r,0.03,'call'

BSGamma:=0.001965014020ⅇ0.1249999999σ2ⅇ0.4999999997rⅇ0.4999999997r2σ2ⅇ0.02999999998rσ2ⅇ0.0004499999997σ2σ+0.0001179008410ⅇ0.1249999999σ2ⅇ0.4999999997rⅇ0.4999999997r2σ2ⅇ0.02999999998rσ2ⅇ0.0004499999997σ2σ30.003930028034rⅇ0.1249999999σ2ⅇ0.4999999997rⅇ0.4999999997r2σ2ⅇ0.02999999998rσ2ⅇ0.0004499999997σ2σ30.0001179008410ⅇ0.5000000002rⅇ0.0004499999998σ2ⅇ0.02999999998rσ2ⅇ0.4999999997r2σ2ⅇ0.1249999999σ2σ3+0.003930028033rⅇ0.5000000002rⅇ0.0004499999998σ2ⅇ0.02999999998rσ2ⅇ0.4999999997r2σ2ⅇ0.1249999999σ2σ3+0.001965014018ⅇ0.5000000002rⅇ0.0004499999998σ2ⅇ0.02999999998rσ2ⅇ0.4999999997r2σ2ⅇ0.1249999999σ2σ

(5)

plot3dBSGamma,σ=0..1,r=0..1,axes=BOXED

Here are similar examples for the European put option.

BlackScholesGamma100,50,1,σ,r,d,'put'

18002ⅇ18σ44ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2σ2+2ⅇ18σ4+4ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2σ2+2ⅇ18σ44ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2ln22ⅇ18σ44ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2d+2ⅇ18σ44ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2r4ⅇ18σ4+4ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2ln2+4ⅇ18σ4+4ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2d4ⅇ18σ4+4ln2σ2+4dσ2+4rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2rπσ3

(6)

BlackScholesGamma100,50,1,0.3,0.05,0.03,'put'

0.000529595076

(7)

BlackScholesGamma100,t→max50t,0,1,σ,r,d

1800ⅇrd22ⅇ18σ4+4ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2σ2ⅇ18σ44ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2σ2+4ⅇ18σ4+4ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2ln24ⅇ18σ4+4ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2d+4ⅇ18σ4+4ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2r2ⅇ18σ44ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2ln2+2ⅇ18σ44ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2d2ⅇ18σ44ln2σ24dσ24rσ2+4ln228ln2d+8ln2r+4d28dr+4r2σ2rπσ3

(8)

BlackScholesGamma100,t→max50t,0,1,0.3,0.05,0.03,d

0.0005295950845

(9)

In this example, you will compute the Gamma of a strangle.

SBlackScholesGamma100&comma;t&rarr;piecewiset<50&comma;50t&comma;t<100&comma;0&comma;t100&comma;1&comma;&sigma;&comma;r&comma;d

S:=1800&ExponentialE;rd24&ExponentialE;18&sigma;44d&sigma;24r&sigma;2&plus;4d28dr&plus;4r2&sigma;2&sigma;2&plus;2&ExponentialE;18&sigma;4&plus;4ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2&sigma;2&plus;&ExponentialE;18&sigma;44ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2&sigma;24&ExponentialE;18&sigma;4&plus;4ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2ln2&plus;4&ExponentialE;18&sigma;4&plus;4ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2d4&ExponentialE;18&sigma;4&plus;4ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2r&plus;2&ExponentialE;18&sigma;44ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2ln22&ExponentialE;18&sigma;44ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2d&plus;2&ExponentialE;18&sigma;44ln2&sigma;24d&sigma;24r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2r&pi;&sigma;3

(10)

CBlackScholesGamma100&comma;100&comma;1&comma;&sigma;&comma;r&comma;d&comma;&apos;call&apos;

C:=12002&ExponentialE;18&sigma;4&plus;4d&sigma;2&plus;4r&sigma;2&plus;4d28dr&plus;4r2&sigma;2&sigma;&pi;

(11)

PBlackScholesGamma100&comma;50&comma;1&comma;&sigma;&comma;r&comma;d&comma;&apos;put&apos;

P:=18002&ExponentialE;18&sigma;44ln2&sigma;2&plus;4d&sigma;2&plus;4r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2&sigma;2&plus;2&ExponentialE;18&sigma;4&plus;4ln2&sigma;2&plus;4d&sigma;2&plus;4r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2&sigma;2&plus;2&ExponentialE;18&sigma;44ln2&sigma;2&plus;4d&sigma;2&plus;4r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2ln22&ExponentialE;18&sigma;44ln2&sigma;2&plus;4d&sigma;2&plus;4r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2d&plus;2&ExponentialE;18&sigma;44ln2&sigma;2&plus;4d&sigma;2&plus;4r&sigma;2&plus;4ln228ln2d&plus;8ln2r&plus;4d28dr&plus;4r2&sigma;2