// constructors public FloatingRateCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, InterestRateIndex index, double gearing = 1.0, double spread = 0.0, Date refPeriodStart = null, Date refPeriodEnd = null, DayCounter dayCounter = null, bool isInArrears = false) : base(paymentDate, nominal, startDate, endDate, refPeriodStart, refPeriodEnd) { index_ = index; dayCounter_ = dayCounter ?? new DayCounter(); fixingDays_ = fixingDays == default(int) ? index.fixingDays() : fixingDays; gearing_ = gearing; spread_ = spread; isInArrears_ = isInArrears; if (gearing_.IsEqual(0)) { throw new ArgumentException("Null gearing not allowed"); } if (dayCounter_.empty()) { dayCounter_ = index_.dayCounter(); } // add as observer index_.registerWith(update); Settings.registerWith(update); }
// constructors public FloatingRateCoupon(double nominal, Date paymentDate, Date startDate, Date endDate, int fixingDays, InterestRateIndex index, double gearing = 1.0, double spread = 0.0, Date refPeriodStart = null, Date refPeriodEnd = null, DayCounter dayCounter = null, bool isInArrears = false) : base(nominal, paymentDate, startDate, endDate, refPeriodStart, refPeriodEnd) { index_ = index; dayCounter_ = dayCounter == null ? new DayCounter() : dayCounter ; fixingDays_ = fixingDays == default(int) ? index.fixingDays() : fixingDays; gearing_ = gearing; spread_ = spread; isInArrears_ = isInArrears; if (gearing_ == 0) throw new ArgumentException("Null gearing not allowed"); if (dayCounter_.empty()) dayCounter_ = index_.dayCounter(); // add as observer index_.registerWith(update); Settings.registerWith(update); }