spread() публичный Метод

spread paid over the fixing of the underlying index
public spread ( ) : double
Результат double
Пример #1
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            YoYInflationCapFloor.Arguments arguments = args as YoYInflationCapFloor.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong argument type");

            int n = yoyLeg_.Count;

            arguments.startDates   = new List <Date>(n);
            arguments.fixingDates  = new List <Date>(n);
            arguments.payDates     = new List <Date>(n);
            arguments.accrualTimes = new List <double>(n);
            arguments.nominals     = new List <double>(n);
            arguments.gearings     = new List <double>(n);
            arguments.capRates     = new List <double?>(n);
            arguments.floorRates   = new List <double?>(n);
            arguments.spreads      = new List <double>(n);

            arguments.type = type_;

            for (int i = 0; i < n; ++i)
            {
                YoYInflationCoupon coupon = yoyLeg_[i] as YoYInflationCoupon;
                Utils.QL_REQUIRE(coupon != null, () => "non-YoYInflationCoupon given");
                arguments.startDates.Add(coupon.accrualStartDate());
                arguments.fixingDates.Add(coupon.fixingDate());
                arguments.payDates.Add(coupon.date());

                // this is passed explicitly for precision
                arguments.accrualTimes.Add(coupon.accrualPeriod());

                arguments.nominals.Add(coupon.nominal());
                double spread  = coupon.spread();
                double gearing = coupon.gearing();
                arguments.gearings.Add(gearing);
                arguments.spreads.Add(spread);

                if (type_ == CapFloorType.Cap || type_ == CapFloorType.Collar)
                {
                    arguments.capRates.Add((capRates_[i] - spread) / gearing);
                }
                else
                {
                    arguments.capRates.Add(null);
                }

                if (type_ == CapFloorType.Floor || type_ == CapFloorType.Collar)
                {
                    arguments.floorRates.Add((floorRates_[i] - spread) / gearing);
                }
                else
                {
                    arguments.floorRates.Add(null);
                }
            }
        }
Пример #2
0
        // other
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            YearOnYearInflationSwap.Arguments arguments = args as YearOnYearInflationSwap.Arguments;

            if (arguments == null) // it's a swap engine...
            {
                return;
            }

            arguments.type    = type_;
            arguments.nominal = nominal_;

            List <CashFlow> fixedCoupons = fixedLeg();

            arguments.fixedResetDates = arguments.fixedPayDates = new List <Date>(fixedCoupons.Count);
            arguments.fixedCoupons    = new List <double>(fixedCoupons.Count);

            for (int i = 0; i < fixedCoupons.Count; ++i)
            {
                FixedRateCoupon coupon = fixedCoupons[i] as FixedRateCoupon;

                arguments.fixedPayDates.Add(coupon.date());
                arguments.fixedResetDates.Add(coupon.accrualStartDate());
                arguments.fixedCoupons.Add(coupon.amount());
            }

            List <CashFlow> yoyCoupons = yoyLeg();

            arguments.yoyResetDates   = arguments.yoyPayDates = arguments.yoyFixingDates = new List <Date>(yoyCoupons.Count);
            arguments.yoyAccrualTimes = new List <double>(yoyCoupons.Count);
            arguments.yoySpreads      = new List <double>(yoyCoupons.Count);
            arguments.yoyCoupons      = new List <double?>(yoyCoupons.Count);
            for (int i = 0; i < yoyCoupons.Count; ++i)
            {
                YoYInflationCoupon coupon = yoyCoupons[i] as YoYInflationCoupon;

                arguments.yoyResetDates.Add(coupon.accrualStartDate());
                arguments.yoyPayDates.Add(coupon.date());

                arguments.yoyFixingDates.Add(coupon.fixingDate());
                arguments.yoyAccrualTimes.Add(coupon.accrualPeriod());
                arguments.yoySpreads.Add(coupon.spread());
                try
                {
                    arguments.yoyCoupons.Add(coupon.amount());
                }
                catch (Exception)
                {
                    arguments.yoyCoupons.Add(null);
                }
            }
        }
Пример #3
0
        public override void initialize(InflationCoupon coupon)
        {
            coupon_ = coupon as YoYInflationCoupon;
            gearing_ = coupon_.gearing();
            spread_ = coupon_.spread();
            PaymentDate = coupon_.Date;
            YoYInflationIndex y = (YoYInflationIndex)(coupon.index());
            RateCurve = y.yoyInflationTermStructure().link.nominalTermStructure();

            // past or future fixing is managed in YoYInflationIndex::fixing()
            // use yield curve from index (which sets discount)

            discount_ = 1.0;
            if (PaymentDate > RateCurve.link.referenceDate())
                discount_ = RateCurve.link.discount(PaymentDate);

            spreadLegValue_ = spread_ * coupon_.accrualPeriod() * discount_;
        }
Пример #4
0
        // we may watch an underlying coupon ...
        public CappedFlooredYoYInflationCoupon(YoYInflationCoupon underlying,
                                               double?cap   = null,
                                               double?floor = null)
            : base(underlying.date(),
                   underlying.nominal(),
                   underlying.accrualStartDate(),
                   underlying.accrualEndDate(),
                   underlying.fixingDays(),
                   underlying.yoyIndex(),
                   underlying.observationLag(),
                   underlying.dayCounter(),
                   underlying.gearing(),
                   underlying.spread(),
                   underlying.referencePeriodStart,
                   underlying.referencePeriodEnd)

        {
            underlying_ = underlying;
            isFloored_  = false;
            isCapped_   = false;
            setCommon(cap, floor);
            underlying.registerWith(update);
        }
    // we may watch an underlying coupon ...
    public CappedFlooredYoYInflationCoupon(YoYInflationCoupon underlying,
                                           double? cap = null,
                                           double? floor = null)
       :base(underlying.date(),
             underlying.nominal(),
             underlying.accrualStartDate(),
             underlying.accrualEndDate(),
             underlying.fixingDays(),
             underlying.yoyIndex(),
             underlying.observationLag(),
             underlying.dayCounter(),
             underlying.gearing(),
             underlying.spread(),
             underlying.refPeriodStart,
             underlying.refPeriodEnd)
 
    {
       underlying_ = underlying;
       isFloored_ = false;
       isCapped_ = false;
       setCommon(cap, floor);
       underlying.registerWith(update);
    }
Пример #6
0
 public CappedFlooredYoYInflationCoupon(YoYInflationCoupon underlying, double?cap, double?floor)
     : this(underlying.Date, underlying.nominal(), underlying.accrualStartDate(), underlying.accrualEndDate(), underlying.fixingDays(), underlying.yoyIndex(), underlying.observationLag(), underlying.dayCounter(), underlying.gearing(), underlying.spread(), null, null, underlying.refPeriodStart, underlying.refPeriodEnd)
 {
     underlying_ = underlying;
     setCommon(cap, floor);
     underlying.registerWith(update);
 }