<>Black-Scholes-Merton Model

<> preface

Black-Scholes-Merton（ The three proposed the model almost at the same time in the same year ） The model is also called BS Model （ in fact , This term is more widespread and popular ）. This chapter will BS The model is briefly introduced , And based on python Quantify . in addition , This chapter will also introduce the time value of options , The intrinsic value of options .

<> one ,BS Model

<>1. Model introduction

The earliest proponent of option pricing theory was French economists Bachelier, Its in
1900 The problem of option pricing was first raised in an article in , subsequently ,Boness
Supplement its theory . stay 1973 year , American mathematician , economist Black and
Scholes A relatively complete option pricing model is proposed , be called Balck-choles Model .Balck-Scholes
The model is an ideal European option pricing model , The model lays a foundation for the development of options , It is of great significance in theory and practice .

Black-Scholes The price model of option is based on strict assumptions , package
It includes the following points ：
first , The price of option subject matter obeys Brownian geometric motion , Therefore, the closing of stock price
The profit rate must obey the lognormal distribution .
second , There is no friction in the commercial market , No tax , There are no short selling restrictions .
third , The risk-free interest rate remains unchanged .
fourth , The option cannot be exercised before the expiration date , Must be European option .

<>2. Mathematical formula of model

<> two ,BS Modelled python quantification

<>1.BS Model code
# BSM Model # Black-Scholes-Merton (1973) European Call & Put Valuation import math
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt
from scipy.integrateimport quad mpl.rcParams['font.family'] = 'serif' from
scipy.statsimport norm # European call option function # European Call def BSM_call_value(St, K, t, T, r,
sigma): d1=(np.log(St/K)+(r+0.5*sigma**2)*(T-t))/(sigma*np.sqrt((T-t))) d2=
d1-sigma*np.sqrt((T-t)) return St*norm.cdf(d1)-K*np.exp(-r*(T-t))*norm.cdf(d2)
# European put option function def BSM_put_value(St, K, t, T, r, sigma): d1=(np.log(St/K)+(
r+0.5*sigma**2)*(T-t))/(sigma*np.sqrt((T-t))) d2=d1-sigma*np.sqrt((T-t)) return
K*np.exp(-r*(T-t))*norm.cdf(-d2)-St*norm.cdf(-d1)
give an example
# example St=100 K=98 T=1 t=0 r=0.015 sigma=0.25 call=BSM_call_value(St, K, t, T,
r, sigma) put=BSM_put_value(St, K, t, T, r, sigma) print(' Call option price ',call,' Put option price '
,put)
Actual data
Shanghai card 50ETF One minute high-frequency data of options are used for demonstration .
Data list

# Call option St= data[' Underlying asset price '] # initial index level K =data[' Exercise price '] # strike level T
=data[' Due date / year '] r = data[' Risk free interest rate ']/100 # constant short rate sigma =0.02#
constant volatility of diffusion t=0 from matplotlib import pyplot as plt
# Two new lines added import matplotlib matplotlib.rc("font",family='DengXian') BS_Call_price=
BSM_call_value(St, K, t, T, r, sigma) # Prediction results plt.figure(figsize=(15,10)) plt.plot
(np.array(BS_Call_price),label='BS Model ') plt.plot(np.array(data[' Option price ']),label=
' Actual option price ') plt.legend() plt.ylabel(' Price ( element )') plt.show()

As can be seen from the figure ,BS The prediction of the real option price by the model is not satisfactory , The accuracy of early and late prediction is good , The Medium-term Forecast fluctuates greatly .

<>2. Prediction error analysis

The error of the prediction results is analyzed . The error analysis indicators are as follows:

Mean square error （Mean Square Error）
Root mean square error （Root Mean Square Error）
Mean absolute error （Mean Absolute Error）
Average absolute percentage error （Mean Absolute Percentage Error）
The smaller the above indicators, the smaller the error .

