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

mainoptionstrategy.cpp

Go to the documentation of this file.
00001 #include "../PartA/BlackScholes/OptionStrategy.h"
00002 #include "../PartA/BlackScholes/BlackScholes.h"
00003 #include <iostream>
00004 
00005 bool mainoption(void) {
00006         //Test Black Scholes 
00007         double spot=100,strike=110,vol=0.2,mat=1.,rate=0.02;
00008         LongNatural nPaths=1000000,nDates=1;
00009         BlackScholes BS=BlackScholes(spot,vol,true,rate,strike,mat,Call);
00010         cout<<"B-S price"<<endl;
00011         cout<<BS.getPrice()<<endl;
00012         cout<<"B-S delta"<<endl;
00013         cout<<BS.getDelta()<<endl;
00014         cout<<"B-S gamma"<<endl;
00015         cout<<BS.getGamma()<<endl;
00016         cout<<"B-S vega"<<endl;
00017         cout<<BS.getVega()<<endl;
00018         cout<<"B-S theta"<<endl;
00019         cout<<BS.getTheta()<<endl;
00020         cout<<"B-S rho"<<endl;
00021         cout<<BS.getRho()<<endl;
00022         cout<<"B-S vol"<<endl;
00023         cout<<BS.getVolatility()<<endl;
00024 }
00025 
00026 bool mainoptionstrategy(void) {
00027         //Test Option-Strategy
00028         double spot=100,strike1=90,strike2=110,vol1=0.2,vol2=0.22,vol3=0.21,mat=1.,rate=0.02;
00029         OptionStrategy Strategy=OptionStrategy();
00030         Strategy.addLongButterflySpread(spot,vol1,true,vol2,true,vol3,true,rate,strike1,strike2,mat,10);
00031         cout<<"Price of Butterfly"<<endl;
00032         cout<<Strategy.returnPrice()<<endl;
00033         cout<<"Delta of Butterfly"<<endl;
00034         cout<<Strategy.getGlobalDelta()<<endl;
00035         return false;
00036 }

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