Dagur,
See below a code that may help you. “Period(Once)” is what you look for.
Regards,
#include "stdafx.h"
#include <ql/quantlib.hpp>
#include <iostream>
using namespace QuantLib;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Date issueDate(Date(15, Oct, 2011)), maturityDate(Date(15, Oct, 2016));
Rate rate(0.10);
DayCounter dayCounter = Thirty360(Thirty360::European);
Schedule *schedule = new Schedule(issueDate,
maturityDate,
Period(Once),
Iceland(),
Unadjusted,
Unadjusted,
DateGeneration::Backward,
false);
InterestRate coupon(0.06,
dayCounter,
Simple, Annual);
FixedRateBond* bond = new FixedRateBond(0,
100.0,
*schedule,
vector<InterestRate>(1, coupon),
Unadjusted,
Real(100.0),
issueDate);
for (unsigned i = 0; i < bond->cashflows().size(); i++) {
cout<<"day["<<i<<"] is "<<bond->cashflows()[i]->date()<<" "<<setprecision(15)
<<dayCounter.yearFraction(Date(1, Jun, 2011), bond->cashflows()[i]->date())<<", cashflow["<<i<<"] is "<<bond->cashflows()[i]->amount()<<endl;
}
return 0;
}
From: Dagur Gunnarsson [mailto:[hidden email]]
Sent: 14 January 2012 16:29
To: Luigi Ballabio
Cc: [hidden email]
Subject: Re: [Quantlib-users] Fixed rate bond
Hello,
The rate is accrued over the whole period, so in at the maturity date the bond pays a coupon for the whole livetime of the bond, and the principal.
regards
Dagur G
On Tue, Jan 10, 2012 at 8:17 AM, Luigi Ballabio <[hidden email]> wrote:
On Mon, Jan 9, 2012 at 11:59 PM, StephenWong <[hidden email]> wrote:
> Dagur Gunnarsson-2 wrote:
>> Is there a simple way to simulate a bond(fixed rate) that pays a single
>> coupon on the maturity day as well as the principal
>
> Looks like you can do this with a combination of a fixed rate bond with
> regular coupon (at least once a year), then subtract that with a series of
> fixed rate bonds with the same coupon but shorter duration + a series of
> zero coupon bonds with the same maturities as the series of fixed rate bonds
> except the original bond. The combination would be what you want.
Or you could just use a fixed rate bond with all coupons except the
last paying a null rate, or you can create a schedule with null
frequency. It depends on how the final payment accrues. Is the rate
accrued over the whole duration of the bond, or just a subperiod?
Luigi
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
| Free forum by Nabble | Edit this page |