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
00048
00049
00050
00051
00052
00053
00054 return true;
00055 }