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

mainbond.cpp

Go to the documentation of this file.
00001 #include"..\PartB\yieldCurve.h"
00002 #include"..\PartF\creditCurve.h"
00003 #include"..\PartH\bond.h"
00004 
00005 #include "..\common\filereader.h"
00006 
00007 #include<iostream>
00008 #include<valarray>
00009 
00010 using namespace std;
00011 
00012 bool mainbond(void) {
00013         yieldCurve testcurve=yieldCurve(0.05);
00014         creditCurve testcreditcurve = creditCurve(0.05, 0.02);
00015 
00016         Date issue(15,November,2005);
00017         Date maturity(15,November,2015);
00018         Date firstcoupondate(15,May,2006);
00019         Real coupon = 0.045;
00020         Frequency freq2 = Semiannual;
00021         Real faceamount = 100.0;
00022         DayCountConvention daycount = ACT_365;
00023 
00024         treasurybond testTbond(issue, maturity, firstcoupondate, coupon, freq2, faceamount, daycount, testcurve);
00025         riskybond testRbond(issue, maturity, firstcoupondate, coupon, freq2, faceamount, daycount, testcurve, testcreditcurve);
00026         
00027         cout << "characteristics of our Treasury and risky bonds"<<endl;
00028         cout << "date of issue 15 November 2005, firstcoupondate 15 May 2006, maturity 15 November 2015"<<endl;
00029         cout << "coupon = 4.5%, faceamount 100"<<endl;
00030         cout << "frequency Semiannual, daycount convention  ACT/365"<<endl;
00031         cout << "flat yield curve at 5%"<<endl;
00032         cout << endl;
00033 
00034         cout <<"*** for the treasury bond ***"<<endl;
00035         cout << "fairvalue  " << testTbond.fairvalue()  << endl;
00036         cout << "yield to maturity " << testTbond.yieldToMaturity()  << endl;
00037         cout << "convexity  " << testTbond.convexity()  << endl;
00038         cout << "duration  " << testTbond.duration()  << endl;
00039         cout << endl;
00040 
00041         cout <<"*** for the risky bond ***"<<endl;
00042         cout << "fairvalue  " << testRbond.fairvalue()  << endl;
00043         cout << "yield to maturity " << testRbond.yieldToMaturity()  << endl;
00044         cout << "convexity  " << testRbond.convexity()  << endl;
00045         cout << "duration  " << testRbond.duration()  << endl;
00046         
00047 //      Integer i;
00048 //      treasurybond testTb=testTbond;
00049 //      for(i=0;i<10;i++){
00050 //              Real shift = 0.01+0.03*i;
00051 //              testTb = testTbond.shiftedbond(shift);
00052 //              cout << "fairvalue  "  <<testTb.fairvalue(issue)  << endl;
00053 //      }
00054         return true;
00055 }

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