Пример #1
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);
            CallableBond.Arguments arguments = args as CallableBond.Arguments;

            Utils.QL_REQUIRE(arguments != null, () => "no arguments given");

            Date settlement = arguments.settlementDate;

            arguments.redemption     = redemption().amount();
            arguments.redemptionDate = redemption().date();

            List <CashFlow> cfs = cashflows();

            arguments.couponDates = new List <Date>(cfs.Count - 1);
            //arguments.couponDates.Capacity = ;
            arguments.couponAmounts = new List <double>(cfs.Count - 1);
            //arguments.couponAmounts.Capacity = cfs.Count - 1;

            for (int i = 0; i < cfs.Count; i++)
            {
                if (!cfs[i].hasOccurred(settlement, false))
                {
                    if (cfs[i] is QLNet.FixedRateCoupon)
                    {
                        arguments.couponDates.Add(cfs[i].date());
                        arguments.couponAmounts.Add(cfs[i].amount());
                    }
                }
            }

            arguments.callabilityPrices = new List <double>(putCallSchedule_.Count);
            arguments.callabilityDates  = new List <Date>(putCallSchedule_.Count);
            //arguments.callabilityPrices.Capacity = putCallSchedule_.Count;
            //arguments.callabilityDates.Capacity = putCallSchedule_.Count;

            arguments.paymentDayCounter = paymentDayCounter_;
            arguments.frequency         = frequency_;

            arguments.putCallSchedule = putCallSchedule_;
            for (int i = 0; i < putCallSchedule_.Count; i++)
            {
                if (!putCallSchedule_[i].hasOccurred(settlement, false))
                {
                    arguments.callabilityDates.Add(putCallSchedule_[i].date());
                    arguments.callabilityPrices.Add(putCallSchedule_[i].price().amount());

                    if (putCallSchedule_[i].price().type() == Callability.Price.Type.Clean)
                    {
                        /* calling accrued() forces accrued interest to be zero
                         * if future option date is also coupon date, so that dirty
                         * price = clean price. Use here because callability is
                         * always applied before coupon in the tree engine.
                         */
                        arguments.callabilityPrices[arguments.callabilityPrices.Count - 1] += this.accrued(putCallSchedule_[i].date());
                    }
                }
            }
        }
Пример #2
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            MultiAssetOption.Arguments arguments = args as MultiAssetOption.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong argument type");

            arguments.payoff   = payoff_;
            arguments.exercise = exercise_;
        }
Пример #3
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            ContinuousFixedLookbackOption.Arguments moreArgs = args as ContinuousFixedLookbackOption.Arguments;
            Utils.QL_REQUIRE(moreArgs != null, () => "wrong argument type");
            moreArgs.minmax = minmax_;
        }
Пример #4
0
        public virtual void setupArguments(IPricingEngineArguments a)
        {
            OneAssetOption.Arguments args = a as OneAssetOption.Arguments;
            Utils.QL_REQUIRE(args != null, () => "incorrect argument type");

            exerciseDate_ = args.exercise.lastDate();
            payoff_       = args.payoff;
        }
Пример #5
0
 public override void setupArguments(IPricingEngineArguments a) {
     DividendVanillaOption.Arguments args = a as DividendVanillaOption.Arguments;
     if (args == null) throw new ApplicationException("incorrect argument type");
     List<Event> events = new List<Event>();
     foreach (Event e in args.cashFlow)
         events.Add(e);
     base.setupArguments(a, events);
 }
Пример #6
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            ContinuousAveragingAsianOption.Arguments moreArgs = args as ContinuousAveragingAsianOption.Arguments;
            Utils.QL_REQUIRE(moreArgs != null, () => "wrong argument type");
            moreArgs.averageType = averageType_;
        }
Пример #7
0
 public override void setupArguments(IPricingEngineArguments args)
 {
     base.setupArguments(args);
     // set accrued coupon, last fixing, caps, floors
     CliquetOption.Arguments moreArgs = args as CliquetOption.Arguments;
     Utils.QL_REQUIRE(moreArgs != null, () => "wrong engine type");
     moreArgs.resetDates = new List <Date>(resetDates_);
 }
Пример #8
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            ContinuousPartialFixedLookbackOption.Arguments moreArgs = args as ContinuousPartialFixedLookbackOption.Arguments;
            Utils.QL_REQUIRE(moreArgs != null, () => "wrong argument type");
            moreArgs.lookbackPeriodStart = lookbackPeriodStart_;
        }
