Calculates option's gamma. More...

#include <optionGamma.hpp>

Inheritance diagram for julian::OptionGamma:
julian::OptionGreeksDecorator julian::OptionGreeks

Public Member Functions

 OptionGamma (SmartPointer< OptionGreeks > input, double h, NumDiffScheme scheme, std::string risk_name="Gamma")
 constructor More...
 
GreeksIntermediateResults calculateRisks (const SmartPointer< MarketModel > &model, const SmartPointer< PricingEngine > &prizer, const SmartPointer< Option > &option)
 Calculates the option's gamma. More...
 
std::map< std::string, double > getRisks (const SmartPointer< MarketModel > &model, const SmartPointer< PricingEngine > &prizer, const SmartPointer< Option > &option)
 Returns the PV and Greek parameter. More...
 
OptionGammaclone () const
 virtual copy constructor More...
 
- Public Member Functions inherited from julian::OptionGreeksDecorator
 OptionGreeksDecorator (SmartPointer< OptionGreeks > risks)
 Constructor. More...
 
OptionGreeksDecoratorclone () const
 Virtual copy constructor. More...
 
- Public Member Functions inherited from julian::OptionGreeks
virtual ~OptionGreeks ()
 Destructor. More...
 

Private Member Functions

void CntrGamma (GreeksIntermediateResults &rr, const SmartPointer< MarketModel > &model, const SmartPointer< PricingEngine > &prizer, const SmartPointer< Option > &option)
 Calculates gamma using central differencing scheme. More...
 
void FwdGamma (GreeksIntermediateResults &rr, const SmartPointer< MarketModel > &model, const SmartPointer< PricingEngine > &prizer, const SmartPointer< Option > &option)
 Calculates gamma using forward differencing scheme. More...
 
void BwdGamma (GreeksIntermediateResults &rr, const SmartPointer< MarketModel > &model, const SmartPointer< PricingEngine > &prizer, const SmartPointer< Option > &option)
 Calculates gamma using backward differencing scheme. More...
 

Private Attributes

double h_
 Increment used in differencing scheme. More...
 
NumDiffScheme scheme_
 Scheme used in differencing. More...
 
std::string risk_name_
 Risk name that will be used as key for result map. Default name is Gamma. More...
 

Detailed Description

Calculates option's gamma.

This method calculates Gamma. Using the method prize of julian::PricingEngine and bumpSpot of julian::MarketModel it calculates the second derivative of option prize wrt to spot prize. Delta of option is calculated using the finite difference scheme

  • $\Gamma = \frac{\partial^2 PV}{\partial Spot^2} \approx \frac{PV(Spot+2h) - 2PV(Spot+h) + PV(Spot)}{h^2}$ when forward scheme is used,
  • $\Gamma = \frac{\partial^2 PV}{\partial Spot^2} \approx \frac{PV(Spot) - 2PV(Spot-h) + PV(Spot-2h)}{h^2}$ when backward scheme is used,
  • $\Gamma = \frac{\partial^2 PV}{\partial Spot^2} \approx \frac{PV(Spot+h) - 2PV(Spot) + PV(Spot-h)}{h^2}$ when central scheme is used.

The result is saved in map. OptionGamma is a concrete decorator in decorator structure. Concrete Decorator is a class that altered alters the behaviour of Concrete Component.

Constructor & Destructor Documentation

julian::OptionGamma::OptionGamma ( SmartPointer< OptionGreeks input,
double  h,
NumDiffScheme  scheme,
std::string  risk_name = "Gamma" 
)
inline

constructor

Member Function Documentation

void julian::OptionGamma::BwdGamma ( GreeksIntermediateResults rr,
const SmartPointer< MarketModel > &  model,
const SmartPointer< PricingEngine > &  prizer,
const SmartPointer< Option > &  option 
)
private

Calculates gamma using backward differencing scheme.

Method checks if the PV for a given market shifts were calculated. If yes, it uses them in estimating the Gamma. If they were not calculated, it performs calculations, saves them and then calculates Gamma.

GreeksIntermediateResults julian::OptionGamma::calculateRisks ( const SmartPointer< MarketModel > &  model,
const SmartPointer< PricingEngine > &  prizer,
const SmartPointer< Option > &  option 
)
virtual

Calculates the option's gamma.

Delta of option is calculated using the finite difference scheme

  • $\Gamma = \frac{\partial^2 PV}{\partial Spot^2} \approx \frac{PV(Spot+2h) - 2PV(Spot+h) + PV(Spot)}{h^2}$ when forward scheme is used,
  • $\Gamma = \frac{\partial^2 PV}{\partial Spot^2} \approx \frac{PV(Spot) - 2PV(Spot-h) + PV(Spot-2h)}{h^2}$ when backward scheme is used,
  • $\Gamma = \frac{\partial^2 PV}{\partial Spot^2} \approx \frac{PV(Spot+h) - 2PV(Spot) + PV(Spot-h)}{h^2}$ when central scheme is used.

Reimplemented from julian::OptionGreeksDecorator.

OptionGamma * julian::OptionGamma::clone ( ) const
virtual

virtual copy constructor

Reimplemented from julian::OptionGreeks.

void julian::OptionGamma::CntrGamma ( GreeksIntermediateResults rr,
const SmartPointer< MarketModel > &  model,
const SmartPointer< PricingEngine > &  prizer,
const SmartPointer< Option > &  option 
)
private

Calculates gamma using central differencing scheme.

Method checks if the PV for a given market shifts were calculated. If yes, it uses them in estimating the Gamma. If they were not calculated, it performs calculations, saves them and then calculates Gamma.

void julian::OptionGamma::FwdGamma ( GreeksIntermediateResults rr,
const SmartPointer< MarketModel > &  model,
const SmartPointer< PricingEngine > &  prizer,
const SmartPointer< Option > &  option 
)
private

Calculates gamma using forward differencing scheme.

Method checks if the PV for a given market shifts were calculated. If yes, it uses them in estimating the Gamma. If they were not calculated, it performs calculations, saves them and then calculates Gamma.

std::map< std::string, double > julian::OptionGamma::getRisks ( const SmartPointer< MarketModel > &  model,
const SmartPointer< PricingEngine > &  prizer,
const SmartPointer< Option > &  option 
)
virtual

Returns the PV and Greek parameter.

Returns
method returns map with name of Greeks as key and the value of Greeks as value

Reimplemented from julian::OptionGreeksDecorator.

Member Data Documentation

double julian::OptionGamma::h_
private

Increment used in differencing scheme.

std::string julian::OptionGamma::risk_name_
private

Risk name that will be used as key for result map. Default name is Gamma.

NumDiffScheme julian::OptionGamma::scheme_
private

Scheme used in differencing.


The documentation for this class was generated from the following files:
  • C:/Unix/home/OEM/jULIAN/src/pricingEngines/optionGreeks/optionGamma.hpp
  • C:/Unix/home/OEM/jULIAN/src/pricingEngines/optionGreeks/optionGamma.cpp