for (int bondIndex = 0; bondIndex < maturityDates.length; bondIndex++) {
// plain
final InterestRate yield = new InterestRate(yields[bondIndex],
new Business252(new Brazil()),
Compounding.Compounded, Frequency.Annual);
final Schedule schedule = new Schedule(new Date(1,Month.January,2007),
maturityDates[bondIndex], new Period(Frequency.Semiannual),
new Brazil(Brazil.Market.SETTLEMENT),
BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
DateGeneration.Rule.Backward, false);
// fixed coupons
final Leg cashflows =
new FixedRateLeg(schedule, new Actual360())
.withNotionals(faceAmount)
.withCouponRates(couponRates)
.withPaymentAdjustment(BusinessDayConvention.ModifiedFollowing).Leg();
// redemption
cashflows.add(new SimpleCashFlow(faceAmount, cashflows.last().date()));
final Bond bond = new Bond(settlementDays, new Brazil(Brazil.Market.SETTLEMENT),
faceAmount, cashflows.last().date(),
new Date(1,Month.January,2007), cashflows);
final double cachedPrice = prices[bondIndex];