Пример #9
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            Swap.Arguments arguments = args as Swap.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong argument type");

            arguments.legs  = legs_;
            arguments.payer = payer_;
        }
Пример #10
0
        public override void setupArguments(IPricingEngineArguments args) {
            Option.Arguments arguments = args as Option.Arguments;

            if (arguments == null)
                throw new ApplicationException("wrong argument type");

            arguments.payoff = payoff_;
            arguments.exercise = exercise_;
        }
Пример #11
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);
            ForwardVanillaOption.Arguments arguments = args as ForwardVanillaOption.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong argument type");

            arguments.moneyness = moneyness_;
            arguments.resetDate = resetDate_;
        }
Пример #12
0
 protected virtual void setupArguments(IPricingEngineArguments args, List<Event> schedule) {
     base.setupArguments(args);
     events_ = schedule;
     stoppingTimes_.Clear();
     int n = schedule.Count;
     stoppingTimes_ = new List<double>(n);
     for (int i = 0; i < n; ++i)
         stoppingTimes_.Add(process_.time(events_[i].date()));
 }
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            DividendBarrierOption.Arguments arguments = args as DividendBarrierOption.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong engine type");

            arguments.cashFlow = cashFlow_;
        }
Пример #14
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            Bond.Arguments arguments = args as Bond.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong argument type");

            arguments.settlementDate = settlementDate();
            arguments.cashflows      = cashflows_;
            arguments.calendar       = calendar_;
        }
Пример #15
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

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

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

            List <CashFlow> fixedCoupons = fixedLeg();

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

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

                arguments.fixedPayDates[i]   = coupon.date();
                arguments.fixedResetDates[i] = coupon.accrualStartDate();
                arguments.fixedCoupons[i]    = coupon.amount();
            }

            List <CashFlow> floatingCoupons = floatingLeg();

            arguments.floatingResetDates   = new InitializedList <Date>(floatingCoupons.Count);
            arguments.floatingPayDates     = new InitializedList <Date>(floatingCoupons.Count);
            arguments.floatingFixingDates  = new InitializedList <Date>(floatingCoupons.Count);
            arguments.floatingAccrualTimes = new InitializedList <double>(floatingCoupons.Count);
            arguments.floatingSpreads      = new InitializedList <double>(floatingCoupons.Count);
            arguments.floatingCoupons      = new InitializedList <double>(floatingCoupons.Count);
            for (int i = 0; i < floatingCoupons.Count; ++i)
            {
                IborCoupon coupon = (IborCoupon)floatingCoupons[i];

                arguments.floatingResetDates[i] = coupon.accrualStartDate();
                arguments.floatingPayDates[i]   = coupon.date();

                arguments.floatingFixingDates[i]  = coupon.fixingDate();
                arguments.floatingAccrualTimes[i] = coupon.accrualPeriod();
                arguments.floatingSpreads[i]      = coupon.spread();
                try
                {
                    arguments.floatingCoupons[i] = coupon.amount();
                }
                catch
                {
                    arguments.floatingCoupons[i] = default(double);
                }
            }
        }
Пример #16
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            Arguments arguments = args as Arguments;

            Utils.QL_REQUIRE(arguments != null, () => "wrong engine type");

            arguments.cashFlow = cashFlow_ ?? new DividendSchedule();
        }
Пример #17
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            CatBond.Arguments arguments = args as CatBond.Arguments;
            Utils.QL_REQUIRE(arguments != null, () => "wrong arguments type");

            base.setupArguments(args);

            arguments.notionalRisk = notionalRisk_;
            arguments.startDate    = issueDate();
        }
Пример #18
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);
                }
            }
        }
Пример #19
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            MultiAssetOption.Arguments arguments = args as MultiAssetOption.Arguments;
            if (arguments == null)
            {
                throw new ApplicationException("wrong argument type");
            }

            arguments.payoff   = payoff_;
            arguments.exercise = exercise_;
        }
Пример #20
0
        public override void setupArguments(IPricingEngineArguments a) {
            base.setupArguments(a);
            OneAssetOption.Arguments args = a as OneAssetOption.Arguments;
            if (args == null) throw new ApplicationException("incorrect argument type");
            events_.Clear();

            int n = args.exercise.dates().Count;
            stoppingTimes_ = new InitializedList<double>(n);
            for (int i = 0; i < n; ++i)
                stoppingTimes_[i] = process_.time(args.exercise.date(i));
        }
