Sob Doc
Essay by james9997 • February 1, 2016 • Term Paper • 1,940 Words (8 Pages) • 1,286 Views
Q1: Please select appropriate answers from choices (a) to (x) to fill in 5 blank lines to finish the VBA code for binomial pricing
(Note: Style = “euro” or “amer”, C_P = 1 for call and -1 for put, n as the number of steps, dt is the time length of each step, u is up movement multiplier, Pu is the probability of going up)
===================================================================================
Function binomial_all2(Style As String, C_P As Double, spot As Double, strike As Double, _
timetomaturity As Double, risk_free As Double, div As Double, _
vol As Double, n As Integer) As Double
Dim price(), S() As Double
Dim dt, u, Pu, discount As Double
Dim I, j, Arraysize As Integer
dt = timetomaturity / n
discount = Exp(-risk_free * dt)
Arraysize = ____(1)________
u = Exp(vol * dt ^ (1 / 2))
d = 1 / u
Pu = (Exp((risk_free - div) * dt) - d) / (u - d)
ReDim price(Arraysize)
ReDim S(Arraysize)
S(0) = spot * (u ^ n)
For I = 1 To n
S(I) = S(I - 1) * ___(2)____
Next I
For I = 0 To n
price(I) = Application.WorksheetFunction.Max(0#, C_P * (S(I) - strike))
Next I
For j = n - 1 To ___(3)____
For I = 0 To j
If Style = "euro" Then
price(I) = discount * (Pu * price(I) + (1 - Pu) * price(I + 1))
ElseIf Style = "amer" Then
price(I) = discount * (Pu * price(I) + (1 - Pu) * price(I + 1))
S(I) = ___(4)________
price(I) = WorksheetFunction.Max(__(5)____, C_P * (S(I) - strike))
End If
Next I
Next j
binomial_all2 = price(0)
End Function
=====================================================================================
Choices for Q1:
(a) S(I) | (b) S(0) | (c) price(0) |
(d) u | (e) n | (f) (u^2) |
(g) S() | (h) n + 1 | (i) (d^2) |
(j) spot * (d ^ n) | (k) price() | (l) (S(I) - strike) |
(m) spot * (u ^ n) | (n) n + 2 | (o) price(), S() |
(p) (u ^ n) | (q) C_P * (S(I) - strike) | (r) C_P * (strike - S(I)) |
(s) 0 Step -1 | (t) 0 | (u) S(I) * u |
(v) S(I) * d | (w) price(I) | (x) 0 Step 1 |
Q2: Please select appropriate answers from choices (a) to (u) to fill in 5 blank lines to finish the VBA code for implied volatility
(Note: Style = “euro” or “amer”, class = 1 for call and -1 for put, num as the number of steps. The function “binomial_all2” has been defined in Q1)
=============================================================================
Function ImpliedVol3(Style As String, class As Double, S0 As Double, K As Double, T As Double, _
r As Double, q As Double, num As Integer, market As Double)
Dim indicator As Integer
Dim v As Double
Dim binoprice As Double
binoprice = 0
indicator = 1
v = 0.001
For _____(1)________ = 1 To 100000
binoprice = binomial_all2(________(2)__________)
If ____(3)____________ Then
ImpliedVol3 = v
____(4)_______________
End If
v = v + 0.001
Next
If ____(5)_________ Then MsgBox "Volatility over 1000%"
End Function
=================================================================================
Choices for Q2:
(a) 0.001 | (b) 10000 | (c) ElseIf |
(d) indicator | (e) v | (f) binoprice |
(g) binoprice = market | (h) 10000 <= indicator | (i) 10000 < indicator |
(j) binoprice <= market | (k) binoprice >= market | (l) 100000 < indicator |
(m) 100000 <= indicator | (n) Exit If | (o) market |
(p) Style, C_P, S0, K, T, r, q, v, num | (q) Style, class, S0, K, T, r, q, v, num | (r) Style, C_P, S0, K, T, r, q, v, n |
(s) Exit | (t) Style, class, S0, K, T, r, q, v, n | (u) Exit For |
...
...