In [1]:
#!wget https://raw.githubusercontent.com/oditorium/blog/master/Modules/OptionPricing.py -O OptionPricing.py
In [2]:
import OptionPricing as op
In [3]:
#help(op)
In [4]:
c = op.BSCall(mat=1, strike=100, spot=100, sig=0.2, rate=0.05, yld=0.)
p = op.BSPut(mat=1, strike=100, spot=100, sig=0.2, rate=0.05, yld=0.)
dc = op.BSDCall(mat=1, strike=100, spot=100, sig=0.2, rate=0.05, yld=0.)
dp = op.BSDPut(mat=1, strike=100, spot=100, sig=0.2, rate=0.05, yld=0.)
o = p
spot = range(60,140)
In [5]:
plot(spot, list((o.PV(spot=s),o.PV(spot=s, sig=0.05)) for s in spot))
Out[5]:
In [6]:
plot(spot, list((o.Delta(spot=s),o.Delta(spot=s, sig=0.1)) for s in spot))
Out[6]:
In [7]:
plot(spot, list((100.*o.Delta(spot=s),o.DeltaCash(spot=s)) for s in spot))
Out[7]:
In [8]:
plot(spot, list((o.Delta(spot=s),o.DeltaFwd(fwd=s)) for s in spot))
Out[8]:
In [9]:
plot(spot, list((o.DeltaCash(spot=s),o.DeltaFwdCash(fwd=s)) for s in spot))
Out[9]:
In [10]:
plot(spot, list((o.Gamma(spot=s),o.Gamma(spot=s, sig=0.1)) for s in spot))
Out[10]:
In [11]:
plot(spot, list((10000*o.Gamma(spot=s),o.GammaCash(spot=s)) for s in spot))
Out[11]:
In [12]:
plot(spot, list((o.Theta(spot=s),o.Gamma(spot=s)) for s in spot))
Out[12]:
In [13]:
plot(spot, list((o.Vega(spot=s),o.Gamma(spot=s, sig=0.1)) for s in spot))
Out[13]:
In [14]:
plot(spot, list((o.Vanna(spot=s),o.Vanna(spot=s, sig=0.1)) for s in spot))
Out[14]:
In [15]:
plot(spot, list((o.Volga(spot=s),o.Volga(spot=s, sig=0.1)) for s in spot))
Out[15]:
In [16]:
plot(spot, list((o.Rho(spot=s),o.RhoYld(spot=s)) for s in spot))
Out[16]: