// Handle<YieldTermStructure> discountCurve = Handle<YieldTermStructure>()); public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index, Handle <YieldTermStructure> discountCurve) : base(index.dayCounter(), index.fixingCalendar(), index.businessDayConvention(), index.fixingDays(), new Payoff(), valueDate, maturityDate, discountCurve) { fraType_ = type; notionalAmount_ = notionalAmount; index_ = index; if (notionalAmount <= 0.0) { throw new ApplicationException("notional Amount must be positive"); } // do I adjust this ? // valueDate_ = calendar_.adjust(valueDate_,businessDayConvention_); Date fixingDate = calendar_.advance(valueDate_, -settlementDays_, TimeUnit.Days); forwardRate_ = new InterestRate(index.fixing(fixingDate), index.dayCounter(), Compounding.Simple, Frequency.Once); strikeForwardRate_ = new InterestRate(strikeForwardRate, index.dayCounter(), Compounding.Simple, Frequency.Once); double strike = notionalAmount_ * strikeForwardRate_.compoundFactor(valueDate_, maturityDate_); payoff_ = new ForwardTypePayoff(fraType_, strike); // incomeDiscountCurve_ is irrelevant to an FRA incomeDiscountCurve_ = discountCurve_; // income is irrelevant to FRA - set it to zero underlyingIncome_ = 0.0; index_.registerWith(update); }
protected override void performCalculations() { if (discountCurve_.empty()) { throw new ApplicationException("no discounting term structure set to Forward"); } ForwardTypePayoff ftpayoff = payoff_ as ForwardTypePayoff; double fwdValue = forwardValue(); NPV_ = ftpayoff.value(fwdValue) * discountCurve_.link.discount(maturityDate_); }
// Handle<YieldTermStructure> discountCurve = Handle<YieldTermStructure>()); public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate, double notionalAmount, IborIndex index, Handle<YieldTermStructure> discountCurve) : base(index.dayCounter(), index.fixingCalendar(), index.businessDayConvention(), index.fixingDays(), new Payoff(), valueDate, maturityDate, discountCurve) { fraType_ = type; notionalAmount_ = notionalAmount; index_ = index; if (notionalAmount <= 0.0) throw new ApplicationException("notional Amount must be positive"); // do I adjust this ? // valueDate_ = calendar_.adjust(valueDate_,businessDayConvention_); Date fixingDate = calendar_.advance(valueDate_, -settlementDays_, TimeUnit.Days); forwardRate_ = new InterestRate(index.fixing(fixingDate), index.dayCounter(), Compounding.Simple, Frequency.Once); strikeForwardRate_ = new InterestRate(strikeForwardRate, index.dayCounter(), Compounding.Simple, Frequency.Once); double strike = notionalAmount_ * strikeForwardRate_.compoundFactor(valueDate_, maturityDate_); payoff_ = new ForwardTypePayoff(fraType_, strike); // incomeDiscountCurve_ is irrelevant to an FRA incomeDiscountCurve_ = discountCurve_; // income is irrelevant to FRA - set it to zero underlyingIncome_ = 0.0; index_.registerWith(update); }