Пример #21
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            Loan.Arguments arguments = args as Loan.Arguments;
            if (arguments == null)
            {
                throw new ArgumentException("wrong argument type");
            }

            arguments.legs  = legs_;
            arguments.payer = payer_;
        }
Пример #22
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            ContinuousAveragingAsianOption.Arguments moreArgs = args as ContinuousAveragingAsianOption.Arguments;
            if (!(moreArgs != null))
            {
                throw new Exception("wrong argument type");
            }
            moreArgs.averageType = averageType_;
        }
Пример #23
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            BarrierOption.Arguments moreArgs = args as BarrierOption.Arguments;
            Utils.QL_REQUIRE(moreArgs != null, () => "wrong argument type");

            moreArgs.barrierType = barrierType_;
            moreArgs.barrier     = barrier_;
            moreArgs.rebate      = rebate_;
        }
Пример #24
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);
                }
            }
        }
Пример #25
0
        public virtual void setupArguments(IPricingEngineArguments a)
        {
            OneAssetOption.Arguments args = a as OneAssetOption.Arguments;
            if (args == null)
            {
                throw new ApplicationException("incorrect argument type");
            }

            exerciseDate_ = args.exercise.lastDate();
            payoff_       = args.payoff;
        }
Пример #26
0
        public override void setupArguments(IPricingEngineArguments a)
        {
            DividendVanillaOption.Arguments args = a as DividendVanillaOption.Arguments;
            Utils.QL_REQUIRE(args != null, () => "incorrect argument type");
            List <Event> events = new List <Event>();

            foreach (Event e in args.cashFlow)
            {
                events.Add(e);
            }
            base.setupArguments(a, events);
        }
Пример #27
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            Bond.Arguments arguments = args as Bond.Arguments;
            if (args == null)
            {
                throw new ApplicationException("wrong argument type");
            }

            arguments.settlementDate = settlementDate();
            arguments.cashflows      = cashflows_;
            arguments.calendar       = calendar_;
        }
Пример #28
0
        public virtual void setupArguments(IPricingEngineArguments a)
        {
            OneAssetOption.Arguments args = a as OneAssetOption.Arguments;
            if (args == null)
            {
                throw new ApplicationException("incorrect argument type");
            }

            exerciseDate_      = args.exercise.lastDate();
            payoff_            = args.payoff;
            requiredGridValue_ = ((StrikedTypePayoff)payoff_).strike();
        }
Пример #29
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            DiscreteAveragingAsianOption.Arguments moreArgs = args as DiscreteAveragingAsianOption.Arguments;
            Utils.QL_REQUIRE(moreArgs != null, () => "wrong argument type");

            moreArgs.averageType        = averageType_;
            moreArgs.runningAccumulator = runningAccumulator_;
            moreArgs.pastFixings        = pastFixings_;
            moreArgs.fixingDates        = fixingDates_;
        }
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            Arguments arguments = args as Arguments;

            if (arguments == null)
            {
                throw new ApplicationException("wrong engine type");
            }

            arguments.cashFlow = cashFlow_;
        }
Пример #31
0
        protected virtual void setupArguments(IPricingEngineArguments args, List <Event> schedule)
        {
            base.setupArguments(args);
            events_ = schedule;
            stoppingTimes_.Clear();
            int n = schedule.Count;

            stoppingTimes_ = new List <double>(n);
            for (int i = 0; i < n; ++i)
            {
                stoppingTimes_.Add(process_.time(events_[i].date()));
            }
        }
Пример #32
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            swap_.setupArguments(args);

            Swaption.Arguments arguments = args as Swaption.Arguments;
            if (arguments == null)
            {
                throw new ArgumentException("wrong argument type");
            }
            arguments.swap           = swap_;
            arguments.settlementType = settlementType_;
            arguments.exercise       = exercise_;
        }
Пример #33
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

            BarrierOption.Arguments moreArgs = args as BarrierOption.Arguments;
            if (!(moreArgs != null))
            {
                throw new ApplicationException("wrong argument type");
            }

            moreArgs.barrierType = barrierType_;
            moreArgs.barrier     = barrier_;
            moreArgs.rebate      = rebate_;
        }
Пример #34
0
        public override void setupArguments(IPricingEngineArguments a)
        {
            DividendVanillaOption.Arguments args = a as DividendVanillaOption.Arguments;
            if (args == null)
            {
                throw new ApplicationException("incorrect argument type");
            }
            List <Event> events = new List <Event>();

            foreach (Event e in args.cashFlow)
            {
                events_.Add(e);
            }
            base.setupArguments(a, events);
        }
