- 2021-02-02 08:46
*views 5*- programing language
- machine learning
- Python
- artificial intelligence
- BSM
- probability theory

BSM Model is one of the most commonly used option pricing models , Although its assumptions are inconsistent with market facts , However, the proposal of this model lays the foundation of modern financial derivatives law . The development of the model in academic circles ：

Early option pricing mostly used Black-Scholes(B-S) Option pricing model ,B-S The model assumes that the yield of the underlying asset follows a normal distribution and the volatility is constant , But this assumption cannot be explained “ Volatility smile ” and “ Leverage effect ”. In subsequent studies , Scholars continue to B-S The model is improved , For example, modify constant volatility , Re depict the distribution of asset volatility, etc .

Stochastic volatility model pair B-S The model is optimized , The more famous models are Heston,3/2,4/2 Model .

In addition to the random volatility model that assumes that the volatility is a random process of the underlying asset and time , Another model assumes that the volatility is the local volatility of the deterministic function of the underlying asset and time .

A large number of studies show that , Random volatility and price jump are the internal characteristics of asset price movement . When an emergency occurs in the market , The jump process needs to be introduced into the stochastic volatility model to describe this kind of sudden situation .

in addition , Although affine Heston Stochastic volatility model brings great convenience in option analytical pricing , However, it can not describe the nonlinear characteristics of financial time series . Through in Heston A non affine stochastic volatility model is established by introducing non affine parameters into the diffusion term of the model variance process , It can depict richer asset price behavior .

B-S The model holds that the price of the underlying asset of the option obeys the diffusion model , Scholars continue to improve the diffusion model and get the corresponding option pricing model , Such as jump diffusion option price model , Stochastic volatility model , Non affine stochastic volatility option pricing model, etc , These models are collectively referred to as option pricing models based on parametric diffusion process . Later, some scholars set the diffusion equation as nonparametric form , An option pricing model based on nonparametric diffusion process is established .

In recent years, scholars have made great progress in option pricing model , However, these improved models still ignore some important factors affecting the stock price trend , For example, there is a long-term equilibrium relationship between the market index and the trend of individual stocks . Foreign scholars have established the option pricing model during the stock disaster .

The above introduction comes from the author's reading of more than ten relevant documents . Next, we will introduce two middle schools BSM Model 1. Without dividend BSM Model 2. Dividend bearing BSM Model

With no dividend BSM Model as an example , The expression is ：

The model with dividend is to D After discount , Use stock in t The value of the moment minus the present value of the dividend .

Next, the solution methods of the two models are introduced , use python solve , Code is ：

Without dividend BSM Model

# Black-Scholes-Merton (1973) European Call & Put Valuation from pylab import

plt plt.style.use('seaborn') %matplotlib inline import math import numpy as np

import matplotlib as mpl import matplotlib.pyplot as plt from scipy.integrate

import quad mpl.rcParams['font.family'] = 'serif' # # Helper Functions # def dN(

x): ''' Probability density function of standard normal random variable x. '''

# Standard normal random variable x Probability density function return math.exp(-0.5 * x ** 2) / math.sqrt(2 * math.pi) def

N(d): ''' Cumulative density function of standard normal random variable x. '''

return quad(lambda x: dN(x), -20, d, limit=50)[0] def d1f(St, K, t, T, r, sigma)

:# Set function d1 ''' Black-Scholes-Merton d1 function. Parameters see e.g.

BSM_call_value function. ''' d1 = (math.log(St / K) + (r + 0.5 * sigma ** 2)* (T

- t)) / (sigma * math.sqrt(T - t)) return d1 # # Valuation Functions # # European call option function

def BSM_call_value(St, K, t, T, r, sigma): ''' Calculates Black-Scholes-Merton

European call option value. Parameters ========== St : float stock/index level

at time t K : float strike price t : float valuation date T : float date of

maturity/time-to-maturity if t = 0; T > t r : float constant, risk-less short

rate sigma : float volatility Returns ======= call_value : float European call

present value at t ''' d1 = d1f(St, K, t, T, r, sigma) d2 = d1 - sigma * math.

sqrt(T - t) call_value = St * N(d1) - math.exp(-r * (T - t)) * K * N(d2) return

call_value# European put option function def BSM_put_value(St, K, t, T, r, sigma): ''' Calculates

Black-Scholes-Merton European put option value. Parameters ========== St :

float stock/index level at time t K : float strike price t : float valuation

date T : float date of maturity/time-to-maturity if t = 0; T > t r : float

constant, risk-less short rate sigma : float volatility Returns =======

put_value : float European put present value at t ''' put_value = BSM_call_value

(St, K, t, T, r, sigma) \ - St + math.exp(-r * (T - t)) * K return put_value #

assignment St = 100.00 # initial index level K = 100.00 # strike level T = 1. # call

option maturity r = 0.05 # constant short rate sigma = 0.2 # constant

volatility of diffusion t=0 print('BSM The call option price solved by the model is ：',BSM_call_value(St, K, t, T,

r, sigma)) print('BSM The put option price solved by the model is ：',BSM_put_value(St, K, t, T, r, sigma))

The results are as follows ：

BSM The call option price solved by the model is ： 10.45058357218553

BSM The put option price solved by the model is ： 5.573526022256942

Dividend bearing BSM Model

The above program can be run again , Just modify the parameters

First, the stock price minus the present value of dividends is calculated

Su=St-D*np.exp(-((t)*r)) Su

Then set the parameters

# assignment St = 100.00 # initial index level K = 100.00 # strike level T = 1. # call

option maturity r = 0.05 # constant short rate sigma=0.2 # constant volatility

of diffusion t=20/360 D=2 print('BSM The call option price solved by the model is ：',BSM_call_value(St, K, t, T, r

, sigma)) print('BSM The put option price solved by the model is ：',BSM_put_value(St, K, t, T, r, sigma))

give the result as follows ：

BSM The call option price solved by the model is ： 10.090922223626734

BSM The put option price solved by the model is ： 5.478462396092041

last , The present value and exercise price of options can be drawn according to the formula , due date , Short term interest rate , Volatility relationship

Take the codes of present value and strike price as an example

# C(K) plot Relationship between present value and strike price plt.subplot(221) klist = np.linspace(80, 120, points)

vlist= [function(Su, K, t, T, r, sigma) for K in klist] plt.plot(klist, vlist)

plt.grid(True) plt.xlabel('strike $K$') plt.ylabel('present value')

give the result as follows ：

Without dividend BSM Model （ Call option ）

Dividend bearing BSM Model （ Put option ）

That's all for this sharing , Learning and sharing .

Technology

- Java296 blogs
- Python265 blogs
- Vue125 blogs
- c language122 blogs
- algorithm107 blogs
- MySQL96 blogs
- Flow Chart81 blogs
- javascript79 blogs
- more...

Daily Recommendation

views 14

views 7

views 6

views 6

views 6

views 5

© ioDraw All rights reserved

JS Reverse Tiktok login and verification code bypass solve ：org.mybatis.spring.MyBatisSystemException nested exception is org.apache.ibatis.exceptions Design of fourth-order Butterworth low-pass filter 2022 Video games School Games mysql Trigger instance update_mysql Trigger example description mysql Design example tutorial _MySQL Database basic example tutorial （ Wechat Edition ）UserWarning: Failed to load image Python extension: warn(f“Failed to load image Python extension:MySQL Statistics of total sales data of each month **CSS Define variables 520 Confession code suitable for entry programmers