コード例 #1
0
ファイル: forwardrateagreement.cs プロジェクト: zhangz/QLNet
        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);
        }
コード例 #2
0
ファイル: forwardrateagreement.cs プロジェクト: zhangz/QLNet
        protected override void performCalculations()
        {
            Date fixingDate = calendar_.advance(valueDate_, -settlementDays_, TimeUnit.Days);

            forwardRate_ = new InterestRate(index_.fixing(fixingDate), index_.dayCounter(),
                                            Compounding.Simple, Frequency.Once);
            underlyingSpotValue_ = spotValue();
            underlyingIncome_    = 0.0;
            base.performCalculations();
        }