Пример #35
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

             BasisSwap.Arguments arguments = args as BasisSwap.Arguments;
             if (arguments == null)  // it's a swap engine...
            return;

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

             List<CashFlow> floating1Coupons = floating1Leg();

             arguments.floating1ResetDates = new InitializedList<Date>(floating1Coupons.Count);
             arguments.floating1PayDates = new InitializedList<Date>(floating1Coupons.Count);
             arguments.floating1FixingDates = new InitializedList<Date>(floating1Coupons.Count);
             arguments.floating1AccrualTimes = new InitializedList<double>(floating1Coupons.Count);
             arguments.floating1Spreads = new InitializedList<double>(floating1Coupons.Count);
             arguments.floating1Coupons = new InitializedList<double>(floating1Coupons.Count);
             for (int i = 0; i < floating1Coupons.Count; ++i)
             {
            IborCoupon coupon = (IborCoupon)floating1Coupons[i];

            arguments.floating1ResetDates[i] = coupon.accrualStartDate();
            arguments.floating1PayDates[i] = coupon.Date;

            arguments.floating1FixingDates[i] = coupon.fixingDate();
            arguments.floating1AccrualTimes[i] = coupon.accrualPeriod();
            arguments.floating1Spreads[i] = coupon.spread();
            try
            {
               arguments.floating1Coupons[i] = coupon.amount();
            }
            catch
            {
               arguments.floating1Coupons[i] = default(double);
            }
             }

             List<CashFlow> floating2Coupons = floating2Leg();

             arguments.floating2ResetDates = new InitializedList<Date>(floating2Coupons.Count);
             arguments.floating2PayDates = new InitializedList<Date>(floating2Coupons.Count);
             arguments.floating2FixingDates = new InitializedList<Date>(floating2Coupons.Count);
             arguments.floating2AccrualTimes = new InitializedList<double>(floating2Coupons.Count);
             arguments.floating2Spreads = new InitializedList<double>(floating2Coupons.Count);
             arguments.floating2Coupons = new InitializedList<double>(floating2Coupons.Count);
             for (int i = 0; i < floating2Coupons.Count; ++i)
             {
            IborCoupon coupon = (IborCoupon)floating2Coupons[i];

            arguments.floating2ResetDates[i] = coupon.accrualStartDate();
            arguments.floating2PayDates[i] = coupon.Date;

            arguments.floating2FixingDates[i] = coupon.fixingDate();
            arguments.floating2AccrualTimes[i] = coupon.accrualPeriod();
            arguments.floating2Spreads[i] = coupon.spread();
            try
            {
               arguments.floating2Coupons[i] = coupon.amount();
            }
            catch
            {
               arguments.floating2Coupons[i] = default(double);
            }
             }
        }
Пример #36
0
        public override void setupArguments(IPricingEngineArguments args)
        {
           base.setupArguments(args);

           ConvertibleBond.option.arguments moreArgs = args as ConvertibleBond.option.arguments;
           Utils.QL_REQUIRE( moreArgs != null, () => "wrong argument type" );

           moreArgs.conversionRatio = conversionRatio_;

           Date settlement = bond_.settlementDate();

           int n = callability_.Count;
           moreArgs.callabilityDates.Clear();
           moreArgs.callabilityTypes.Clear();
           moreArgs.callabilityPrices.Clear();
           moreArgs.callabilityTriggers.Clear();
           moreArgs.callabilityDates.Capacity = n;
           moreArgs.callabilityTypes.Capacity = n;
           moreArgs.callabilityPrices.Capacity = n;
           moreArgs.callabilityTriggers.Capacity = n;
           for (int i=0; i<n; i++) 
           {
               if (!callability_[i].hasOccurred(settlement, false)) 
               {
                  moreArgs.callabilityTypes.Add(callability_[i].type());
                  moreArgs.callabilityDates.Add(callability_[i].date());
                  
                  if (callability_[i].price().type() == Callability.Price.Type.Clean)
                     moreArgs.callabilityPrices.Add(callability_[i].price().amount() + bond_.accruedAmount(callability_[i].date()));
                  else
                     moreArgs.callabilityPrices.Add(callability_[i].price().amount());

                   SoftCallability softCall = callability_[i] as SoftCallability;
                   if (softCall != null )
                       moreArgs.callabilityTriggers.Add(softCall.trigger());
                   else
                       moreArgs.callabilityTriggers.Add(null);
               }
           }

           List<CashFlow> cashflows = bond_.cashflows();

           moreArgs.couponDates.Clear();
           moreArgs.couponAmounts.Clear();
           for (int i=0; i<cashflows.Count-1; i++) 
           {
               if (!cashflows[i].hasOccurred(settlement, false)) 
               {
                   moreArgs.couponDates.Add(cashflows[i].date());
                   moreArgs.couponAmounts.Add(cashflows[i].amount());
               }
           }

           moreArgs.dividends.Clear();
           moreArgs.dividendDates.Clear();
           for (int i=0; i<dividends_.Count; i++) 
           {
               if (!dividends_[i].hasOccurred(settlement, false)) 
               {
                   moreArgs.dividends.Add(dividends_[i]);
                   moreArgs.dividendDates.Add(dividends_[i].date());
               }
           }

           moreArgs.creditSpread = creditSpread_;
           moreArgs.issueDate = issueDate_;
           moreArgs.settlementDate = settlement;
           moreArgs.settlementDays = settlementDays_;
           moreArgs.redemption = redemption_;
        }
