/*  
** Version 01
** Date : 20/07/2001                                        
** --------------------------------------------------------------------------
** Copyright K.Cuthbertson and D. Nitzsche
** "Financial Engineering:Derivatives and Risk Manangement" - J. Wiley 2001
**
**   To establish a Delta-Gamma-Vega Neutral position Chp9, Q6, p. 269 
**
*/

new;  cls; 

@ --------------------------------------  USER INPUT -------------------------------- @

@ --------------------------------------  Portfolio-A ------------------------------- @

Nopt   = {-1000, -500, -2000, -500 } ;    @ Number of different options held= 4: same underlying @ 
delta  = { 0.5, 0.8, -0.4, 0.7 } ;        @ Delta of each option @ 
Ggamma = { 2.2, 0.6, 1.3, 1.8 } ;         @ Gamma of each option .Note: 'gamma' is GAUSS command @
vega   = {1.8, 0.2, 0.7, 1.4 } ;          @ Vega of each option @


deltaZ = 0.6 ;      @ Additional option-Z @
gammaZ = 1.5 ;
vegaZ  = 0.8 ;

deltaY = 0.1 ;      @ Additional Option-Y @
gammaY = 0.5 ;
vegaY  = 0.6 ;
@ --------------------------------------- END OF USER INPUT -------------------------- @

deltaA = Nopt'*delta ;             @ -- calculate the delta, gamma, vega of portfolio-A -- @
gammaA = Nopt'*Ggamma ;
vegaA  = Nopt'*vega ;

" -------------------------------------------------------------------------------------------- " ;
" Answer 6a: delta,gamma and vega of portfolio-A        "                    deltaA~gammaA~vegaA ;
" -------------------------------------------------------------------------------------------- " ;

nZgam  = - gammaA/gammaZ ;      @ -- calculate the no. options of Z to make A+Z gamma neutral -- @
deltaN = nZgam*deltaZ + deltaA ;

" ------------------------------------------------------------------------------------------- " ;
" Answer 6b: 'Nz' required for gamma neutral and new delta (for A+Z) "             nZgam~deltaN ;
" --------------------------------------------------------------------------------------------" ;

nZveg = - vegaA/vegaZ ;         @ -- calculate the no. options of Z to make A+Z vega  neutral -- @
deltaNN = nZveg*deltaZ + deltaA ;

" ----------------------------------------------------------------------------------------- " ;
" Answer 6c: 'Nz' required for vega neutral and new delta (for A+z) "           nZveg~deltaNN ;
" ----------------------------------------------------------------------------------------- " ;
 
@ ------------- Set up GV_ZY with row1=gamma for Z and Y and row2=vega for Zand Y ------------ @

GV_ZY = zeros(2,2) ; 
    GV_ZY[1,1] = gammaZ ; 
    GV_ZY[1,2] = gammaY ; 
    GV_ZY[2,1] = vegaZ ; 
    GV_ZY[2,2] = vegaY ; 

@ ------------------- Set up GV_A with row1=gamma for A and row2=vega for A ------------------- @

GV_A = zeros(2,1) ; 
    GV_A[1,1] = gammaA ; 
    GV_A[2,1] = vegaA ; 

@ --- Note the minus sign since the eqn for Gamma+Vega neutral is: GV_ZY*Nzy + GV_A = 0 ------- @

Nzy = - GV_A/GV_ZY ;

@ -------- The new delta of (A+Z+Y) when Z and Y are held to give Gamma+Vega neutrality ------- @

deltaAZY = Nzy[1,1]*deltaZ + Nzy[2,1]*deltaY + deltaA ;

@ ------ The position in the underlying to also make (A+Z+Y), delta neutral is '-deltaAZY' ---- @


?; " ------------------------------------------------------------------------------------------ " ;
   "          Answer (6d): To make portfolio-A, gamma, vega and delta neutral                   " ;
   " ------------------------------------------------------------------------------------------ " ;
 
?; " Gamma (=row 1) and Vega (=row 2) of additional Options Z and Y                 " GV_ZY ; 
?; " Gamma (=row 1) and Vega (=row 2) of Portfolio-A                                " GV_A ; 
?; " The number of options of Y and Z required to make (A+Z+Y): Gamma+Vega neutral  " Nzy' ;
   " The position in the underlying to also make (A+Z+Y), delta neutral is          " -deltaAZY ;
" --------------------------------------------------------------------------------------------- " ;




end ;