test.allvol.cpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #include <iostream>
00010 #include <iomanip>
00011 #include "binomial.h"
00012 #include "american_option_approximation.h"
00013 #include "americanfudge.h"
00014 #include "simpleoption.h"
00015 
00016 using namespace std;
00017 /*
00018 #define ALPHA 0
00019 #define R     0.05
00020 #define S     424     
00021 #define K     320
00022 #define Tau   (145.0/365)
00023 #define CallPrice 104.25
00024 
00025 #define ALPHA 0
00026 #define R     0.05
00027 #define S     424    
00028 #define K     470
00029 #define Tau   (145.0/365)
00030 #define CallPrice 21
00031 
00032 #define ALPHA  0
00033 #define R     0.05
00034 #define S     424    
00035 #define K     480
00036 #define Tau   (145.0/365)
00037 #define CallPrice 18.5
00038 */
00039 
00040 #define ALPHA     0
00041 #define R         0.05
00042 #define S         424    
00043 #define K         340
00044 #define Tau       (145.0/365)
00045 #define CallPrice 85.75
00046 
00047 int main() {
00048 
00049   european_option_pair
00050     eop( S,
00051          K,
00052          Tau,
00053          ALPHA,
00054          R,
00055          .2);
00056 
00057   cerr << "european call implied volatility = " << eop.call_implied_sigma( CallPrice) << endl;
00058 
00059   american_option_fudge
00060     aof( S,
00061          K,
00062          Tau,
00063          ALPHA,
00064          R,
00065          .20);
00066 
00067   cerr << "american_option_fudge call implied volatility = " << aof.call_implied_sigma( CallPrice) << endl;
00068 
00069   american_option_approximation
00070     aoa( S,
00071          K,
00072          Tau,
00073          ALPHA,
00074          R,
00075          .20);
00076 
00077   cerr << "american_option_approximation call implied volatility = " << aoa.call_implied_sigma( CallPrice) << endl;
00078 
00079   
00080   binomial_option bo( 
00081          S,
00082          K,
00083          Tau,
00084          ALPHA,
00085          R,
00086          .2,
00087          20);
00088 
00089   cerr << "binomial_option call implied volatility = " << bo.call_implied_sigma( CallPrice) << endl;
00090   
00091 
00092   return 0;
00093 }
00094     

Generated on Fri Jan 7 12:36:18 2011 for public_options by  doxygen 1.5.1