Black-Scholes Call Gamma in VBA

Here is a VBA function that easily allows you to calculate the Black-Scholes gamma on any call option.



Function CallGamma(StockPrice As Double, StrikePrice As Double, TimeToExpiration As Double, Volatility As Double, RiskFreeRate As Double, DividendYield As Double)
    
    Dim d(1) As Double

    d(1) = (Log(StockPrice / StrikePrice) + (RiskFreeRate - DividendYield + (Volatility ^ 2) / 2) * TimeToExpiration) / (Volatility * Sqr(TimeToExpiration))
    CallGamma = Exp(-DividendYield * TimeToExpiration) * (1 / (Sqr(2 * Application.Pi())) * Exp(-(d(1) ^ 2) / 2)) _
        / (StockPrice * Volatility * Sqr(TimeToExpiration))

End Function