Help with understanding a logic behind a code

Option Trading Strategies in Python: Intermediate
Section 3, unit 21 :Option pricing with delta and gamma.
The following code is used to calculate the call option price for Rs 1 change
in the stock price.
# Change in stock price is Rs. 1 from 100 to 101
call_price_at_101 = greeks_stock_price_100.callPrice \
                  + greeks_stock_price_100.callDelta * (101 - 100) \
                  + 0.5 * greeks_stock_price_100.gamma * (101 - 100)**2  
print "INR", call_price_at_101

Considering the values are
Stock Price =100, Call Price = 5.02709, Delta= 0.525135, Gamma = 0.0315757 

I am unable to grasp the logic behind this code to calculate the new option price
change in delta = Gamma * change in underlying price = 0.0315757 * 1

that means new delta for Rs 101 will be 0.525135 + 0.0315757 = 0.5567107
So as per delta's formula, change in option price = Delta * Change in underlying price = 0.5567107 * 1 thus giving us Call option price = Call option at Rs100 + Change in option price = 5.02709 + 0.5567107 = 5.5838007( which is VERY close to what BSM and The above formula calculates)
Now I do not understand the logic behind using:0.5 * greeks_stock_price_100.gamma * (101 - 100)**2 part of the code... what is 0.5 and **2 whose square is the program calculating. I

Ok I kept going through the code over and over again

Here is what I finally understood

0.5 is the Delta that is assumed because the option strike price is AT THE MONEY.
 

that's why the code felt out of the context because while going through the code 0.5 felt as forced

instead doing 0.5 why didn't you guys just do this:

call_price_at_101 = greeks_stock_price_100.callPrice \
                  + greeks_stock_price_100.callDelta * (101 - 100) \
                  + greeks_stock_price_100.callDelta * greeks_stock_price_100.gamma * (101 - 100)**2

Now the formula works even if the price change is more than Rs 1, yes ofcourse we have to change the 101-100 to lets say 102-100.

0.5 is not the Delta of the option. It is 1/2! from Taylor series expansion.

Thank you :slight_smile:

The formula to compute the call price is calculated using Taylor series expansion as shown below:

Taylor Series Expansion

where,

f(a) is Initial Option Price

f'(a) is the first derivative of the f(a) (Delta)

1/2! is 0.5

f''(a) is the second derivative of the f(a) (Gamma)

x-a is the change in the option price (101 - 100)

Source: Taylor Series

 

Thanks!

Ishan

Thank you :slight_smile: