DailyTenorJPYLibor(Natural settlementDays, const Handle<YieldTermStructure>& h = Handle<YieldTermStructure>()) : DailyTenorLibor("JPYLibor", settlementDays, JPYCurrency(), Japan(), Actual360(), h) {}
JPYLibor(const Period& tenor, const Handle<YieldTermStructure>& h = Handle<YieldTermStructure>()) : Libor("JPYLibor", tenor, 2, JPYCurrency(), Japan(), Actual360(), h) {}
JpyLiborSwapIsdaFixPm::JpyLiborSwapIsdaFixPm( const Period& tenor, const Handle<YieldTermStructure>& h) : SwapIndex("JpyLiborSwapIsdaFixPm", // familyName tenor, 2, // settlementDays JPYCurrency(), TARGET(), 6*Months, // fixedLegTenor ModifiedFollowing, // fixedLegConvention ActualActual(ActualActual::ISDA), // fixedLegDaycounter boost::shared_ptr<IborIndex>(new JPYLibor(6*Months, h))) {}
MakeVanillaSwap::operator ext::shared_ptr<VanillaSwap>() const { Date startDate; if (effectiveDate_ != Date()) startDate = effectiveDate_; else { Date refDate = Settings::instance().evaluationDate(); // if the evaluation date is not a business day // then move to the next business day refDate = floatCalendar_.adjust(refDate); Date spotDate = floatCalendar_.advance(refDate, settlementDays_*Days); startDate = spotDate+forwardStart_; if (forwardStart_.length()<0) startDate = floatCalendar_.adjust(startDate, Preceding); else startDate = floatCalendar_.adjust(startDate, Following); } Date endDate = terminationDate_; if (endDate == Date()) { if (floatEndOfMonth_) endDate = floatCalendar_.advance(startDate, swapTenor_, ModifiedFollowing, floatEndOfMonth_); else endDate = startDate + swapTenor_; } const Currency& curr = iborIndex_->currency(); Period fixedTenor; if (fixedTenor_ != Period()) fixedTenor = fixedTenor_; else { if ((curr == EURCurrency()) || (curr == USDCurrency()) || (curr == CHFCurrency()) || (curr == SEKCurrency()) || (curr == GBPCurrency() && swapTenor_ <= 1 * Years)) fixedTenor = Period(1, Years); else if ((curr == GBPCurrency() && swapTenor_ > 1 * Years) || (curr == JPYCurrency()) || (curr == AUDCurrency() && swapTenor_ >= 4 * Years)) fixedTenor = Period(6, Months); else if ((curr == HKDCurrency() || (curr == AUDCurrency() && swapTenor_ < 4 * Years))) fixedTenor = Period(3, Months); else QL_FAIL("unknown fixed leg default tenor for " << curr); } Schedule fixedSchedule(startDate, endDate, fixedTenor, fixedCalendar_, fixedConvention_, fixedTerminationDateConvention_, fixedRule_, fixedEndOfMonth_, fixedFirstDate_, fixedNextToLastDate_); Schedule floatSchedule(startDate, endDate, floatTenor_, floatCalendar_, floatConvention_, floatTerminationDateConvention_, floatRule_, floatEndOfMonth_, floatFirstDate_, floatNextToLastDate_); DayCounter fixedDayCount; if (fixedDayCount_ != DayCounter()) fixedDayCount = fixedDayCount_; else { if (curr == USDCurrency()) fixedDayCount = Actual360(); else if (curr == EURCurrency() || curr == CHFCurrency() || curr == SEKCurrency()) fixedDayCount = Thirty360(Thirty360::BondBasis); else if (curr == GBPCurrency() || curr == JPYCurrency() || curr == AUDCurrency() || curr == HKDCurrency()) fixedDayCount = Actual365Fixed(); else QL_FAIL("unknown fixed leg day counter for " << curr); } Rate usedFixedRate = fixedRate_; if (fixedRate_ == Null<Rate>()) { VanillaSwap temp(type_, nominal_, fixedSchedule, 0.0, // fixed rate fixedDayCount, floatSchedule, iborIndex_, floatSpread_, floatDayCount_); if (engine_ == 0) { Handle<YieldTermStructure> disc = iborIndex_->forwardingTermStructure(); QL_REQUIRE(!disc.empty(), "null term structure set to this instance of " << iborIndex_->name()); bool includeSettlementDateFlows = false; ext::shared_ptr<PricingEngine> engine(new DiscountingSwapEngine(disc, includeSettlementDateFlows)); temp.setPricingEngine(engine); } else temp.setPricingEngine(engine_); usedFixedRate = temp.fairRate(); } ext::shared_ptr<VanillaSwap> swap(new VanillaSwap(type_, nominal_, fixedSchedule, usedFixedRate, fixedDayCount, floatSchedule, iborIndex_, floatSpread_, floatDayCount_)); if (engine_ == 0) { Handle<YieldTermStructure> disc = iborIndex_->forwardingTermStructure(); bool includeSettlementDateFlows = false; ext::shared_ptr<PricingEngine> engine(new DiscountingSwapEngine(disc, includeSettlementDateFlows)); swap->setPricingEngine(engine); } else swap->setPricingEngine(engine_); return swap; }