Sunteți pe pagina 1din 27

Function BS(s, k, v, r, t, d)

d1 = (Log(s / k) + (r - d + v ^ 2 / 2) * t) / (v * t ^ 0.5)
d2 = d1 - v * t ^ 0.5
BS = s * Exp(-d * t) * Application.NormSDist(d1) - k * Exp(-r *
t) * Application.NormSDist(d2)
End Function

---------------------------------------------------------------------
Function bsoptionvalue(dum, S, x, r, q, tyr, sigma)
Dim eqt, ert, ndone, ndtwo
eqt = Exp(-q * tyr)
ert = Exp(-r * tyr)
If S > 0 And x > 0 And tyr > 0 And sigma > 0 Then
ndone = Application.NormSDist(dum * bsone(S, x, r, q, tyr,
sigma))
ndtwo = Application.NormSDist(dum * bstwo(S, x, r, q, tyr,
sigma))
bsoptionvalue = dum * (S * eqt * ndone - x * ert * ndtwo)
Else
bsoptionvalue = -1
End If
End Function
Function bsone(S, x, r, q, tyr, sigma)
bsone = (Log(S / x) + (r - q + 0.5 * sigma ^ 2) * tyr) / (sigma *
Sqr(tyr))
End Function
Function bstwo(S, x, r, q, tyr, sigma)
bstwo = ((Log(S / x) + (r - q + 0.5 * sigma ^ 2) * tyr) / (sigma *
Sqr(tyr))) - sigma * Sqr(tyr)
End Function

-------------------------------------------------------------------
Function bsoptionvalue(dum, s, x, r, q, tyr, sigma)
Dim eqt, ert, ndone, ndtwo
eqt = Exp(-q * tyr)
ert = Exp(-r * tyr)
If s > 0 And x > 0 And tyr > 0 And sigma > 0 Then
ndone = Application.NormSDist(dum * bsone(s, x, r, q, tyr,
sigma))
ndtwo = Application.NormSDist(dum * bstwo(s, x, r, q, tyr,
sigma))
bsoptionvalue = dum * (s * eqt * ndone - x * ert * ndtwo)
Else
bsoptionvalue = -1
End If
End Function
Function bsone(s, x, r, q, tyr, sigma)
bsone = (Log(s / x) + (r - q + 0.5 * sigma ^ 2) * tyr) / (sigma *
Sqr(tyr))
End Function
Function bstwo(s, x, r, q, tyr, sigma)
bstwo = ((Log(s / x) + (r - q + 0.5 * sigma ^ 2) * tyr) / (sigma *
Sqr(tyr))) - sigma * Sqr(tyr)
End Function
Function CashorNothing(iopt, s, k, x, r, d, t, v)
' Returns Black-Scholes Value (iopt=1 for call, -1 for put; q=div
yld)
' Uses BSDOne fn
' Uses BSDTwo fn
Dim eqt, ert, nd1, nd2
eqt = Exp(-d * t)
ert = Exp(-r * t)
If s > 0 And k > 0 And t > 0 And v > 0 Then
nd1 = Application.NormSDist(iopt * bsnd1(s, k, r, d, t, v))
nd2 = Application.NormSDist(iopt * bsnd2(s, k, r, d, t, v))
CashorNothing = x * ert * nd2
Else
CashorNothing = -1
End If

End Function

Function AssetorNothing(iopt, s, k, x, r, d, t, v)

' Returns Black-Scholes Value (iopt=1 for call, -1 for put; q=div
yld)
' Uses BSDOne fn
' Uses BSDTwo fn
Dim eqt, ert, nd1, nd2
eqt = Exp(-d * t)
ert = Exp(-r * t)
If s > 0 And k > 0 And t > 0 And v > 0 Then
nd1 = Application.NormSDist(iopt * bsnd1(s, k, r, d, t, v))
nd2 = Application.NormSDist(iopt * bsnd2(s, k, r, d, t, v))
AssetorNothing = s * eqt * nd1
Else

