Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

OptionStrategy Class Reference

#include <OptionStrategy.h>

List of all members.

Public Member Functions

 OptionStrategy ()
 Default constructor: initialize parameters.

 ~OptionStrategy ()
void addOneOptionToStrategy (Real spot, Real vol, bool isVol, Real r, Real K, Real T, TypeOptionBS type, Real Quantity)
 Generic function to add Options to the Strategy.

void addOneBlackScholesObject (BlackScholes *bs, Real Quantity)
void addLongCallSpread (Real spot, Real volStrike1, bool isVol1, Real volStrike2, bool isVol2, Real r, Real K1, Real K2, Real T, Real Quantity)
 Create a long call spread in the portfolio.

void addLongStraddle (Real spot, Real vol, bool isVol, Real r, Real K, Real T, Real Quantity)
 Create a long straddle in the portfolio.

void addLongStrangle (Real spot, Real volStrike1, bool isVol1, Real volStrike2, bool isVol2, Real r, Real K1, Real K2, Real T, Real Quantity)
 Create a long strangle in the portfolio.

void addLongButterflySpread (Real spot, Real volStrike1, bool isVol1, Real volStrike2, bool isVol2, Real volStrike3, bool isVol3, Real r, Real K1, Real K2, Real T, Real Quantity)
 There are two functions for butterfly if you want to specify or not K3=(K1+K2)/2 by default.

void addLongButterflySpread (Real spot, Real volStrike1, bool isVol1, Real volStrike2, bool isVol2, Real volStrike3, bool isVol3, Real r, Real K1, Real K2, Real K3, Real T, Real Quantity)
void addLongRatioCallSpread (Real spot, Real volStrike1, bool isVol1, Real volStrike2, bool isVol2, Real r, Real K1, Real K2, Real T, Real Quantity)
 Create a long ratio call spread in the portfolio.

void addLongPutSpread (Real spot, Real volStrike1, bool isVol1, Real volStrike2, bool isVol2, Real r, Real K1, Real K2, Real T, Real Quantity)
 Create a long put spread in the portfolio.

Real getGlobalDelta ()
 Get Greeks for global Portfolio.

Real getGlobalGamma ()
Real getGlobalVega ()
Real getGlobalTheta ()
Real getGlobalRho ()
Real returnPrice ()
 Return global price of the portfolio.

Real recalcPrice ()
 Recalculate global price of the portfolio in case of change.

Natural returnNbOptions () const
 Return number of options in the portfolio.

BlackScholesreturnOption (Natural i) const
 Return pointer on blackscholes object inside, used for variance swaps.

Real returnOptionQuantity (Natural i) const
 Return quantity on blackscholes object inside.

void changeRate (Real addConstant=defaultshiftRate)
 Add constant rate to the inside rate of all BlackScholes objects.

void changeVol (Real addConstant=defaultshiftVol)
 Add constant vol to the inside vol of all BlackScholes objects.

void changeMaturity (Real addConstant=defaultshiftMat)
 Add constant maturity to the inside maturity of all BlackScholes objects.

void changeSpot (Real addConstant=defaultshiftSpot)
 Add constant spot to the inside spot of all BlackScholes objects.

void changeStrike (Real addConstant=defaultshiftStrike)
 Add constant strike to the inside strike of all BlackScholes objects.


Private Attributes

Real _price
Natural _nbOptions
valarray< BlackScholes * > _insideOptions
valarray< Real_insideQuantities

Friends

ostream & operator<< (ostream &os, const OptionStrategy &optionStrategy)
 display parameters of options in the optionstrategy object

ostream & operator<< (ostream &os, const OptionStrategy *optionStrategy)


Constructor & Destructor Documentation

OptionStrategy::OptionStrategy  ) 
 

Default constructor: initialize parameters.

Definition at line 3 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, and _nbOptions.

OptionStrategy::~OptionStrategy  ) 
 

Definition at line 10 of file OptionStrategy.cpp.


Member Function Documentation

void OptionStrategy::addLongButterflySpread Real  spot,
Real  volStrike1,
bool  isVol1,
Real  volStrike2,
bool  isVol2,
Real  volStrike3,
bool  isVol3,
Real  r,
Real  K1,
Real  K2,
Real  K3,
Real  T,
Real  Quantity
 

Definition at line 78 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Call, r, and Real.

