Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

LiborMarketModel.h

Go to the documentation of this file.
00001 /* WARANTY NOTICE AND COPYRIGHT
00002 This program is free software; you can redistribute it and/or
00003 modify it under the terms of the GNU General Public License
00004 as published by the Free Software Foundation; either version 2
00005 of the License, or (at your option) any later version.
00006 
00007 This program is distributed in the hope that it will be useful,
00008 but WITHOUT ANY WARRANTY; without even the implied warranty of
00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010 GNU General Public License for more details.
00011 
00012 You should have received a copy of the GNU General Public License
00013 along with this program; if not, write to the Free Software
00014 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00015 
00016 Copyright (C) Michael J. Meyer
00017 
00018 matmjm@mindspring.com
00019 spyqqqdia@yahoo.com
00020 
00021 */
00022 
00023 
00024 /*
00025  * LiborMarketModel.h
00026  *
00027  * Created on April 11, 2003, 12;45 AM
00028  */
00029 
00030 #ifndef martingale_libormarketmodel_h    
00031 #define martingale_libormarketmodel_h
00032 
00033 #include "TypedefsMacros.h"
00034 #include "Utils.h"
00035 #include "Matrix.h"                // problem with typedefs in forward declarations
00036 
00037 MTGL_BEGIN_NAMESPACE(Martingale)
00038 
00039 
00040 
00047 // dependencies
00048 struct LiborFactorLoadingType;
00049 class LiborFactorLoading;
00050 class Bond;  // defined below
00051 // class RealArray1D;
00052 
00053 
00054 
00055 /*******************************************************************************
00056  *
00057  *                     LiborMarektModelType
00058  * 
00059  ******************************************************************************/
00060  
00065  struct LiborMarketModelType{
00066           
00070           static const int DL=0, LFDL=1, PC=2, FPC=3;
00071          
00073           const LiborFactorLoadingType* flType;
00074          
00076           const int type;
00077                  
00081           LiborMarketModelType(const LiborFactorLoadingType* lflType, int lmmType) :
00082           flType(lflType), type(lmmType)  {    }                                                                         
00083           
00084           std::ostream& printSelf(std::ostream&) const;
00085 };
00086 
00087 
00088 
00089 
00090 
00091 /*******************************************************************************
00092  *
00093  *                    LIBOR MARKET MODEL
00094  *
00095  ******************************************************************************/
00096 
00119 class LiborMarketModel {
00120         
00121 protected:
00122         
00123         LiborMarketModelType type;
00124     
00125         // initialized from the factorloading
00126     int n;                            // number of forward Libors
00127     RealArray1D delta;                // delta[t]=T_{t+1}-T_t,length of compounding intervals
00128     RealArray1D T;                    // tenor structure, Tc[t]=T_t
00129     RealArray1D l;                    // initial Libors, l[j]=L_j(0)
00130     RealArray1D x;                    // initial X-Libors x[j]=X_j(0)=delta_jL_j(0)
00131     
00132     // volatility and correlation structure
00133     LiborFactorLoading* factorLoading;
00134         
00135 
00136 public:
00137         
00144         static const int DL=0, LFDL=1, PC=2, FPC=3;
00145         
00148         const LiborMarketModelType* getType() const { return &type; }
00149         
00152         static std::string lmmType(int type);
00153         
00156     int getDimension() const { return n; }
00157     
00160     const RealArray1D& getTenorStructure() const { return T; }
00161     
00162     
00165     const RealArray1D& getDeltas() const { return delta; }
00166     
00169     const RealArray1D& getInitialLibors() const { return l; }
00170     
00171     
00174     const RealArray1D& getInitialXLibors() const { return x; }
00175     
00176     
00179     LiborFactorLoading* getFactorLoading() const { return factorLoading; }
00180         
00181                 
00185     virtual void switchToQMC() const {  }
00186         
00187         
00191     virtual void switchToMC() const {  }
00192         
00193         
00197     virtual void restartSobolGenerator() const {  }
00198 
00199 
00200 
00201 // INTITIAL LIBORS
00202         
00204    Real L_i0(int i) const { return l[i]; }
00205    
00207    Real X_i0(int i) const { return x[i]; }
00208 
00209 
00210    
00211 // CONSTRUCTION
00212 
00213     
00220     LiborMarketModel(LiborFactorLoading* fl, int lmmType=DL);
00221     virtual ~LiborMarketModel(){ }
00222    
00223    
00231         static LiborMarketModel* sample(int n, int lmmType, int volType, int corrType);
00232  
00233     
00234 
00235 // ABSTRACT METHODS
00236                 
00237         
00240      virtual Real XL(int j, int t) const = 0;
00241 
00242 
00245      virtual const RealVector& XLvect(int t, int p) = 0;
00246          
00247 
00248 // PATH COMPUTATION
00249 
00257      virtual void newWienerIncrements(int t){   }
00258 
00262          virtual void timeStep(int t, int p) = 0;
00263          
00264          
00268          virtual void newPath();
00269  
00270      
00280      virtual void newPath(int t, int p);
00281          
00282          
00283                 
00295          virtual int effectiveDimension(int t, int s) const { return 0; }
00296          
00297          
00301          virtual void printWienerIncrements(int s, int t) const { }
00302 
00303 
00304      
00305      
00306 //  LIBOR VOLATILITIES
00307      
00308 
00313      Real vol(int i) const;
00314          
00315      
00316 
00317 
00318         
00319 // FORWARD TRANSPORTING FACTORS
00320          
00321          
00323          Real L(int j, int t) const;
00324          
00325          
00329      virtual Real H0() const;
00330          
00331          
00332                  
00336      virtual Real H_i0(int i) const;
00337      
00338 
00348      virtual Real H_it(int i, int t);
00349          
00350 
00351      
00358      virtual Real H_ii(int t);
00359 
00360  
00361          
00362               
00363 // ZERO COUPON BONDS 
00364 
00365 
00370      virtual Real B0(int i) const;
00371  
00379     virtual Real B(int i, int t);
00380         
00381 
00382      
00383 
00384          
00385 // FORWARD SWAP RATES                      
00386              
00387 
00398      virtual Real swRate(int p, int q, int t);
00399      
00400      
00407      virtual Real swapRate(int p, int q, int t);
00408 
00409 
00415      virtual Real swapRate(int p, int q) const;
00416  
00417          
00418          
00419 // ANNUITY NUMERAIRE
00420                   
00421      
00432      virtual Real b_pq(int p, int q, int t);
00433      
00434      
00441          virtual Real B_pq(int p, int q, int t);
00442 
00443      
00449      virtual Real B_pq(int p, int q) const;
00450          
00451          
00452          
00459          virtual Real H_pq(int p, int q, int t);
00460 
00461      
00467      virtual Real H_pq(int p, int q) const;
00468 
00469 
00470 
00471          
00472 // SWAPTION AND CAPLET AGGREGATE VOLATILITIES (SIGMA)
00473          
00480      virtual Real capletAggregateVolatility(int i) const;
00481          
00482          
00492      virtual Real swaptionAggregateVolatility(int p, int q, int t) const;
00493 
00494      
00504          virtual Real bondAggregateVolatility(Bond* B, int t) const;
00505          
00506          
00507 
00508 // STRING MESSAGE        
00509             
00511    virtual std::ostream& printSelf(std::ostream& os) const = 0;
00512     
00513 
00514 
00515 }; // end LiborMarketModel
00516 
00517 
00518 
00519 
00520 MTGL_END_NAMESPACE(Martingale)  
00521 
00522 #endif
00523 
00524 

Generated on Mon Sep 22 02:16:32 2003 for Libor-Library by doxygen1.3-rc3