Sub go_home()
Sheets("home").Select
End Sub
Sub VBA_Sub()
Range("E4") = bsoptionvalue(1, Range("B3"), Range("B4"), Range("B5"),
Range("B7"), Range("B9"), Range("B11"))
Range("H4") = bsoptionvalue(-1, Range("B3"), Range("B4"),
Range("B5"), Range("B7"), Range("B9"), Range("B11"))
End Sub

---------------------------------------------------------------------
Private Sub CommandButton1_Click()
Range("A9:AB50").Select
Selection.ClearContents
Selection.Interior.ColorIndex = 0
Worksheets("Draw Tree").Activate
Dim t As Integer '
Dim q As Integer '
Dim i As Integer
Dim j As Integer
Cells(10, 2) = Cells(6, 2) '
nstep = Cells(4, 2) '

For t = 0 To Cells(4, 2)
a = 1 * t
Cells(9, 2 + t) = a
Cells(10 + t, 1) = a
Next t

For Each Cell In Range(Cells(9, 2), Cells(9, 2 + nstep))


If Cell.Value >= "0" Then
Cell.Interior.ColorIndex = 6
End If
Next Cell

For Each Cell In Range(Cells(10, 1), Cells(10 + nstep, 1))


If Cell.Value >= "0" Then
Cell.Interior.ColorIndex = 6
End If
Next Cell

For i = 2 To nstep + 1
Cells(10, i + 1) = Cells(10, i) + Cells(5, 2)
For j = 2 To i
Cells(9 + j, 1 + i) = Cells(8 + j, i) - Cells(5, 2)
Next j
Next i
End Sub
Private Sub CommandButton1_Click()
Range("A9:BZ150").Select
Selection.ClearContents
Worksheets("Jr Binomial Tree").Activate
Dim i As Integer
Dim discountfactor As Variant

nstep = Cells(8, 2)

Range(Cells(10, 1), Cells(10 + nstep, 1 + nstep)) = BinTree(0,


Cells(3, 2), Cells(4, 2), Cells(5, 2), Cells(6, 2), Cells(7, 2),
Cells(8, 2))

For i = 0 To nstep
If Cells(10 + i, nstep + 1) >= 40 Then
Cells(10 + i, nstep + 3) = 1000 + (40 - 25) * 170
ElseIf Cells(10 + i, nstep + 1) >= 25 Then
Cells(10 + i, nstep + 3) = 1000 + (Cells(10 + i, nstep + 1).Value -
25) * 170
Else
Cells(10 + i, nstep + 3) = 1000
End If
Next i

Cells(9, nstep + 3) = ("payoff")

discountfactor = Exp(-(Cells(4, 2) - Cells(5, 2)) * (Cells(6, 2) /


Cells(8, 2)) * Cells(8, 2))

For i = 0 To nstep
Cells(10 + i, nstep + 4) = Cells(10 + i, nstep + 3) * Cells(7, 5) ^
(nstep - i) * Cells(8, 5) ^ i * discountfactor
Next i

Cells(9, nstep + 4) = ("pv")

Cells(3, 5) = Application.Sum(Range(Cells(10, nstep + 4), Cells(10


+ nstep, nstep + 4)))
End Sub

Private Sub CommandButton2_Click()


UserForm1.Show

End Sub

---------------------------------------------------------------------

Function BinTree(imod, s, r, q, tyr, sigma, nstep)


' Returns Binomial Share Price Tree (imod=0 for JR, 1 for CRR)
Dim delt, rnmut, u, d
Dim i As Integer, j As Integer
Dim Smat() As Variant
ReDim Smat(nstep, nstep)
delt = tyr / nstep

If imod = 0 Then
rnmut = (r - q - 0.5 * sigma ^ 2) * delt
u = Exp(rnmut + sigma * Sqr(delt))
d = Exp(rnmut - sigma * Sqr(delt))
Else
u = Exp(sigma * Sqr(delt))
d = 1 / u
End If

