Options pricing and the underlying asset
Options are essentially bets on the future evolution of the underlying asset's price.
For example, a put option is valuable when the spot (market) price falls below the option's strike price. The option holder may exercise the option to sell the underlying at the strike \(X\), and buy it back at the spot \(S < X\), yielding profit \(X - S\).
In this exercise you'll value and visualize a European put option on IBM
stock, again applying the Black-Scholes pricing formula, as the spot \(S\) changes.
The strike X
= 140, the time to maturity T
is 1/2 a year, and the risk-free interest rate is 2%.
The annualized volatility of IBM
is available as sigma
, and the plotting axis option_axis
is available to add your plot.
You can find the source code of the black_scholes()
function here.
Diese Übung ist Teil des Kurses
Quantitative Risk Management in Python
Anleitung zur Übung
- Set
IBM_spot
to be the first 100 observations from theIBM
spot price time series data. - Compute the Numpy array
option_values
, by iterating through an enumeration ofIBM_spot
and by using theblack_scholes()
pricing formula. - Plot
option_values
to see the relationship between spot price changes (in blue) and changes in the option value (in red).
Interaktive Übung zum Anfassen
Probieren Sie diese Übung aus, indem Sie diesen Beispielcode ausführen.
# Select the first 100 observations of IBM data
IBM_spot = IBM[:____]
# Initialize the European put option values array
option_values = np.zeros(IBM_spot.size)
# Iterate through IBM's spot price and compute the option values
for i,S in enumerate(____.values):
option_values[i] = black_scholes(S = ____, X = 140, T = 0.5, r = 0.02,
sigma = ____, option_type = "put")
# Display the option values array
option_axis.plot(____, color = "red", label = "Put Option")
option_axis.legend(loc = "upper left")
plt.show()