for (i=0; i<bonds; i++) { Handle<Quote> p(prices[i]); Date maturity = calendar.advance(today, bondData[i].n, bondData[i].units); Date issue = calendar.advance(maturity, -bondData[i].length, Years); std::vector<Rate> coupons(1, bondData[i].coupon/100.0); bondHelpers[i] = boost::shared_ptr<RateHelper>( new FixedCouponBondHelper(p, issue, issue, maturity, bondSettlementDays, coupons, bondData[i].frequency, bondDayCounter, calendar, bondConvention, bondRedemption)); }
void setup() {    // data    calendar = TARGET();    settlementDays = 2;    fixingDays = 2;    today = calendar.adjust(Date::todaysDate());    Settings::instance().evaluationDate() = today;    settlement = calendar.advance(today,settlementDays,Days);    depoConvention = ModifiedFollowing;    depoDayCounter = Actual360();    fixedLegConvention = Unadjusted;    floatingLegConvention = ModifiedFollowing;    fixedLegFrequency = Annual;    fixedLegDayCounter = Thirty360();    floatingLegFrequency = Semiannual;    deposits = LENGTH(depositData);    swaps = LENGTH(swapData);    // market elements    rates = std::vector<boost::shared_ptr<SimpleQuote> >(deposits+swaps);    Size i;    for (i=0; i<deposits; i++) {        rates[i] = boost::shared_ptr<SimpleQuote>(                                    new SimpleQuote(depositData[i].rate/100));    }    for (i=0; i<swaps; i++) {        rates[i+deposits] = boost::shared_ptr<SimpleQuote>(                                       new SimpleQuote(swapData[i].rate/100));    }    // rate helpers    instruments =        std::vector<boost::shared_ptr<RateHelper> >(deposits+swaps);    for (i=0; i<deposits; i++) {        Handle<Quote> r(rates[i]);        instruments[i] = boost::shared_ptr<RateHelper>(              new DepositRateHelper(r, depositData[i].n, depositData[i].units,                                    settlementDays, calendar,                                    depoConvention, depoDayCounter));    }    for (i=0; i<swaps; i++) {        Handle<Quote> r(rates[i+deposits]);        instruments[i+deposits] = boost::shared_ptr<RateHelper>(                new SwapRateHelper(r, swapData[i].n, swapData[i].units,                                   settlementDays, calendar,                                   fixedLegFrequency, fixedLegConvention,                                   fixedLegDayCounter, floatingLegFrequency,                                   floatingLegConvention));    }}