Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 38 lines (34 sloc) 1.65 KB
Gamma is the rate of change of the portfolio's delta with respect to the underlying asset's price. It represents the second-order sensitivity of the option to a movement in the underlying asset’s price.
Long options, either calls or puts, always yield positive Gamma. Gamma is higher for options that are at-the-money and closer to expiration because the Delta of the near term options move toward either 0 or 1.00 is imminent. Deeper-in-the-money or farther-out-of-the-money options have lower Gamma as their Deltas already approached 0 or 1.00 (or 0 or -1.00 for puts) and will not change as quickly with movement in the underlying. For European options:
<div class="section-example-container">
<pre class="python">def gamma(self):
d1 = self.d1()
dn1 = self.dn(d1)
return dn1 * exp(-self.q * self.T) / (self.s * self.sigma * sqrt(self.T))
<div class="section-example-container">
<pre class="python">z = gamma
fig = plt.figure(figsize=(20,11))
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(s, T, z, rstride=1, cstride=1)
ax.plot_surface(s, T, z, facecolors=cm.jet(delta),linewidth=0.001, rstride=1, cstride=1, alpha = 0.75)
ax.set_zlim3d(0, z.max())
ax.set_xlabel('stock price')
ax.set_ylabel('Time to Expiration')
m = cm.ScalarMappable(cmap=cm.jet)
cbar = plt.colorbar(m)
<img class="img-responsive" src="" alt="The Greeks letters: gamma" />
The color of the graph above represents delta value.