Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QuantLib::JointCalendar calendar = QuantLib::JointCalendar(QuantLib::UnitedStates(),QuantLib::UnitedKingdom(),
- JoinBusinessDays);
- QuantLib::DayCounter dayCounter = QuantLib::Actual360();
- QuantLib::Integer fixingDays = 1;
- QuantLib::Natural settlementDays = 3;
- QuantLib::Date tradeDate(20, QuantLib::September, 2013);
- QuantLib::Date settlementDate = calendar.advance(tradeDate, settlementDays, QuantLib::Days);
- settlementDate = calendar.adjust(settlementDate);
- QuantLib::Settings::instance().evaluationDate() = tradeDate;
- QuantLib::Date issueDate(25,QuantLib::July,2013);
- QuantLib::Period p1m = QuantLib::Period(1,QuantLib::Months);
- // Number of payments
- int num_cashflows = 120;
- QuantLib::Date maturityDate = issueDate + num_cashflows * p1m;
- QuantLib::Schedule mySchedule(issueDate,
- maturityDate,
- QuantLib::Period(QuantLib::Monthly),
- calendar,
- QuantLib::BusinessDayConvention::Unadjusted,
- QuantLib::BusinessDayConvention::ModifiedFollowing,
- QuantLib::DateGeneration::Forward,
- false);
- QuantLib::AmortizingFloatingRateBond MyFloater(settlementDays,
- Notional,
- mySchedule,
- libor,
- QuantLib::Actual360(),
- QuantLib::BusinessDayConvention::ModifiedFollowing,
- fixingDays,
- std::vector<QuantLib::Real>(1,1.0),
- std::vector<QuantLib::Spread>(1,Spread),
- std::vector<QuantLib::Rate>(),
- std::vector<QuantLib::Rate>(),
- true,
- issueDate);
- MyFloater.setPricingEngine(bondEngine);
- std::vector<QuantLib::Date> paySchedule = mySchedule.dates();
- std::vector<QuantLib::Date>::iterator pIter;
- QuantLib::Date priorDate;
- for (pIter = paySchedule.begin(); pIter != paySchedule.end() && *pIter < settlementDate; ++pIter){
- priorDate = *pIter;
- libor->addFixing(calendar.advance(priorDate, QuantLib::Period(-fixingDays,QuantLib::Days)), 0.1805/100);
- }
- boost::shared_ptr<SimpleQuote> spread(new SimpleQuote(0.0));
- boost::shared_ptr<YieldTermStructure> spreadedCurve(
- new ForwardSpreadedTermStructure(liborCurve,
- Handle<Quote>(spread)));
- libor = boost::shared_ptr<IborIndex>(
- new USDLibor(1*Months,
- Handle<YieldTermStructure>(spreadedCurve)));
- spread->setValue(0.002);
- shared_ptr<SimpleQuote> spread = make_shared<SimpleQuote>(0.0);
- shared_ptr<YieldTermStructure> spreadedCurve =
- make_shared<ForwardSpreadedTermStructure>(liborCurve,
- Handle<Quote>(spread));
- libor = make_shared<USDLibor>(1*Months,
- Handle<YieldTermStructure>(liborCurve));
- bondEngine = make_shared<DiscountingBondEngine>(
- Handle<YieldTermStructure>(spreadedCurve));
Add Comment
Please, Sign In to add comment