public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure) { forwardValue_ = forwardValue; expiryDate_ = expiryDate; swapTenor_ = swapTenor; volatilityStructure_ = volatilityStructure; smile_ = volatilityStructure_.smileSection(expiryDate_, swapTenor_); }
public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure) { _forwardValue = forwardValue; _expiryDate = expiryDate; _swapTenor = swapTenor; _volatilityStructure = volatilityStructure; _smile = _volatilityStructure.smileSection(_expiryDate, _swapTenor); }
public SpreadedSmileSection(SmileSection underlyingSection, Handle <Quote> spread) { underlyingSection_ = underlyingSection; spread_ = spread; underlyingSection_.registerWith(update); spread_.registerWith(update); }
public BlackVanillaOptionPricer(double forwardValue, Date expiryDate, Period swapTenor, SwaptionVolatilityStructure volatilityStructure) { forwardValue_ = forwardValue; expiryDate_ = expiryDate; swapTenor_ = swapTenor; volatilityStructure_ = volatilityStructure; smile_ = volatilityStructure_.smileSection(expiryDate_, swapTenor_); Utils.QL_REQUIRE(volatilityStructure.volatilityType() == VolatilityType.ShiftedLognormal && Utils.close_enough(volatilityStructure.shift(expiryDate, swapTenor), 0.0), () => "BlackVanillaOptionPricer: zero-shift lognormal volatility required"); }
public RangeAccrualPricerByBgm(double correlation, SmileSection smilesOnExpiry, SmileSection smilesOnPayment, bool withSmile, bool byCallSpread) { correlation_ = correlation; withSmile_ = withSmile; byCallSpread_ = byCallSpread; smilesOnExpiry_ = smilesOnExpiry; smilesOnPayment_ = smilesOnPayment; eps_ = 1.0e-8; }
protected override SmileSection smileSectionImpl(double optionTime) { SmileSection baseSmile = baseVol_.link.smileSection(optionTime, true); return(new SpreadedSmileSection(baseSmile, spread_)); }
// All virtual methods of base classes must be forwarded // OptionletVolatilityStructure interface protected override SmileSection smileSectionImpl(Date d) { SmileSection baseSmile = baseVol_.link.smileSection(d, true); return(new SpreadedSmileSection(baseSmile, spread_)); }
public override void initialize(FloatingRateCoupon coupon) { coupon_ = coupon as CmsCoupon; Utils.QL_REQUIRE(coupon_ != null, () => "CMS coupon needed"); gearing_ = coupon_.gearing(); spread_ = coupon_.spread(); fixingDate_ = coupon_.fixingDate(); paymentDate_ = coupon_.date(); swapIndex_ = coupon_.swapIndex(); forwardCurve_ = swapIndex_.forwardingTermStructure(); if (swapIndex_.exogenousDiscount()) { discountCurve_ = swapIndex_.discountingTermStructure(); } else { discountCurve_ = forwardCurve_; } // if no coupon discount curve is given just use the discounting curve // from the swap index. for rate calculation this curve cancels out in // the computation, so e.g. the discounting swap engine will produce // correct results, even if the couponDiscountCurve is not set here. // only the price member function in this class will be dependent on the // coupon discount curve. today_ = QLNet.Settings.evaluationDate(); if (paymentDate_ > today_ && !couponDiscountCurve_.empty()) { couponDiscountRatio_ = couponDiscountCurve_.link.discount(paymentDate_) / discountCurve_.link.discount(paymentDate_); } else { couponDiscountRatio_ = 1.0; } spreadLegValue_ = spread_ * coupon_.accrualPeriod() * discountCurve_.link.discount(paymentDate_) * couponDiscountRatio_; if (fixingDate_ > today_) { swapTenor_ = swapIndex_.tenor(); swap_ = swapIndex_.underlyingSwap(fixingDate_); swapRateValue_ = swap_.fairRate(); annuity_ = 1.0E4 * Math.Abs(swap_.fixedLegBPS()); SmileSection sectionTmp = swaptionVolatility().link.smileSection(fixingDate_, swapTenor_); // adjust bounds by section's shift shiftedLowerBound_ = settings_.lowerRateBound_ - sectionTmp.shift(); shiftedUpperBound_ = settings_.upperRateBound_ - sectionTmp.shift(); // if the section does not provide an atm level, we enhance it to // have one, no need to exit with an exception ... if (sectionTmp.atmLevel() == null) { smileSection_ = new AtmSmileSection(sectionTmp, swapRateValue_); } else { smileSection_ = sectionTmp; } // compute linear model's parameters double gx = 0.0, gy = 0.0; for (int i = 0; i < swap_.fixedLeg().Count; i++) { Coupon c = swap_.fixedLeg()[i] as Coupon; double yf = c.accrualPeriod(); Date d = c.date(); double pv = yf * discountCurve_.link.discount(d); gx += pv * GsrG(d); gy += pv; } double gamma = gx / gy; Date lastd = swap_.fixedLeg().Last().date(); a_ = discountCurve_.link.discount(paymentDate_) * (gamma - GsrG(paymentDate_)) / (discountCurve_.link.discount(lastd) * GsrG(lastd) + swapRateValue_ * gy * gamma); b_ = discountCurve_.link.discount(paymentDate_) / gy - a_ * swapRateValue_; } }
public PriceHelper(SmileSection section, Option.Type type, double targetPrice) { section_ = section; targetPrice_ = targetPrice; type_ = type; }
public VegaRatioHelper(SmileSection section, double targetVega) { section_ = section; targetVega_ = targetVega; }