Пример #37
0
 /*! When a derived argument structure is defined for an instrument,
  * this method should be overridden to fill it.
  * This is mandatory in case a pricing engine is used. */
 public virtual void setupArguments(IPricingEngineArguments a)
 {
     throw new NotImplementedException();
 }
Пример #38
0
        // other
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

             AssetSwap.Arguments arguments = args as AssetSwap.Arguments;

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

             List<CashFlow> fixedCoupons = bondLeg();

             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[i] = coupon.date();
            arguments.fixedResetDates[i] = coupon.accrualStartDate();
            arguments.fixedCoupons[i] = coupon.amount();
             }

             List<CashFlow> floatingCoupons = floatingLeg();

             arguments.floatingResetDates = arguments.floatingPayDates =
            arguments.floatingFixingDates = new List<Date>(floatingCoupons.Count);
             arguments.floatingAccrualTimes = new List<double>(floatingCoupons.Count);
             arguments.floatingSpreads = new List<double>(floatingCoupons.Count);

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

            arguments.floatingResetDates[i] = coupon.accrualStartDate();
            arguments.floatingPayDates[i] = coupon.date();
            arguments.floatingFixingDates[i] = coupon.fixingDate();
            arguments.floatingAccrualTimes[i] = coupon.accrualPeriod();
            arguments.floatingSpreads[i] = coupon.spread();
             }
        }
Пример #39
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            LoanPricingEngineArguments arguments = args as LoanPricingEngineArguments;
            if (arguments == null) throw new ArgumentException("wrong argument type");

            arguments.legs.Clear();
            arguments.payer.Clear();

            arguments.legs.AddRange(legs_);
            arguments.payer.AddRange(payer_);
        }
Пример #40
0
        public override void setupArguments(IPricingEngineArguments args)
        {
            base.setupArguments(args);

             VanillaSwap.Arguments arguments = args as VanillaSwap.Arguments;
             if (arguments == null)  // it's a swap engine...
            return;

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

             List<CashFlow> fixedCoupons = fixedLeg();

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

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

            arguments.fixedPayDates[i] = coupon.date();
            arguments.fixedResetDates[i] = coupon.accrualStartDate();
            arguments.fixedCoupons[i] = coupon.amount();
             }

             List<CashFlow> floatingCoupons = floatingLeg();

             arguments.floatingResetDates = new InitializedList<Date>(floatingCoupons.Count);
             arguments.floatingPayDates = new InitializedList<Date>(floatingCoupons.Count);
             arguments.floatingFixingDates = new InitializedList<Date>(floatingCoupons.Count);
             arguments.floatingAccrualTimes = new InitializedList<double>(floatingCoupons.Count);
             arguments.floatingSpreads = new InitializedList<double>(floatingCoupons.Count);
             arguments.floatingCoupons = new InitializedList<double>(floatingCoupons.Count);
             for (int i = 0; i < floatingCoupons.Count; ++i)
             {
            IborCoupon coupon = (IborCoupon)floatingCoupons[i];

            arguments.floatingResetDates[i] = coupon.accrualStartDate();
            arguments.floatingPayDates[i] = coupon.date();

            arguments.floatingFixingDates[i] = coupon.fixingDate();
            arguments.floatingAccrualTimes[i] = coupon.accrualPeriod();
            arguments.floatingSpreads[i] = coupon.spread();
            try
            {
               arguments.floatingCoupons[i] = coupon.amount();
            }
            catch
            {
               arguments.floatingCoupons[i] = default(double);
            }
             }
        }