Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MMA707-Analytical Finance I Optimal stopping time for American options 19th October 2016 Authors Angelos Kalaitzis Tariq Ade Yige Liu Teacher Jan Röman Division of Applied Mathematics School of Education, Culture and Communication Mälardalen University Box 883, SE-721 23 Västerås, Sweden 1 Abstract The purpose of this report is to find the optimal stopping time for American Options that are useful in the field of financial engineering and in stock markets. We determine the importance and the usage of the aforementioned optimal stopping time and we the help of python we implemented some programmes in order to find this time. 2 Table of Contents Abstract………………………………………………………………………. 2 Introduction...................................................................................................... .4 History of option............................................................................................... 5 Option................................................................................................................ 5 Call option..........................................................................................................5 Put option...........................................................................................................5 European option.................................................................................................6 American option.................................................................................................6 Call option..........................................................................................................6 Put option...........................................................................................................6 Value..................................................................................................................6 Optiomal stopping time......................................................................................6 Optimal stopping problem………………………………………………….......7 The American Option………………………………………………………......7 Conclution..........................................................................................................9 Bibliography.....................................................................................................10 Appendix…………………………………………………………………. 11-17 3 INTRODUCTION Through this seminar project we will focus on american option and the optimal stopping time. Since American option can be exercised anytime before the maturity,the aim of this seminar is to find the optimal stopping time during which the exercise of the option will be benefical, in other terms, the optimal time when the payoff of the american option is maximum 4 History of Options Options An option is a financial contract sold by the option writer to the option holder.The contract offers the buyer the right but not the obligation to buy (Call) or sell(Put ) the security or other financial asset at an agreed-upon price(the strike price) during a certain period or on a specific day (maturity) Call Option Call Option is a financial contract between the buyer and the seller.The buyer of the call option has the right but not the obligation to BUY the underlying assset at a certain price (strike price) on a specific day (maturity) The buyer pays a fee (called a premium) for this right.The seller has the obligation to sell this financial instrument to the buyer if the buyer decides. Put Option Put option are essentially the opposite of call Option. Put Option gives the owner of a put the right but not the obligation to SELL the underlying asset at a specified price (the strike ) on a specific day (the maturity) European Option A european option is an option that can only be exercised at the maturity It gives the owner the right but not the obligation to buy or sell the underlying security at a specific price known as the strike price on the maturity. A European call option gives the owner the right to buy the underlying asset while a European put gives the holder the right to sell the underlying asset at a specific price. The value of the European option (or the Payoff) if it is exercised is given by Call Option Payoff=Max((S-K),0) Put Option Payoff=Max((K-S),0) S : stock Price K :strike Price 5 American Options An American option is an option that can be exercised at any time during the life of the option. Call Option The holder of American Call option, has the right to Buy the option at any point in time until the maturity date Put Option The holder of American Put option has the right to sell the option at any point in time until the maturity date. Value The Value of the American option is given by : Call Option =max(0,S-K) Put Option = max(0,K-S) In American Option,the option can be exercised any time until their expiration time T. If we model the price of the assets by a stochastic porocess Xt,the optimal choice of the moment to exercise the option in order to maximize the expected payoff corresponds to the optimal stopping problem. Optimal Stopping Time Optimal stopping time is concerned with the problem of choosing the time to take a particular action in order to maximise an expected payoff or to minimize and expected cost. 6 Optimal stopping problem The American option Let’s consider a stopping problem V(x) = max E[𝑒 −𝜇𝑡 f(x,t)] X=X(t) :is a geometric Brownian motion dx(t)= r 𝑋𝑡 dt + σ𝑋𝑡 d𝐵𝑡 (1) The solution of (1) is unique and is 1 𝑋𝑡 = 𝑋𝑂 exp[( r- 2 𝜎 2 )t + σ𝐵𝑡 ] (2) 𝑩𝒕 : a standard Brownian Motion process started at zero r : interest rate K: strike price σ : volatility The arbitrage free price of the perpetual (infinite horizon) American put option is V(x) = sup 𝑬𝒙 [𝒆−𝒓𝝉 ( 𝒌 − 𝑿𝑻 )+ (3) To exercise the option and gain the maximal value we have to find the optimal arbitrage free price and the optimal stopping time 𝜏∗ From equations (2) and (3) we assume that there exist a point b ε(0,Κ) such that the stopping time 𝜏𝑏 = min{t≥0 : 𝑋𝑡≤𝑏 } is optimal in equation (3) From strong Markov property we get the boundarie conditions 𝐿𝑋 V = rV, x ≥ b V(x) = (𝐾 − 𝑥), x = b 𝑉 ′ (x) = - 1 , x = b V(x) > (𝐾 − 𝑥)+ , x > 𝑏 V(x) = (𝐾 − 𝑥)+ , 0< 𝑥 < 𝑏 From equation (3) the process X is strong Markov (diffusion) and the infinitesimal generator given by Lx= rx 𝜃 𝜃𝜒 + 𝜎2 2 𝜒2 𝜃2 𝜃𝜒2 This is the equation to solve the free-boundary problem D𝑥 2 V’’+rxV’-rV=0 We are setting D=σ2/2 in above equation to recognize the Cauchy-Euler equation. The solution in the form is V(x)=xp Inserting V(x)=xp into D𝑥 2 V’’+rxV’-rV=0 we have r r p2-(1- )p=0 D D The above equation called quadratic equation which has two roots, 𝑝1=1 and 𝑝2 =-r/D. 7 So the general solution of D𝑥 2 V’’+rxV’-rV=0 can be written V(x)=C1x+C2x-r/D The C1 and C2 are undetermined constants. For the condition that V(x)≤K for all x>0, we can see that C1 must be zero. So that V(x)=(K-x)+ for x=b and V’(x)=-1 for x=b are the two algebraic equations in two unknowns C2 and b. Then we can get D K ( )1+r/D r 1 D/r k b= 1 D/r C2 = Inserting C2 into V(x)=C1x+C1x-r/D under the condition C1=0 we can conclude that 𝐷 V(x)=f(x) = ( 𝐾 { 𝑟 1+𝐷/𝑟 )1+𝑟/𝐷 𝑥 −𝑟/𝐷 ), if x ∈ [b, ∞) K − x, if x ∈ (0, b] V is C2 on (0,b)∪(b, ∞) but only C1 at b, and also that V is convex on (0, ∞) In conclusion The arbitrage-free price V from V(x) = sup 𝑬𝒙 [𝒆−𝒓𝝉 ( 𝒌 − 𝑿𝑻 )+ is given explicitly by 𝑫 𝑲 ( )𝟏+𝒓/𝑫 𝒙−𝒓/𝑫 ), 𝒊𝒇 𝒙 ∈ [𝒃, ∞) V(x) = 𝒇(𝒙) = { 𝒓 𝟏+𝑫/𝒓 . 𝑲 − 𝒙, 𝒊𝒇 𝒙 ∈ (𝟎, 𝒃] k The stopping time τb from 𝝉𝒃 = min{t≥0 : 𝑿𝒕≤𝒃} with b given by b= is 1 D/r optimal in the problem V(x) = sup 𝐸𝑥 [𝑒 −𝑟𝜏 ( 𝑘 − 𝑋𝑇 )+ 8 Conclusion After finding the optimal stopping time problem of american options,we have listed the boundaries conditions. To exercise the option and gain the maximal value we had to find the optimal arbitrage free price and the optimal stopping time τ_* under the boundaries conditions. In order to prove the efficiency of the optimal stopping time of american option,we implemented the payoff of american option using monte carlo and compared it to the payoff of european option. We observed that the american option payoff at the optimal stopping time is superior to the payoff of european option 9 Bibliography [1] Options : http://www.investopedia.com/terms/o/option.asp [2] Call Option : https://en.wikipedia.org/wiki/Call_option [3] Put Option : https://en.wikipedia.org/wiki/Put_option [4] European Option : http://www.investopedia.com/terms/e/europeanoption.asp [5] American Option : http://www.investopedia.com/terms/a/americanoption.asp [6] Optimal stopping time https://en.wikipedia.org/wiki/Optimal_stopping [7]Goran Peskir & Albert Shiryaev,Optimal stopping and Free-Boundary Problems(2006) ISBN :978-3-7643-2419-3 [8]Yves Hilpisch, Python for Finance-Analyze Big Financial Data(2014) ISBN :9781491945285 10 Appendix Python programmes #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Thu Oct 13 21:13:51 2016 @author: SNS_FSB """ def bsm_call_value(S0, K, T, r, sigma): #Valuation of European call option in BSM model. #Analytical formula. #Parameters #========== #S0 : float #initial stock/index level #K : float #strike price #T : float #maturity date (in year fractions) #r : float #constant risk-free short rate #sigma : float #volatility factor in diffusion term #Returns #======= #value : float #present value of the European call option from math import log, sqrt, exp from scipy import stats S0 = float(S0) d1 = (log(S0 / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sqrt(T)) d2 = (log(S0 / K) + (r - 0.5 * sigma ** 2) * T) / (sigma * sqrt(T)) value = (S0 * stats.norm.cdf(d1, 0.0, 1.0) - K * exp(-r * T) * stats.norm.cdf(d2, 0.0, 1.0)) # stats.norm.cdf --> cumulative distribution function # for normal distribution return value 11 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Fri Oct 14 10:43:13 2016 @author: SNS_FSB """ def gbm_mcs_amer(K, option='call'): ''' Valuation of American option in Black-Scholes-Merton by Monte Carlo simulation by LSM algorithm Parameters ========== K : float (positive) strike price of the option option : string type of the option to be valued ('call', 'put') Returns C0 : float estimated present value of European call option ''' dt = T / M df = np.exp(-r * dt) # simulation of index levels S = np.zeros((M + 1, I)) S[0] = S0 sn = gen_sn(M, I) for t in range(1, M + 1): S[t] = S[t - 1] * np.exp((r - 0.5 * sigma ** 2) * dt + sigma * np.sqrt(dt) * sn[t]) # case-based calculation of payoff if option == 'call': h = np.maximum(S - K, 0) else: h = np.maximum(K - S, 0) # LSM algorithm V = np.copy(h) for t in range(M - 1, 0, -1): reg = np.polyfit(S[t], V[t + 1] * df, 7) C = np.polyval(reg, S[t]) V[t] = np.where(C > h[t], V[t + 1] * df, h[t]) # MCS estimator C0 = df * 1 / I * np.sum(V[1]) return C0 12 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Fri Oct 14 11:39:50 2016 @author: SNS_FSB """ M = 50 def gbm_mcs_dyna(K, option='call'): ''' Valuation of European options in Black-Scholes-Merton by Monte Carlo simulation (of index level paths) Parameters ========== K : float (positive) strike price of the option option : string type of the option to be valued ('call', 'put') Returns ======= C0 : float estimated present value of European call option ''' dt = T / M # simulation of index level paths S = np.zeros((M + 1, I)) S[0] = S0 sn = gen_sn(M, I) for t in range(1, M + 1): S[t] = S[t - 1] * np.exp((r - 0.5 * sigma ** 2) * dt + sigma * np.sqrt(dt) * sn[t]) # case-based calculation of payoff if option == 'call': hT = np.maximum(S[-1] - K, 0) else: hT = np.maximum(K - S[-1], 0) # calculation of MCS estimator C0 = np.exp(-r * T) * 1 / I * np.sum(hT) return C0 13 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Fri Oct 14 11:07:26 2016 @author: SNS_FSB """ S0 = 100. r = 0.05 sigma = 0.25 T = 1.0 I = 50000 def gbm_mcs_stat(K): import numpy as np import numpy.random as npr import matplotlib.pyplot as plt ''' Valuation of European call option in Black-Scholes-Merton by Monte Carlo simulation (of index level at maturity) Parameters ========== K : float (positive) strike price of the option Returns ======= C0 : float estimated present value of European call option ''' sn = gen_sn(1, I) # simulate index level at maturity ST = S0 * np.exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * sn[1]) # calculate payoff at maturity hT = np.maximum(ST - K, 0) # calculate MCS estimator C0 = np.exp(-r * T) * 1 / I * np.sum(hT) return C0 14 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Fri Oct 14 11:05:44 2016 @author: SNS_FSB """ def gen_sn(M, I, anti_paths=True, mo_match=True): ''' Function to generate random numbers for simulation. Parameters ========== M : int number of time intervals for discretization I : int number of paths to be simulated anti_paths: Boolean use of antithetic variates mo_math : Boolean use of moment matching ''' import numpy as np import numpy.random as npr import matplotlib.pyplot as plt if anti_paths is True: sn = npr.standard_normal((M + 1, I / 2)) sn = np.concatenate((sn, -sn), axis=1) else: sn = npr.standard_normal((M + 1, I)) if mo_match is True: sn = (sn - sn.mean()) / sn.std() return sn 15 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Fri Oct 14 11:23:12 2016 @author: SNS_FSB """ I = 10000 M = 50 dt = T / M S = np.zeros((M + 1, I)) S[0] = S0 for t in range(1, M + 1): S[t] = S[t - 1] * np.exp((r - 0.5 * sigma ** 2) * dt + sigma * np.sqrt(dt) * npr.standard_normal(I)) 16 #!/usr/bin/env python2 # -*- coding: utf-8 -*#""" #Created on Thu Oct 13 22:06:57 2016 #@author: SNS_FSB #""" # # Monte Carlo valuation of European call options with NumPy # mcs_vector_numpy.py # import math import numpy as np from time import time np.random.seed(20000) t0 = time() # Parameters S0 = 100.; K = 105.; T = 1.0; r = 0.05; sigma = 0.2 M = 50; dt = T / M; I = 250000 # Simulating I paths with M time steps S = np.zeros((M + 1, I)) S[0] = S0 for t in range(1, M + 1): z = np.random.standard_normal(I) # pseudorandom numbers S[t] = S[t - 1] * np.exp((r - 0.5 * sigma ** 2) * dt + sigma * math.sqrt(dt) * z) # vectorized operation per time step over all paths # Calculating the Monte Carlo estimator C0 = math.exp(-r * T) * np.sum(np.maximum(S[-1] - K, 0)) / I # Results output tnp1 = time() - t0 print "European Option Value %7.3f" % C0 print "Duration in Seconds %7.3f" % tnp1 17 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Thu Oct 13 21:13:51 2016 @author: SNS_FSB """ def bsm_call_value(S0, K, T, r, sigma): #Valuation of European call option in BSM model. #Analytical formula. #Parameters #========== #S0 : float #initial stock/index level #K : float #strike price #T : float #maturity date (in year fractions) #r : float #constant risk-free short rate #sigma : float #volatility factor in diffusion term #Returns #======= #value : float #present value of the European call option from math import log, sqrt, exp from scipy import stats S0 = float(S0) d1 = (log(S0 / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * sqrt(T)) d2 = (log(S0 / K) + (r - 0.5 * sigma ** 2) * T) / (sigma * sqrt(T)) value = (S0 * stats.norm.cdf(d1, 0.0, 1.0) - K * exp(-r * T) * stats.norm.cdf(d2, 0.0, 1.0)) # stats.norm.cdf --> cumulative distribution function # for normal distribution return value 18 #!/usr/bin/env python2 # -*- coding: utf-8 -*""" Created on Fri Oct 14 10:34:28 2016 @author: SNS_FSB """ # Vega function def bsm_vega(S0, K, T, r, sigma): ''' Vega of European option in BSM model. Parameters ========== S0 : float initial stock/index level K : float strike price T : float maturity date (in year fractions) r : float constant risk-free short rate sigma : float volatility factor in diffusion term Returns ======= vega : float partial derivative of BSM formula with respect to sigma, i.e. Vega ''' import numpy as np import numpy.random as npr import matplotlib.pyplot as plt from math import log, sqrt from scipy import stats S0 = float(S0) d1 = (log(S0 / K) + (r + 0.5 * sigma ** 2) * T / (sigma * sqrt(T)) vega = S0 * stats.norm.cdf(d1, 0.0, 1.0) * sqrt(T) return vega 19