bs_test_pred=BS_Call_price test_label=data[' Option price '] # mape bs_test_mape=np.mean(
np.abs((bs_test_pred-test_label)/test_label)) # rmse bs_test_rmse=np.sqrt(
np.mean(np.square(bs_test_pred-test_label))) # mae bs_test_mae=np.mean(np.abs(
bs_test_pred-test_label)) #MSE bs_test_mse=np.sum((test_label-bs_test_pred)**2)
/len(bs_test_pred)
give the result as follows ：
BS Model test set mape: 0.07028108461117291 rmse: 0.030983676079028164 mae:
0.024887289528898276 MSE: 0.0009599881833701404
It can be seen that ,BS The prediction results of the model are OK , Basically in line with expectations .

<> three , Intrinsic value of options

From the perspective of option contract holders , The intrinsic value of options can be used （inner value） Describe the income of the holder at the maturity date ：
h=max(St-K,0)

example
Assuming that the exercise price of index option is 3650, The closing price of the index at maturity 3500-3800 between .
# example import numpy as np import matplotlib as mpl import matplotlib.pyplot as
plt# Exercise price K=3650 # Underlying asset price S=np.linspace(3500,3800,100) # intrinsic value h=np.maximum(S-K,0)
plt.figure(figsize=(12,10)) plt.plot(S,h,lw=2.5) # plt.legend() plt.grid()
plt.xlabel(' Underlying asset price ') plt.ylabel(' Intrinsic value of option ')

It can be seen that , The intrinsic value of the option depends on the price level of the underlying asset on the maturity date .

Actual data
Shanghai 50ETF One minute high frequency data analysis of options

As can be seen from the figure , In actual data , The price of the underlying asset is greater than the exercise price , Its intrinsic value is greater than 0
# Intrinsic value of options import numpy as np import matplotlib as mpl import matplotlib.pyplot
as plt# Exercise price K=data[' Exercise price '] # Underlying asset price S=data[' Underlying asset price '] # intrinsic value h=np.maximum(S-K,0)
plt.figure(figsize=(12,10)) plt.plot(S,h,lw=2.5) # plt.legend() plt.grid()
plt.xlabel(' Price of the underlying asset ') plt.ylabel(' Intrinsic value of option ')

<> four , Time value of options

The time value of an option is equal to the option price minus the intrinsic value of the option .
example
# example # time value # Option parameters St=np.linspace(4000,12000,150) # initial index level K =8000
# strike level T=1 r = 0.025 # constant short rate sigma =0.2# constant
volatility of diffusion t=0 # intrinsic value h=np.maximum(St-K,0) # Option value BS_Call_price=
BSM_call_value(St, K, t, T, r, sigma) plt.figure(figsize=(12,10)) plt.plot(St,h,
'b-.',lw=2.5,label=' Intrinsic value of option ') plt.plot(St,BS_Call_price,'r',lw=2.5,label=' Option present value ')
plt.plot(St,BS_Call_price-h,'g',lw=2.5,label=' Option time value ') plt.legend() plt.grid()
plt.show()

As can be seen from the figure , The time value of the option reaches the highest when the index price is equal to the exercise price , Then it began to decay gradually .

Actual data
# time value # Option parameters St= data[' Underlying asset price '] # initial index level K =data[' Exercise price '] # strike
level T=data[' Due date / year '] r = data[' Risk free interest rate ']/100 # constant short rate sigma =0.02#
constant volatility of diffusion t=0 # intrinsic value h=np.maximum(St-K,0) # Option value
BS_Call_price=BSM_call_value(St, K, t, T, r, sigma) plt.figure(figsize=(12,10))
plt.plot(h,'b-.',lw=2.5,label=' Intrinsic value of option ') plt.plot(BS_Call_price,'r',lw=2.5,label=
' Option present value ') plt.plot(BS_Call_price-h,'g--',lw=2.5,label=' Option time value ') plt.legend()
plt.grid() plt.show()

<> summary

This chapter discusses the classical model of option pricing BS The model is introduced , And the pricing of the model is analyzed python quantification . in addition , This chapter also discusses the time value of options , The intrinsic value is introduced .

Technology
Daily Recommendation