#include <OptionStrategy.h>
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. | |
BlackScholes * | returnOption (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) |
|
Default constructor: initialize parameters.
Definition at line 3 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, and _nbOptions. |
|
Definition at line 10 of file OptionStrategy.cpp. |
|
Definition at line 78 of file OptionStrategy.cpp. References addOneOptionToStrategy(), Call, r, and Real. |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
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(). |
|
Definition at line 37 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. Referenced by inputOptionStrategy(), and mainvarianceswap(). |
|
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(). |
|
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(). |
|
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(). |
|
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. |
|
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. |
|
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(). |
|
Get Greeks for global Portfolio.
Definition at line 106 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. Referenced by inputOptionStrategy(), and mainoptionstrategy(). |
|
Definition at line 114 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. Referenced by inputOptionStrategy(). |
|
Definition at line 138 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. Referenced by inputOptionStrategy(), and Portfolio::returnSensibilityToRate(). |
|
Definition at line 130 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. Referenced by inputOptionStrategy(), and Portfolio::returnSensibilityToTime(). |
|
Definition at line 122 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. Referenced by inputOptionStrategy(), and Portfolio::returnSensibilityToVol(). |
|
Recalculate global price of the portfolio in case of change.
Definition at line 19 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, _nbOptions, and Real. |
|
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<<(). |
|
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<<(). |
|
Return quantity on blackscholes object inside.
Definition at line 156 of file OptionStrategy.cpp. References _insideOptions, _insideQuantities, Natural, and Real. Referenced by operator<<(). |
|
Return global price of the portfolio.
Definition at line 14 of file OptionStrategy.cpp. References Real. Referenced by Portfolio::getPrice(), inputOptionStrategy(), and mainoptionstrategy(). |
|
Definition at line 28 of file OptionStrategy.h. |
|
display parameters of options in the optionstrategy object
Definition at line 196 of file OptionStrategy.cpp. |
|
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(). |
|
Definition at line 94 of file OptionStrategy.h. Referenced by addOneBlackScholesObject(), addOneOptionToStrategy(), getGlobalDelta(), getGlobalGamma(), getGlobalRho(), getGlobalTheta(), getGlobalVega(), OptionStrategy(), recalcPrice(), and returnOptionQuantity(). |
|
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(). |
|
Definition at line 91 of file OptionStrategy.h. |