public void visit(DigitalCmsCoupon c) { CmsCouponPricer cmsCouponPricer = pricer_ as CmsCouponPricer; Utils.QL_REQUIRE(cmsCouponPricer != null, () => "pricer not compatible with CMS coupon"); c.setPricer(cmsCouponPricer); }
public void visit(DigitalCmsCoupon c) { CmsCouponPricer pricer = pricer_ as CmsCouponPricer; if (pricer == null) { throw new ApplicationException("pricer not compatible with CMS coupon"); } c.setPricer(pricer); }
//public IndexHistoryCleaner indexCleaner; // initial setup public CommonVars() { backup = new SavedSettings(); //indexCleaner = new IndexHistoryCleaner(); termStructure = new RelinkableHandle<YieldTermStructure>(); int swapSettlementDays = 2; faceAmount = 100.0; BusinessDayConvention fixedConvention = BusinessDayConvention.Unadjusted; compounding = Compounding.Continuous; Frequency fixedFrequency = Frequency.Annual; Frequency floatingFrequency = Frequency.Semiannual; iborIndex = new Euribor(new Period(floatingFrequency), termStructure); Calendar calendar = iborIndex.fixingCalendar(); swapIndex= new SwapIndex("EuriborSwapIsdaFixA", new Period(10,TimeUnit.Years), swapSettlementDays, iborIndex.currency(), calendar, new Period(fixedFrequency), fixedConvention, iborIndex.dayCounter(), iborIndex); spread = 0.0; nonnullspread = 0.003; Date today = new Date(24,Month.April,2007); Settings.setEvaluationDate(today); //Date today = Settings::instance().evaluationDate(); termStructure.linkTo(Utilities.flatRate(today, 0.05, new Actual365Fixed())); pricer = new BlackIborCouponPricer(); Handle<SwaptionVolatilityStructure> swaptionVolatilityStructure = new Handle<SwaptionVolatilityStructure>(new ConstantSwaptionVolatility(today, new NullCalendar(),BusinessDayConvention.Following, 0.2, new Actual365Fixed())); Handle<Quote> meanReversionQuote = new Handle<Quote>(new SimpleQuote(0.01)); cmspricer = new AnalyticHaganPricer(swaptionVolatilityStructure, GFunctionFactory.YieldCurveModel.Standard, meanReversionQuote); }
public MakeCms withCmsCouponPricer(CmsCouponPricer couponPricer) { couponPricer_ = couponPricer; return(this); }