Smat(0, 0) = s
For i = 1 To nstep
Smat(i, 0) = ""
Next i
For j = 1 To nstep
For i = 1 To j
Smat(i, j) = d * Smat(i - 1, j - 1)
Next i
Smat(0, j) = u * Smat(0, j - 1)
For i = j + 1 To nstep
Smat(i, j) = ""
Next i
Next j
BinTree = Smat
End Function
Function bsnd1(s, X, r, q, tyr, sigma)
bsnd1 = (Log(s / X) + (r - q + sigma ^ 2 / 2) * tyr) / (sigma * tyr
^ 0.5)
End Function

Function bsnd2(s, X, r, q, tyr, sigma)


bsnd2 = (Log(s / X) + (r - q - sigma ^ 2 / 2) * tyr) / (sigma * tyr
^ 0.5)
End Function
Function PPNormInv(z, n)
' Returns the Peizer-Pratt Inversion
' Only defined for n odd
' Used in LR Binomial Option Valuation
Dim c1
n = Application.Odd(n)
c1 = Exp(-((z / (n + 1 / 3 + 0.1 / (n + 1))) ^ 2) * (n + 1 / 6))
PPNormInv = 0.5 + Sgn(z) * Sqr((0.25 * (1 - c1)))
End Function

Function BinOptionValue(imod, iopt, iea, s, X, r, q, tyr, sigma,


nstep)
' Returns Binomial Option Value (imod=1 for CRR, 2 for LR; iea=1
for euro, 2 for amer)
' Uses BSDOne fn
' Uses BSDTwo fn
' Uses PPNormInv fn
Dim delt, erdt, ermqdt, u, d, d1, d2, p, pdash, pstar
Dim i As Integer, j As Integer
Dim vvec() As Variant
If imod = 2 Then nstep = Application.Odd(nstep)
ReDim vvec(nstep)
If s > 0 And X > 0 And tyr > 0 And sigma > 0 Then
delt = tyr / nstep
erdt = Exp(r * delt)
ermqdt = Exp((r - q) * delt)
' Choice between imod=0 (JR), imod=1 (Cox,Ross&Rubinstein) and
imod=2 (Leisen&Reimer)
If imod = 0 Then
rnmut = (r - q - 0.5 * sigma ^ 2) * delt
u = Exp(rnmut + sigma * Sqr(delt))
d = Exp(rnmut - sigma * Sqr(delt))
p = 0.5
pstar = 1 - p
Else
If imod = 1 Then
u = Exp(sigma * Sqr(delt))
d = 1 / u
p = (ermqdt - d) / (u - d)
pstar = 1 - p
Else
d2 = bsnd2(s, X, r, q, tyr, sigma)
d1 = bsnd1(s, X, r, q, tyr, sigma)
p = PPNormInv(d2, nstep)
pstar = 1 - p
pdash = PPNormInv(d1, nstep)
u = ermqdt * pdash / p
d = (ermqdt - p * u) / (1 - p)
End If
End If
For i = 0 To nstep
vvec(i) = Application.Max(iopt * (s * (u ^ i) * (d ^ (nstep -
i)) - X), 0)
Next i
For j = nstep - 1 To 0 Step -1
For i = 0 To j
vvec(i) = (p * vvec(i + 1) + pstar * vvec(i)) / erdt
If iea = 2 Then vvec(i) = Application.Max(vvec(i), iopt * (s *
(u ^ i) * (d ^ (j - i)) - X))
Next i
Next j
BinOptionValue = vvec(0)
Else
BinOptionValue = -1
End If
End Function

Function BSoptionvalue(iopt, s, X, r, q, tyr, sigma)


