Ejemplo n.º 1
0
void BondCurveBuilder::buildSection(DiscountCurve* dc) {
    point lineStartPoint(_curveStartDate,1);
    _curvePointer = lineStartPoint;
    map<long,Bond> rateMap = RecordHelper::getInstance()->getBondRateMap()->at(_market.getCurrencyEnum());
    for (map<long,Bond>::iterator it=rateMap.begin(); it != rateMap.end(); it++ ) {
        Bond bond = (*it).second;
        int numOfNights = (int) (*it).first;
        if (bond.getIsGeneric()==false)
            continue;

        vector<cashflow> couponLeg = bond.getCouponLeg()->getCashFlowVector();
        date lastPaymentDate = couponLeg[couponLeg.size()-1].getPaymentDate();
        BondRateBootStrapper bondBS(_curvePointer, lastPaymentDate, bond, dc, _interpolAlgo, _numericalAlgo, _market);
        bondBS.init(Configuration::getInstance());
        AbstractInterpolator<date>* lineSection = bondBS.bootStrap();
        dc->insertLineSection(lineSection);
        _curvePointer = lineSection->getEndPoint();
    }
}