void OptionStrategy::addLongButterflySpread Real  spot,
Real  volStrike1,
bool  isVol1,
Real  volStrike2,
bool  isVol2,
Real  volStrike3,
bool  isVol3,
Real  r,
Real  K1,
Real  K2,
Real  T,
Real  Quantity
 

There are two functions for butterfly if you want to specify or not K3=(K1+K2)/2 by default.

Definition at line 72 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Call, r, and Real.

Referenced by inputButterflySpread(), mainoptionstrategy(), and mainvarianceswap().

void OptionStrategy::addLongCallSpread Real  spot,
Real  volStrike1,
bool  isVol1,
Real  volStrike2,
bool  isVol2,
Real  r,
Real  K1,
Real  K2,
Real  T,
Real  Quantity
 

Create a long call spread in the portfolio.

We search to be long the call with smallest strike and short the other

Definition at line 44 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Call, r, and Real.

Referenced by inputCallSpread().

void OptionStrategy::addLongPutSpread Real  spot,
Real  volStrike1,
bool  isVol1,
Real  volStrike2,
bool  isVol2,
Real  r,
Real  K1,
Real  K2,
Real  T,
Real  Quantity
 

Create a long put spread in the portfolio.

Definition at line 95 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Put, r, and Real.

Referenced by inputPutSpread().

void OptionStrategy::addLongRatioCallSpread Real  spot,
Real  volStrike1,
bool  isVol1,
Real  volStrike2,
bool  isVol2,
Real  r,
Real  K1,
Real  K2,
Real  T,
Real  Quantity
 

Create a long ratio call spread in the portfolio.

Definition at line 84 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Call, r, and Real.

Referenced by inputRatioCallSpread().

void OptionStrategy::addLongStraddle Real  spot,
Real  vol,
bool  isVol,
Real  r,
Real  K,
Real  T,
Real  Quantity
 

Create a long straddle in the portfolio.

Definition at line 56 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Call, Put, r, and Real.

Referenced by inputStraddle().

void OptionStrategy::addLongStrangle Real  spot,
Real  volStrike1,
bool  isVol1,
Real  volStrike2,
bool  isVol2,
Real  r,
Real  K1,
Real  K2,
Real  T,
Real  Quantity
 

Create a long strangle in the portfolio.

Definition at line 61 of file OptionStrategy.cpp.

References addOneOptionToStrategy(), Call, Put, r, and Real.

Referenced by inputStrangle().

void OptionStrategy::addOneBlackScholesObject BlackScholes bs,
Real  Quantity
 

Definition at line 37 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Referenced by inputOptionStrategy(), and mainvarianceswap().

void OptionStrategy::addOneOptionToStrategy Real  spot,
Real  vol,
bool  isVol,
Real  r,
Real  K,
Real  T,
TypeOptionBS  type,
Real  Quantity
 

Generic function to add Options to the Strategy.

Definition at line 29 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, r, and Real.

Referenced by addLongButterflySpread(), addLongCallSpread(), addLongPutSpread(), addLongRatioCallSpread(), addLongStraddle(), and addLongStrangle().

void OptionStrategy::changeMaturity Real  addConstant = defaultshiftMat  ) 
 

Add constant maturity to the inside maturity of all BlackScholes objects.

Definition at line 175 of file OptionStrategy.cpp.

References _insideOptions, _nbOptions, BlackScholes::changeMaturity(), BlackScholes::getMaturity(), and Real.

Referenced by VarianceSwap::getTheta().

void OptionStrategy::changeRate Real  addConstant = defaultshiftRate  ) 
 

Add constant rate to the inside rate of all BlackScholes objects.

Definition at line 161 of file OptionStrategy.cpp.

References _insideOptions, _nbOptions, BlackScholes::changeRate(), BlackScholes::getRate(), and Real.

Referenced by VarianceSwap::getRho().

void OptionStrategy::changeSpot Real  addConstant = defaultshiftSpot  ) 
 

Add constant spot to the inside spot of all BlackScholes objects.

Definition at line 182 of file OptionStrategy.cpp.

References _insideOptions, _nbOptions, BlackScholes::changeSpot(), BlackScholes::getSpot(), and Real.

void OptionStrategy::changeStrike Real  addConstant = defaultshiftStrike  ) 
 

Add constant strike to the inside strike of all BlackScholes objects.

Definition at line 189 of file OptionStrategy.cpp.

References _insideOptions, _nbOptions, BlackScholes::changeStrike(), BlackScholes::getStrike(), and Real.

void OptionStrategy::changeVol Real  addConstant = defaultshiftVol  ) 
 