Dim eqt, ert, nd1, nd2
eqt = Exp(-q * tyr)
ert = Exp(-r * tyr)
If s > 0 And X > 0 And tyr > 0 And sigma > 0 Then
nd1 = Application.NormSDist(iopt * bsnd1(s, X, r, q, tyr,
sigma))
nd2 = Application.NormSDist(iopt * bsnd2(s, X, r, q, tyr,
sigma))
BSoptionvalue = iopt * (s * eqt * nd1 - X * ert * nd2)
Else: BSoptionvalue = -1
End If

End Function
---------------------------------------------------------------------

Function MCOptionValue(iopt, s, k, r, q, T, sigma, nsim)

Dim sum, s1, s2, payoff1, payoff2 As Double

Randomize
sum = 0

For i = 1 To nsim
s1 = s * Exp((r - q - 0.5 * sigma ^ (2)) * T + sigma * Sqr(T) *
Application.NormSInv(Rnd))
s2 = s * Exp((r - q - 0.5 * sigma ^ (2)) * T - sigma * Sqr(T) *
Application.NormSInv(Rnd))

payoff1 = Application.Max(iopt * (s1 - k), 0)


payoff2 = Application.Max(iopt * (s2 - k), 0)
sum = sum + 0.5 * (payoff1 + payoff2)
Next i

MCOptionValue = (Exp(-r * T) * sum) / nsim

End Function

---------------------------------------------------------------------

Private Sub CommandButton2_Click()

n = Cells(10, 2)
Range(Cells(14, 1), Cells(13 + n, 2)).Select

