shared_ptr<SwapIndex> SwapIndex::clone(const Handle<YieldTermStructure>& forwarding) const { if (exogenousDiscount_) return shared_ptr<SwapIndex>(new SwapIndex(familyName(), tenor(), fixingDays(), currency(), fixingCalendar(), fixedLegTenor(), fixedLegConvention(), dayCounter(), iborIndex_->clone(forwarding), discount_)); else return shared_ptr<SwapIndex>(new SwapIndex(familyName(), tenor(), fixingDays(), currency(), fixingCalendar(), fixedLegTenor(), fixedLegConvention(), dayCounter(), iborIndex_->clone(forwarding))); }
ext::shared_ptr<IborIndex> Libor::clone( const Handle<YieldTermStructure>& h) const { return ext::shared_ptr<IborIndex>(new Libor(familyName(), tenor(), fixingDays(), currency(), financialCenterCalendar_, dayCounter(), h)); }
boost::shared_ptr<IborIndex> IborIndex::clone( const Handle<YieldTermStructure>& h) const { return boost::shared_ptr<IborIndex>( new IborIndex(familyName(), tenor(), fixingDays(), currency(), fixingCalendar(), businessDayConvention(), endOfMonth(), dayCounter(), h)); }
boost::shared_ptr<SmileSection> Gaussian1dSwaptionVolatility::smileSectionImpl(Time optionTime, Time swapLength) const { DateHelper hlp(*this, optionTime); NewtonSafe newton; Date d(static_cast<BigInteger>(newton.solve( hlp, 0.1, 365.25 * optionTime + static_cast<Real>(referenceDate().serialNumber()), 1.0))); Period tenor( static_cast<Integer>(Rounding(0).operator()(swapLength * 12.0)), Months); d = indexBase_->fixingCalendar().adjust(d); return smileSectionImpl(d, tenor); }
boost::shared_ptr<SmileSection> SingleSabrSwaptionVolatility::smileSectionImpl(Time optionTime, Time swapLength) const { std::vector<Real> params(4); params[0] = alpha_; params[1] = beta_; params[2] = nu_; params[3] = rho_; DateHelper hlp(*this,optionTime); NewtonSafe newton; Date d(static_cast<BigInteger>(newton.solve( hlp, 0.1, 365.25 * optionTime + static_cast<Real>(referenceDate().serialNumber()), 1.0))); Period tenor(static_cast<Integer>(Rounding(0).operator()(swapLength*12.0)), Months); d = indexBase_->fixingCalendar().adjust(d); Real forward = indexBase_->clone(tenor)->fixing(d); boost::shared_ptr<SmileSection> raw(new SabrSmileSection(optionTime,forward,params,shift_)); // make it arbitrage free //boost::shared_ptr<SmileSection> af(new KahaleSmileSection(raw)); //return af; return raw; }
boost::shared_ptr<IborIndex> Shibor::clone( const Handle<YieldTermStructure>& h) const { return boost::shared_ptr<IborIndex>(new Shibor(tenor(), h)); }