Exemple #1
0
const Real Gaussian1dModel::swapAnnuity(const Date &fixing, const Period &tenor,
                                        const Date &referenceDate, const Real y,
                                        boost::shared_ptr<SwapIndex> swapIdx) const {

    QL_REQUIRE(swapIdx != NULL, "no swap index given");

    calculate();

    Handle<YieldTermStructure> ytsd =
        swapIdx->discountingTermStructure(); // might be empty, then use
    // model curve

    boost::shared_ptr<VanillaSwap> underlying =
        underlyingSwap(swapIdx, fixing, tenor);

    Schedule sched = underlying->fixedSchedule();

    Real annuity = 0.0;
    for (unsigned int j = 1; j < sched.size(); j++) {
        annuity += zerobond(sched.calendar().adjust(
                                sched.date(j), underlying->paymentConvention()),
                            referenceDate, y, ytsd) *
                   swapIdx->dayCounter().yearFraction(sched.date(j - 1),
                           sched.date(j));
    }
    return annuity;
}
void ScheduleDialog::setSchedule( const Schedule & schedule )
{
	mSchedule = schedule;
	setWindowTitle( "Modify Schedule..." );
	mDateEndEdit->setEnabled( false );
	setDateRange( schedule.date(), schedule.date() );
//	setAssetType( schedule.assetType() );
	setElement( schedule.element(), schedule.assetType() );
	setEmployee( schedule.user() );
	mHoursSpin->setValue( schedule.duration().hours() );
}