Exemplo n.º 1
0
        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;

            Utils.QL_REQUIRE(notionalAmount > 0.0, () => "notional Amount must be positive");

            // do I adjust this ?
            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);
        }
Exemplo n.º 2
0
        protected override void performCalculations()
        {
            Utils.QL_REQUIRE(!discountCurve_.empty(), () => "no discounting term structure set to Forward");

            ForwardTypePayoff ftpayoff = payoff_ as ForwardTypePayoff;
            double            fwdValue = forwardValue();

            NPV_ = ftpayoff.value(fwdValue) * discountCurve_.link.discount(maturityDate_);
        }