Worksheets(" 3").ChartObjects.Delete
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("
3").Range(Cells(14, 1), Cells(13 + n, 2)), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = Sheets("
3").Range(Cells(14, 1), Cells(13 + n, 1))

ActiveChart.Location Where:=xlLocationAsObject, Name:=" 3"


With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "MCIntegration"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
"Simulations"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Value"
End With

End Sub

---------------------------------------------------------------------
Function Halton1(n, b) As Double

Dim h As Double, f As Double


Dim n1 As Integer, n0 As Integer, r As Integer
n0 = n
h = 0
f = 1 / b
Do While n0 > 0
n1 = Int(n0 / b)
r = n0 - n1 * b
h = h + f * r
f = f / b
n0 = n1
Loop
Halton1 = h
End Function

Function BoxMullerNormSInv1(phix1 As Double, phix2 As Double) As


Double

' Replaces NormSInv for quasi-random sequences (eg Faure)


' See Box and Muller

Dim h1, h2, vlog, norm1


h1 = phix1
h2 = phix2
vlog = Sqr(-2 * Log(h1))
norm1 = vlog * Cos(2 * Application.Pi() * h2)
BoxMullerNormSInv1 = norm1

End Function

Function BoxMullerNormSInv2(phix1 As Double, phix2 As Double) As


Double

' Replaces NormSInv for quasi-random sequences (eg Faure)


' See Box and Muller

Dim h1, h2, vlog, norm2


h1 = phix1
h2 = phix2
vlog = Sqr(-2 * Log(h1))
norm2 = vlog * Sin(2 * Application.Pi() * h2)
BoxMullerNormSInv2 = norm2
---------------------------------------------------------------------
Private Sub CommandButton1_Click()

S = Cells(3, 2)
k = Cells(4, 2)
T = Cells(5, 2)
r = Cells(6, 2)
sigma = Cells(7, 2)
facevalue = Cells(8, 2)
nt = Cells(9, 2)
ns = Cells(10, 2)
delta_t = T / nt

AA = 0
X = 0
optionValue = 0

Dim temp() As Variant


ReDim temp(nt)
Randomize
temp(0) = S

For j = 1 To ns 'run simulation

For i = 1 To nt 'construct stock price series

temp(i) = temp(i - 1) * Exp((r - 0.5 * sigma ^ (2)) * delta_t +


sigma * Sqr(delta_t) * Application.NormSInv(Rnd))

If i > nt - 32 And i < nt - 1 Then

AA = AA + temp(i)
End If

Next i
AA = AA / 30
X = Exp(-r * T) * Application.Max(AA - k, 0) * (facevalue / S)

optionValue = optionValue + X
Next j

optionValue = optionValue / ns
Cells(3, 7) = optionValue

End Sub
---------------------------------------------------------------------

Function DOPut(s, X, r, q, tyr, sigma, Sb)


Dim eqt, ert, NDOne, NDTwo, NDThree, NDFour, NDFive, NDSix,
NDSeven, NDEight, a, b
eqt = Exp(-q * tyr)
ert = Exp(-r * tyr)
a = (Sb / s) ^ (-1 + (2 * r / sigma ^ 2))
b = (Sb / s) ^ (1 + (2 * r / sigma ^ 2))
If s > 0 And X > 0 And tyr > 0 And sigma > 0 Then
NDOne = Application.NormSDist(BSDOne(s, X, r, q, tyr, sigma))
NDTwo = Application.NormSDist(BSDTwo(s, X, r, q, tyr, sigma))
NDThree = Application.NormSDist(BSDThree(s, X, r, q, tyr,
sigma, Sb))
NDFour = Application.NormSDist(BSDFour(s, X, r, q, tyr,
sigma, Sb))
NDFive = Application.NormSDist(BSDFive(s, X, r, q, tyr,
sigma, Sb))
NDSix = Application.NormSDist(BSDSix(s, X, r, q, tyr, sigma,
Sb))
NDSeven = Application.NormSDist(BSDSeven(s, X, r, q, tyr,
sigma, Sb))
NDEight = Application.NormSDist(BSDEight(s, X, r, q, tyr,
sigma, Sb))
DOPut = X * ert * (NDFour - NDTwo - a * (NDSeven - NDFive)) -
s * eqt * (NDThree - NDOne - b * (NDEight - NDSix))
Else
DOPut = -1
End If
End Function

Function TRF(e, e0, kp, kc, r, rf, T, sigma)

TRF = Application.Max(6.12 - e, 0) - 2 * Application.Max(e - 6.18,


0) - BSOptionValue(-1, e0, kp, sigma, rf, r, T) + 2 *
BSOptionValue(1, e0, kc, sigma, rf, r, T)

If e >= 6.18 Then

TRF = TRF - 2 * 0.06


End If

End Function

---------------------------------------------------------------------
Function BarrierOption(UpOrDown, InOrOut, iopt, s, k, b, r, q, sigma,
T, nt, ns)

' if UpOrDown=0 (Down) UpOrDown=1 (Up)


' if InOrOut =0 (Out) InOrOut =1 (In)
' iopt = 1 (call) iopt=-1 (put)

Dim payoff, sum, cross


Dim temp(1)
Dim j, i As Integer

Dim spath()
ReDim spath(nt, 1 To ns)
sum = 0
cross = 0
spath = AssetPaths(s, r, q, T, sigma, nt, ns)

'''''''''''''''''''''''''''''''''''''
If UpOrDown = 0 And InOrOut = 0 And iopt = -1 Then 'DOPut

If b >= s Then
MsgBox ("Barrier price must be less than current price")
ElseIf b >= k Then
MsgBox ("Barrier price must be less than strike price")

Else

For i = 1 To ns
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)
For j = 1 To nt
If spath(j, i) <= b Then
payoff = 0
j = nt + 1
cross = cross + 1
End If
Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross

BarrierOption = temp
End If

End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If UpOrDown = 0 And InOrOut = 0 And iopt = 1 Then 'DOCall

If b >= s Then
MsgBox ("Barrier price must be less than current price")
Else
For i = 1 To ns
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)
For j = 1 To nt

If spath(j, i) <= b Then


payoff = 0
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross
BarrierOption = temp
End If
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If UpOrDown = 0 And InOrOut = 1 And iopt = -1 Then 'DIPut

For i = 1 To ns
payoff = 0

