<<
>>

2: VBA -

Function Newton Raphson Collector Vol (Call Put Flag As String, M As Double, _

S As Double, T As Double, R As Double, CM As Double) As Double

Dim vi As Double, ci As Double

Dim Vegai As Double, epsilon As Double

Dim counter As Integer, z As Integer

z = 1

If Call Put Flag = "p" Then z = - 1

vi = z * (Abs (Log (M / S) + R * T) * 2 / T) ^ 0.5

ci = z * Black Scholes (M, S, T, R, vi)

Vegai = z * Black Scholes Vega (M, S, T, R, vi)

epsilon = 0.000000000001

counter = 0

While Abs (CM - ci) > epsilon

counter = counter + 1

If counter > 30 Then

Exit Function

End If

vi = vi - (ci - CM) / Vegai

ci = z * Black Scholes (M, S, T, R, vi)

Vegai = z * Black Scholes Vega (M, S, T, R, vi)

Wend

Newton Raphson Collector Vol = z * vi

End Function

Public Function BlackScholesVega (M, S, T, R, v)

Dim d1 As Double

d1 = (Log (M / S) + (R + v ^ 2 / 2) * T) / (v * Sqr (T))

Black Scholes Vega = Exp (- d1 ^ 2 / 2) * M * Sqr (T) / Sqr (2 * Application. Pi))

End Function

Public Function Black Scholes (M, S, T, R, v)

Dim d1 As Double

d1 = (Log (M / S) + (R + v ^ 2 / 2) * T) / (v * Sqr (T))

Black Scholes = M * Application. Norm S Dist (d1) - S * Exp (- R * T) * Application. Norm S Dist (d1 - v *

Sqr (T))

End Function

<< | >>
: . . . - 2007. 2007

2: VBA -:

  1. ѻ - VBA EXCEL
  2. 2.6. VBA
  3. 1: VBA -
  4. 2.8.
  5. - VBA EXCEL
  6. ѻ
- - - - , -
- , - - - - - - - - -