- ©«¤l
- 172
- ¥DÃD
- 39
- ºëµØ
- 20
- ¿n¤À
- 177
- ÂI¦W
- 0
- §@·~¨t²Î
- Microsoft Windows XP
- ³nÅ骩¥»
- Microsoft Office 2003
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- °ª¶¯
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2023-3-19
|
¬O³o¼Ë¶Ü?
Option Explicit
Public StockPrice As Double, StrikePrice As Double, T As Double, r As Double, v As Double, CurrentCall As Double
Sub ISD()
Dim StockPrice As Double, StrikePrice As Double, T As Double, r As Double, v As Double, CurrentCall As Double
StockPrice = Worksheets("Áô§tªi°Ê«×").Cells(2, 1)
StrikePrice = Worksheets("Áô§tªi°Ê«×").Cells(2, 2)
r = Worksheets("Áô§tªi°Ê«×").Cells(2, 3)
T = Worksheets("Áô§tªi°Ê«×").Cells(2, 4)
CurrentCall = Worksheets("Áô§tªi°Ê«×").Cells(2, 5)
v = Worksheets("Áô§tªi°Ê«×").Cells(2, 7)
Worksheets("Áô§tªi°Ê«×").Range("F2") = ISDC(StockPrice, StrikePrice, T, r, v, CurrentCall) * 100
End Sub
Function BSCall(StockPrice As Double, StrikePrice As Double, T As Double, r As Double, v As Double) As Double
Dim D1 As Double
Dim D2 As Double
Dim NormD1 As Double
Dim NormD2 As Double
D1 = (Log(StockPrice / StrikePrice) + (r + 0.5 * v ^ 2) * T) / v / T ^ 0.5
D2 = D1 - v * T ^ 0.5
NormD1 = Application.WorksheetFunction.NormSDist(D1)
NormD2 = Application.WorksheetFunction.NormSDist(D2)
BSCall = StockPrice * NormD1 - StrikePrice * Exp(-r * T) * NormD2
End Function
Function ISDC(StockPrice As Double, StrikePrice As Double, T As Double, r As Double, v As Double, CurrentCall As Double) As Double
Dim TempISD As Double
Dim ISDU As Double
Dim ISDL As Double
Dim TempCall As Double
Dim Dif As Single
ISDU = 3 '³]ªi°Ê²v³Ì°ª¬°300%
ISDL = 0 '³]ªi°Ê²v³Ì§C¬°300%
Do '¶}©l¤ÏÂйêÅç
TempISD = (ISDU + ISDL) / 2 'ªì©lȬ°150%
TempCall = BSCall(StockPrice, StrikePrice, T, r, v)
Dif = CurrentCall - TempCall '°²¦p»ù®æ¬Û¦P«hµ²§ô¹êÅç
If Dif = 0 Then
Exit Do
ElseIf Dif > 0 Then '±Nªi°Ê«×±ø¤j
ISDL = TempISD
ElseIf Dif < 0 Then '±Nªi°Ê«×±ø¤p
ISDU = TempISD
End If
If TempISD >= 2.9 Then 'Yªi°Ê«×¤j©ó290%
TempISD = 0 '©Î¬O¤p©ó1%®É«h¬°0
Exit Do '«hµ²³t°j°é
ElseIf TempISD <= 0.01 Then
TempISD = 0
Exit Do
End If
v = TempISD
Loop Until Abs(Dif) < 0.01 * CurrentCall '»~®tȳ]©w½d³ò
ISDC = TempISD
End Function |
|