test.allopt.cpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 #include <iostream>
00006 #include <iomanip>
00007 #include "binomial.h"
00008 #include "american_option_approximation.h"
00009 #include "americanfudge.h"
00010 #include "simpleoption.h"
00011 
00012 using namespace std;
00013 
00014 #define ALPHA 0.05
00015 #define R 0.05
00016 
00017 int main() {
00018   double K;
00019   european_option_pair
00020     eop( 100.0,
00021          100.0,
00022          1.0,
00023          ALPHA,
00024          R,
00025          .2);
00026 
00027   american_option_fudge
00028     aof( 100.0,
00029          120.0,
00030          1.0,
00031          ALPHA,
00032          R,
00033          .20);
00034 
00035   american_option_approximation
00036     aoa( 100.0,
00037          100.0,
00038          1.0,
00039          ALPHA,
00040          R,
00041          .20);
00042 
00043   binomial_option bo( 
00044          100.0,
00045          100.0,
00046          1.0,
00047          ALPHA,
00048          R,
00049          .2,
00050          100);
00051 
00052   cout << setiosflags (ios::showpoint | ios::fixed) << setprecision(2);
00053 
00054   cout << "############################## PRICES OF PUTS ###############################" << endl;
00055   for (K=90;K<120;K+=.25) {
00056     eop.put_K( K);
00057     aof.put_K( K);
00058     aoa.put_K( K);
00059     bo.put_K( K);
00060 
00061     cout << K << " " << eop.get_P() << " " << aof.get_P() << " " << aoa.get_P() << " " <<  bo.get_P() << endl;
00062   }
00063 
00064   cout << "############################## PRICES OF CALLS ###############################" << endl;
00065   for (K=90;K<120;K+=.25) {
00066     eop.put_K( K);
00067     aof.put_K( K);
00068     aoa.put_K( K);
00069     bo.put_K( K);
00070 
00071     cout << K << " " << eop.get_C() << " " << aof.get_C() << " " << aoa.get_C() << " " <<  bo.get_C() << endl;
00072   }
00073   
00074   return 0;
00075 }
00076     

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