vba代写 Course EF5213 Assignment #2

City University of Hong Kong Department of Economics and Finance

Course EF5213 Assignment #2 ( due March 4, 2018 ) 1. Use VBA as programming tool, implement the implicit finite difference method under the Crank-

Nicholson scheme to price an accumulator contract written on a stock with Cox-Ingersoll-Ross volatility structure as (St, t)   √St , where St is the underlying stock price at time t. Consider the following input parameters in your implementation :

On option :

r Risk free interest rate
  Volatility factor of the underlying stock
Q  Contract size
{ T1 , T2 , … , Tn }  Settlement dates of the contract K  Strike price of the contract
L  Knock-out price of the contract

L K

St0
T1 T2 T3 … Tn

On precision : imax  Number of steps to maturity
jmax  Size parameter of the tridiagonal matrix

S  Price increment in the lattice
To improve efficiency, use the enclosed SolveAxb routine from Numerical Recipies in solving the

matrix equation Ann xn1  bn1 based on singular value decomposition.

Note : With accumulator, investor agrees and also entitles to buy a certain amount Q of a stock at a fixed price K and at every settlement dates { T1 , T2 , … , Tn } over a period of time. There is a knock-out price (L  K) that terminates the contract.

 Define time steps ti with imax t  Tn .
 Perform a backward iteration that starts off from Tn with payoff F(Sj , Tn)  Q  ( Sj  K ).  If ti corresponds to a settlement date, ( i.e. ti  1⁄2t  Tk  ti  1⁄2t for some Tk )

F(Sj L,ti)Fitr(Sj L,ti)Q(Sj K) F(Sj L,ti)Q(Sj K)

where Fitr() is the option vector immediately after the backward iteration  If ti is not a settlement date, F(Sj  L , ti)  Fitr(Sj  L , ti)

F(Sj L,ti)0

Referring to the transition at boundaries F(S0, ti  1)  b0 F(S0, ti) and F(Sjmax , ti  1)  bjmax F(Sjmax , ti). It is always true that bjmax  1 for Sjmax  . Also, we must have b0  1 whenever the option can be exercised. Otherwise, it is generally true that b0  ert.

( 50 points )