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

volsurface.h

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef volsurface_h
00003 #define volsurface_h
00004 
00005 #include "../common/types.h"
00006 #include "../common/date.h"
00007 #include "../common/interpolator.h" 
00008 #include <valarray>
00009 #include <cmath> // c library of math functions
00010 #include "../PartB/yieldCurve.h"
00011 #include "../PartA/BlackScholes/BlackScholes.h"
00012 
00013 #ifndef PI
00014 #define PI 3.141592653589793238462643
00015 #endif
00016 
00017 using namespace std;
00018 
00019 class volsurfaceparams {
00020 public:
00021         valarray<Real> strikes;
00022         valarray<Date> maturities;
00023         valarray<valarray<Real> > callputprices;
00024         valarray<valarray<bool> > iscallputprices;
00025 };
00026 
00027 class volsurface{
00028       
00029 private :
00030   Real _stockPrice;
00031   Date _today;
00032   valarray<Real> _strikes;
00033   valarray<Date> _maturities;
00034   yieldCurve _yieldCurve;
00035   valarray<valarray<Real> > _callputprices;
00036   valarray<valarray<bool> > _iscallputprices;
00037   valarray<valarray<Real> > _impliedvolsurface;
00038   interpolator _interpolvolsurf;
00039   bool _volsurfconst;
00040   Real _constantvol;
00041   
00042 public : 
00043 
00053   volsurface(Real stockPrice, Date today, valarray<Real> strikes,  valarray<Date> maturities, yieldCurve yCurve, valarray<valarray<Real> > callputprices, valarray<valarray<bool> > iscallputprices);
00054   
00061   volsurface(Real stockPrice, Date today, yieldCurve yCurve, volsurfaceparams &params);
00062   
00066   volsurface(valarray<valarray<Real> > volsurf);
00067   
00068   
00070   volsurface(Real constantvol);
00071 
00073   volsurface(void);
00074 
00076   ~volsurface(void);
00077   
00078   Real invertBSformula(Real r, Real maturity, Real stockPrice, Real strike, Real callputPrice, bool isacall);
00079   Real volatility(Real K, Date T);
00080   Real variance(Real K, Date T);
00081   Real forwardVolatility(Real K, Date t, Date T);
00082   void setvolsurface();
00083   valarray<valarray<Real> > getvolsurface();
00084 
00085 
00087   volsurface forwardvolsurface(Date t);
00088 
00090   volsurface shiftedYCvolsurface(Real shift);
00091 
00093   volsurface shiftedvolsurface(Real shift);
00094 };
00095 #endif
00096 

Note: Generated nightly - reload for latest version
Generated on Thu Dec 22 23:12:37 2005 for terreneuve by doxygen 1.3.6