For j = 1 To nt
If spath(j, i) <= b Then
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross

BarrierOption = temp
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If UpOrDown = 0 And InOrOut = 1 And iopt = 1 Then 'DICall

For i = 1 To ns
payoff = 0

For j = 1 To nt
If spath(j, i) <= b Then
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross

BarrierOption = temp
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If UpOrDown = 1 And InOrOut = 0 And iopt = -1 Then 'UOPut

If b <= s Then
MsgBox ("Barrier price must be greater than current price")
Else

For i = 1 To ns
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)

For j = 1 To nt
If spath(j, i) >= b Then
payoff = 0
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i
temp(0) = sum * Exp(-r * T) / ns
temp(1) = cross

BarrierOption = temp
End If
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''

If UpOrDown = 1 And InOrOut = 0 And iopt = 1 Then 'UOCall

If b <= s Then
MsgBox ("Barrier price must be greater than current price")
ElseIf b <= k Then
MsgBox ("Barrier price must be greater than strike price")
Else
For i = 1 To ns
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)

For j = 1 To nt
If spath(j, i) >= b Then
payoff = 0
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross

BarrierOption = temp
End If
End If

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''

If UpOrDown = 1 And InOrOut = 1 And iopt = -1 Then 'UIPut

For i = 1 To ns
payoff = 0

For j = 1 To nt
If spath(j, i) >= b Then
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross

BarrierOption = temp
End If

If UpOrDown = 1 And InOrOut = 1 And iopt = 1 Then 'UICall

For i = 1 To ns
payoff = 0

For j = 1 To nt
If spath(j, i) >= b Then
payoff = Application.Max(iopt * (spath(nt, i) - k), 0)
j = nt + 1
cross = cross + 1
End If

Next j
sum = sum + payoff
Next i

temp(0) = sum * Exp(-r * T) / ns


temp(1) = cross

BarrierOption = temp
End If

End Function

---------------------------------------------------------------------
Private Sub CommandButton1_Click()
S = Cells(3, 2)
x = Cells(4, 2)
Smax = Cells(5, 2)
r = Cells(7, 2)
q = Cells(8, 2)
sigma = Cells(13, 2)
tyr = Cells(11, 2)
iopt = -1
dS = Cells(15, 2)
dt = Cells(16, 2)

M = Int(Smax / dS)
N = Int(tyr / dt)
Dim matval()
ReDim matval(M, N)

' Cells(22, 1)
Range(Cells(22, 1), Cells(22 + M + 1, 2 + N + 3)).Select
Selection.ClearContents

'
Cells(22, 1) = "S"
For i = 0 To M
Cells(23 + i, 1) = Smax - i * dS
Next i

':
For j = 0 To N
Cells(22, 2 + j) = "t" & j
Next j

': abc
Cells(22, 2 + N + 1) = "a"
Cells(22, 2 + N + 2) = "b"
Cells(22, 2 + N + 3) = "c"

'show abc
' abc excel show

Range(Cells(23, 2 + N + 1), Cells(23 + M, 2 + N + 1)) =


Application.Transpose(ai(r, sigma, dt, M))
Range(Cells(23, 2 + N + 2), Cells(23 + M, 2 + N + 2)) =
Application.Transpose(bi(r, sigma, dt, M))
Range(Cells(23, 2 + N + 3), Cells(23 + M, 2 + N + 3)) =
Application.Transpose(ci(r, sigma, dt, M))
' payoff
matval = EuPutExpl(iopt, S, x, r, tyr, sigma, Smax, dS, dt)
Range(Cells(23, 2), Cells(23 + M, 2 + N)) = matval

' S0 BS
Cells(4, 5) = BSOptionValue(iopt, S, x, r, q, tyr, sigma)
' S0 finite difference option price
Mo = M - S / dS
Cells(5, 5) = matval(Mo, 0)

End Sub

S-ar putea să vă placă și