Add constant vol to the inside vol of all BlackScholes objects.

Definition at line 168 of file OptionStrategy.cpp.

References _insideOptions, _nbOptions, BlackScholes::changeVol(), BlackScholes::getVolatility(), and Real.

Referenced by VarianceSwap::getVega().

Real OptionStrategy::getGlobalDelta  ) 
 

Get Greeks for global Portfolio.

Definition at line 106 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Referenced by inputOptionStrategy(), and mainoptionstrategy().

Real OptionStrategy::getGlobalGamma  ) 
 

Definition at line 114 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Referenced by inputOptionStrategy().

Real OptionStrategy::getGlobalRho  ) 
 

Definition at line 138 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Referenced by inputOptionStrategy(), and Portfolio::returnSensibilityToRate().

Real OptionStrategy::getGlobalTheta  ) 
 

Definition at line 130 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Referenced by inputOptionStrategy(), and Portfolio::returnSensibilityToTime().

Real OptionStrategy::getGlobalVega  ) 
 

Definition at line 122 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Referenced by inputOptionStrategy(), and Portfolio::returnSensibilityToVol().

Real OptionStrategy::recalcPrice  ) 
 

Recalculate global price of the portfolio in case of change.

Definition at line 19 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, _nbOptions, and Real.

Natural OptionStrategy::returnNbOptions  )  const
 

Return number of options in the portfolio.

Definition at line 147 of file OptionStrategy.cpp.

References _nbOptions, and Natural.

Referenced by VarianceSwap::getPrice(), and operator<<().

BlackScholes * OptionStrategy::returnOption Natural  i  )  const
 

Return pointer on blackscholes object inside, used for variance swaps.

Definition at line 151 of file OptionStrategy.cpp.

References _insideOptions, and Natural.

Referenced by VarianceSwap::getPrice(), and operator<<().

Real OptionStrategy::returnOptionQuantity Natural  i  )  const
 

Return quantity on blackscholes object inside.

Definition at line 156 of file OptionStrategy.cpp.

References _insideOptions, _insideQuantities, Natural, and Real.

Referenced by operator<<().

Real OptionStrategy::returnPrice  ) 
 

Return global price of the portfolio.

Definition at line 14 of file OptionStrategy.cpp.

References Real.

Referenced by Portfolio::getPrice(), inputOptionStrategy(), and mainoptionstrategy().


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const OptionStrategy optionStrategy
[friend]
 

Definition at line 28 of file OptionStrategy.h.

ostream& operator<< ostream &  os,
const OptionStrategy optionStrategy
[friend]
 

display parameters of options in the optionstrategy object

Parameters:
os: the output stream to direct output to
optionStrategy: the option strategy to display
Returns:
output stream as is standard for operator<<

Definition at line 196 of file OptionStrategy.cpp.


Member Data Documentation

valarray<BlackScholes*> OptionStrategy::_insideOptions [private]
 

Definition at line 93 of file OptionStrategy.h.

Referenced by addOneBlackScholesObject(), addOneOptionToStrategy(), changeMaturity(), changeRate(), changeSpot(), changeStrike(), changeVol(), getGlobalDelta(), getGlobalGamma(), getGlobalRho(), getGlobalTheta(), getGlobalVega(), OptionStrategy(), recalcPrice(), returnOption(), and returnOptionQuantity().

valarray<Real> OptionStrategy::_insideQuantities [private]
 

Definition at line 94 of file OptionStrategy.h.

Referenced by addOneBlackScholesObject(), addOneOptionToStrategy(), getGlobalDelta(), getGlobalGamma(), getGlobalRho(), getGlobalTheta(), getGlobalVega(), OptionStrategy(), recalcPrice(), and returnOptionQuantity().

Natural OptionStrategy::_nbOptions [private]
 

Definition at line 92 of file OptionStrategy.h.

Referenced by addOneBlackScholesObject(), addOneOptionToStrategy(), changeMaturity(), changeRate(), changeSpot(), changeStrike(), changeVol(), getGlobalDelta(), getGlobalGamma(), getGlobalRho(), getGlobalTheta(), getGlobalVega(), OptionStrategy(), recalcPrice(), and returnNbOptions().

Real OptionStrategy::_price [private]
 

Definition at line 91 of file OptionStrategy.h.


The documentation for this class was generated from the following files:
Note: Generated nightly - reload for latest version
Generated on Thu Dec 22 23:12:40 2005 for terreneuve by doxygen 1.3.6