Exemple #1
0
 public ResetStrikeOption(Date startDate,
                          Date maturityDate,
                          OptionExercise exercise,
                          OptionType optionType,
                          ResetStrikeType resetStrikeType,
                          double strike,
                          InstrumentType underlyingInstrumentType,
                          ICalendar calendar,
                          IDayCount dayCount,
                          CurrencyCode payoffCcy,
                          CurrencyCode settlementCcy,
                          Date[] exerciseDates,
                          Date[] observationDates,
                          Date strikefixingDate,
                          double notional               = 1,
                          DayGap settlementGap          = null,
                          Date optionPremiumPaymentDate = null,
                          double optionPremium          = 0)
     : base(startDate: startDate, maturityDate: maturityDate, exercise: exercise, optionType: optionType, strike: new double[] { strike },
            underlyingInstrumentType: underlyingInstrumentType, calendar: calendar, dayCount: dayCount,
            settlementCcy: settlementCcy, payoffCcy: payoffCcy, exerciseDates: exerciseDates, observationDates: observationDates,
            notional: notional, settlementGap: settlementGap, optionPremiumPaymentDate: optionPremiumPaymentDate, optionPremium: optionPremium)
 {
     ResetStrikeType  = resetStrikeType;
     StrikeFixingDate = strikefixingDate;
 }
Exemple #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="startDate">开始日期</param>
 /// <param name="maturityDate">到期日</param>
 /// <param name="exercise">行权方式</param>
 /// <param name="optionType">看涨看跌</param>
 /// <param name="spreadType">价差期权类型</param>
 /// <param name="weights">权重</param>
 /// <param name="strike">行权价</param>
 /// <param name="underlyingInstrumentType">标的资产类型</param>
 /// <param name="calendar">交易日历</param>
 /// <param name="dayCount">日期规则</param>
 /// <param name="payoffCcy">收益计算币种</param>
 /// <param name="settlementCcy">结算币种</param>
 /// <param name="exerciseDates">行权日</param>
 /// <param name="observationDates">观察日</param>
 /// <param name="underlyingTickers">标的代码</param>
 /// <param name="notional">名义本金</param>
 /// <param name="settlementGap">结算日规则</param>
 /// <param name="optionPremiumPaymentDate">权利金支付日</param>
 /// <param name="optionPremium">权利金</param>
 /// <param name="hasNightMarket">标的资产是否有夜盘交易</param>
 /// <param name="commodityFuturesPreciseTimeMode">是否启用精确时间计算模式</param>
 public SpreadOption(Date startDate,
                     Date maturityDate,
                     OptionExercise exercise,
                     OptionType optionType,
                     SpreadType spreadType,
                     double[] weights,
                     double strike,
                     InstrumentType underlyingInstrumentType,
                     ICalendar calendar,
                     IDayCount dayCount,
                     CurrencyCode payoffCcy,
                     CurrencyCode settlementCcy,
                     Date[] exerciseDates,
                     Date[] observationDates,
                     string[] underlyingTickers,
                     double notional                      = 1,
                     DayGap settlementGap                 = null,
                     Date optionPremiumPaymentDate        = null,
                     double optionPremium                 = 0,
                     bool hasNightMarket                  = false,
                     bool commodityFuturesPreciseTimeMode = false)
     : base(startDate: startDate, maturityDate: maturityDate, exercise: exercise, optionType: optionType, strike: new double[] { strike },
            underlyingInstrumentType: underlyingInstrumentType, calendar: calendar, dayCount: dayCount,
            settlementCcy: settlementCcy, payoffCcy: payoffCcy, exerciseDates: exerciseDates, observationDates: observationDates,
            notional: notional, settlementGap: settlementGap, optionPremiumPaymentDate: optionPremiumPaymentDate, optionPremium: optionPremium, underlyingTickers: underlyingTickers,
            hasNightMarket: hasNightMarket, commodityFuturesPreciseTimeMode: commodityFuturesPreciseTimeMode)
 {
     SpreadType = spreadType;
     Weights    = weights;
 }
Exemple #3
0
 public FloatingCoupon(IIndex index,
                       ICalendar calendar,
                       IDayCount dayCount,
                       double couponSpread,
                       ITerm resetTerm,
                       Stub resetStub,
                       BusinessDayConvention bda,
                       DayGap resetToFixingGap        = null,
                       DayGap initialResetToFixingGap = null,
                       double floorRate = -100,
                       double capRate   = 100,
                       FloatingCouponCalcType frnCalc = FloatingCouponCalcType.SimpleFrn,
                       double multiplier = 1.0)
 {
     Index                   = index;
     Calendar                = calendar;
     DayCount                = dayCount;
     CouponSpread            = couponSpread;
     ResetTerm               = resetTerm;
     ResetStub               = resetStub;
     Bda                     = bda;
     ResetToFixingGap        = resetToFixingGap;
     InitialResetToFixingGap = initialResetToFixingGap;
     FloorRate               = floorRate;
     CapRate                 = capRate;
     FrnCalc                 = frnCalc;
     Multiplier              = multiplier;
 }
Exemple #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="startDate">开始日</param>
 /// <param name="maturityDate">到期日</param>
 /// <param name="exercise">行权方式</param>
 /// <param name="optionType">看涨看跌</param>
 /// <param name="rainbowType">彩虹期权类型</param>
 /// <param name="strikes">行权价</param>
 /// <param name="cashAmount">现金金额</param>
 /// <param name="underlyingInstrumentType">标的资产类型</param>
 /// <param name="calendar">交易日历</param>
 /// <param name="dayCount">日期规则</param>
 /// <param name="payoffCcy">收益计算币种</param>
 /// <param name="settlementCcy">结算币种</param>
 /// <param name="exerciseDates">行权日</param>
 /// <param name="observationDates">观察日</param>
 /// <param name="fixings">观察价格序列</param>
 /// <param name="notional">名义本金</param>
 /// <param name="settlementGap">结算日规则</param>
 /// <param name="optionPremiumPaymentDate">权利金支付日</param>
 /// <param name="optionPremium">权利金</param>
 /// <param name="hasNightMarket">标的资产是否有夜盘交易</param>
 /// <param name="commodityFuturesPreciseTimeMode">是否启用精确时间模式</param>
 public RainbowOption(Date startDate,
                      Date maturityDate,
                      OptionExercise exercise,
                      OptionType optionType,
                      RainbowType rainbowType,
                      double[] strikes,
                      double cashAmount,
                      InstrumentType underlyingInstrumentType,
                      ICalendar calendar,
                      IDayCount dayCount,
                      CurrencyCode payoffCcy,
                      CurrencyCode settlementCcy,
                      Date[] exerciseDates,
                      Date[] observationDates,
                      string [] underlyingTickers,
                      double notional                      = 1,
                      DayGap settlementGap                 = null,
                      Date optionPremiumPaymentDate        = null,
                      double optionPremium                 = 0,
                      bool hasNightMarket                  = false,
                      bool commodityFuturesPreciseTimeMode = false)
     : base(startDate: startDate, maturityDate: maturityDate, exercise: exercise, optionType: optionType, strike: strikes,
            underlyingInstrumentType: underlyingInstrumentType, calendar: calendar, dayCount: dayCount,
            settlementCcy: settlementCcy, payoffCcy: payoffCcy, exerciseDates: exerciseDates, observationDates: observationDates,
            notional: notional, settlementGap: settlementGap, optionPremiumPaymentDate: optionPremiumPaymentDate, optionPremium: optionPremium, underlyingTickers: underlyingTickers,
            hasNightMarket: hasNightMarket, commodityFuturesPreciseTimeMode: commodityFuturesPreciseTimeMode)
 {
     RainbowType = rainbowType;
     CashAmount  = cashAmount;
     Strikes     = strikes;
 }
Exemple #5
0
 public LookbackOption(Date startDate,
                       Date maturityDate,
                       OptionExercise exercise,
                       OptionType optionType,
                       StrikeStyle strikeStyle,
                       double strike,
                       InstrumentType underlyingInstrumentType,
                       ICalendar calendar,
                       IDayCount dayCount,
                       CurrencyCode payoffCcy,
                       CurrencyCode settlementCcy,
                       Date[] exerciseDates,
                       Date[] observationDates,
                       Dictionary <Date, double> fixings,
                       double notional                      = 1,
                       DayGap settlementGap                 = null,
                       Date optionPremiumPaymentDate        = null,
                       double optionPremium                 = 0,
                       bool isMoneynessOption               = false,
                       double initialSpotPrice              = 0.0,
                       Dictionary <Date, double> dividends  = null,
                       bool hasNightMarket                  = false,
                       bool commodityFuturesPreciseTimeMode = false
                       )
     : base(startDate, maturityDate, exercise, optionType, new double[] { strike }, underlyingInstrumentType, calendar, dayCount,
            settlementCcy, payoffCcy, exerciseDates, observationDates, notional, settlementGap,
            optionPremiumPaymentDate, optionPremium,
            isMoneynessOption: isMoneynessOption, initialSpotPrice: initialSpotPrice, dividends: dividends, hasNightMarket: hasNightMarket,
            commodityFuturesPreciseTimeMode: commodityFuturesPreciseTimeMode)
 {
     Fixings     = fixings;
     StrikeStyle = strikeStyle;
 }
Exemple #6
0
        //cash flow must be sorted by date
        public static double GetAccruedInterest(Date calcDate, Cashflow[] cashflow, IDayCount dayCount, bool isEod = true)
        {
            int nextCashflow;
            var flg = GetAccruedInterestCommon(out nextCashflow, calcDate, cashflow);

            if (!flg)
            {
                return(0.0);
            }

            var startDate    = nextCashflow == 0 ? cashflow[0].AccrualStartDate : cashflow[nextCashflow - 1].PaymentDate;
            var coupon       = cashflow[nextCashflow].CouponRate;
            var refStartDate = cashflow[nextCashflow].RefStartDate;
            var refEndDate   = cashflow[nextCashflow].RefEndDate;
            var notional     = cashflow[nextCashflow].StartPrincipal;

            if (!isEod)
            {
                return(dayCount.CalcDayCountFraction(startDate, calcDate, refStartDate, refEndDate) * coupon * notional);
            }
            else
            {
                return(dayCount.CalcDayCountFraction(startDate, calcDate.AddDays(1), refStartDate, refEndDate) * coupon * notional);
            }
        }
Exemple #7
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="startDate">开始日期</param>
 /// <param name="maturityDate">到期日</param>
 /// <param name="exercise">行权方式</param>
 /// <param name="optionType">看涨看跌</param>
 /// <param name="strike">行权价</param>
 /// <param name="underlyingInstrumentType">标的资产类型</param>
 /// <param name="calendar">交易日历</param>
 /// <param name="dayCount">日期规则</param>
 /// <param name="payoffCcy">收益计算币种</param>
 /// <param name="settlementCcy">结算币种</param>
 /// <param name="exerciseDates">行权日</param>
 /// <param name="observationDates">观察日</param>
 /// <param name="notional">名义本金</param>
 /// <param name="settlementGap">结算日规则</param>
 /// <param name="optionPremiumPaymentDate">权利金支付日</param>
 /// <param name="optionPremium">权利金</param>
 /// <param name="isMoneynessOption">是否为相对行权价期权</param>
 /// <param name="initialSpotPrice">标的资产期初价格</param>
 /// <param name="dividends">标的资产分红</param>
 /// <param name="hasNightMarket">标的资产是否有夜盘交易</param>
 /// <param name="commodityFuturesPreciseTimeMode">是否启用精确时间计算模式</param>
 public VanillaOption(Date startDate,
                      Date maturityDate, //underlying maturity,  for option on forward
                      OptionExercise exercise,
                      OptionType optionType,
                      double strike,
                      InstrumentType underlyingInstrumentType,
                      ICalendar calendar,
                      IDayCount dayCount,
                      CurrencyCode payoffCcy,
                      CurrencyCode settlementCcy,
                      Date[] exerciseDates,
                      Date[] observationDates,
                      double notional                      = 1,
                      DayGap settlementGap                 = null,
                      Date optionPremiumPaymentDate        = null,
                      double optionPremium                 = 0.0,
                      bool isMoneynessOption               = false,
                      double initialSpotPrice              = 0.0,
                      Dictionary <Date, double> dividends  = null,
                      bool hasNightMarket                  = false,
                      bool commodityFuturesPreciseTimeMode = false
                      )
     : base(startDate, maturityDate, exercise, optionType, new double[] { strike }, underlyingInstrumentType,
            calendar, dayCount, payoffCcy, settlementCcy, exerciseDates, observationDates, notional, settlementGap,
            optionPremiumPaymentDate, optionPremium,
            isMoneynessOption: isMoneynessOption, initialSpotPrice: initialSpotPrice, dividends: dividends, hasNightMarket: hasNightMarket,
            commodityFuturesPreciseTimeMode: commodityFuturesPreciseTimeMode)
 {
     if (Exercise == OptionExercise.European && exerciseDates.Length != 1)
     {
         throw new PricingLibraryException("Vanilla European option can have only 1 observation date");
     }
 }
Exemple #8
0
        public static List <Dictionary <Date, double> > GeneratePath(
            IStochasticProcess1D[] processes,
            double[] x0,
            Date[] startDates,
            Date[] observationDates,
            ICalendar calendar,
            IDayCount basis,
            Random random)
        {
            var currentX     = x0.ToList();
            var processArray = processes.ToArray();


            var count   = processArray.Count();
            var results = new List <Dictionary <Date, double> > [count * 2]
                          .Select(x => new Dictionary <Date, double>())
                          .ToList();

            var normalRandomSamples = GetRandomSamples(random, observationDates.Length);

            //original path
            for (var i = 0; i < processArray.Length; ++i)
            {
                var start    = startDates[i];
                var obsDates = observationDates.Where(x => x > start).ToArray();
                results[i][start] = currentX[i];
                var currentT = 0.0;

                for (int j = 0; j < obsDates.Count(); j++)
                {
                    var dt = basis.CalcDayCountFraction(start, obsDates[j]);
                    currentX[i]             = processArray[i].Evolve(currentT, currentX[i], dt, normalRandomSamples[j]);
                    currentT               += dt;
                    results[i][obsDates[j]] = currentX[i];
                    start = obsDates[j];
                }
            }

            //antithetic path
            currentX = x0.ToList();
            for (var i = 0; i < processArray.Length; ++i)
            {
                var start    = startDates[i];
                var obsDates = observationDates.Where(x => x > start).ToArray();
                results[i + count][start] = currentX[i];
                var currentT = 0.0;

                for (int j = 0; j < obsDates.Count(); j++)
                {
                    var step = basis.CalcDayCountFraction(start, obsDates[j]);
                    currentX[i] = processArray[i].Evolve(currentT, currentX[i], step, -normalRandomSamples[j]);
                    currentT   += step;
                    results[i + count][obsDates[j]] = currentX[i];
                    start = obsDates[j];
                }
            }

            return(results);
        }
Exemple #9
0
        public double FullPriceFromYield(Cashflow[] cashflows,
                                         IDayCount dayCount,
                                         Frequency frequency,
                                         Date startDate,
                                         Date valueDate,
                                         double yield,
                                         TradingMarket tradeingMarket,
                                         bool irregularPayment = false)
        {
            var remainingCfs = cashflows.Where(x => x.PaymentDate > valueDate).ToList();

            if (!remainingCfs.Any())
            {
                return(0.0);
            }

            var lastCouponPeriod = cashflows.Where(x => x.PaymentDate >= valueDate).ToList().Count == 1;

            if (tradeingMarket.Equals(TradingMarket.ChinaInterBank))
            {
                if (lastCouponPeriod)
                {
                    dayCount = new ModifiedAfb();
                }
            }
            //if (remainingCfs.Count == 1)
            //{
            //	var cf = remainingCfs.Single();
            //	if (cf.PaymentDate <= new Term("1Y").Next(valueDate))
            //	{
            //		return cf.PaymentAmount / (1.0 + yield * dayCount.CalcDayCountFraction(valueDate, cf.PaymentDate, cf.RefStartDate, cf.RefEndDate));
            //	}
            //	else
            //	{
            //		return cf.PaymentAmount / Math.Pow(1.0 + yield, dayCount.CalcDayCountFraction(valueDate, cf.PaymentDate, cf.RefStartDate, cf.RefEndDate));
            //	}
            //}

            var npv  = 0.0;
            var df   = 1.0;
            var freq = frequency.CountPerYear();

            foreach (var remainingCf in remainingCfs)
            {
                var dt = dayCount.CalcDayCountFraction(valueDate, remainingCf.PaymentDate, remainingCf.RefStartDate, remainingCf.RefEndDate);
                if (lastCouponPeriod)
                {
                    df *= 1.0 / (1.0 + yield * dt);
                }
                else
                {
                    df *= 1.0 / Math.Pow(1 + yield / freq, freq * dt);
                }
                npv      += remainingCf.PaymentAmount * df;
                valueDate = remainingCf.PaymentDate;
            }
            return(npv);
        }
        private static double GetModelPrice(Date referenceDate, Cashflow[] cfs, IDayCount dayCount, double[] variables, double[] keyTs)
        {
            var points = cfs.Where(x => x.PaymentDate > referenceDate).Select(x =>
            {
                var t = dayCount.CalcDayCountFraction(referenceDate, x.PaymentDate);
                return(Tuple.Create(t, x.PaymentAmount));
            }).ToArray();

            return(points.Sum(p => GetDf(variables, keyTs, p.Item1) * p.Item2));
        }
Exemple #11
0
        protected OptionBase(Date startDate,
                             Date maturityDate,
                             OptionExercise exercise,
                             OptionType optionType,
                             double[] strike,
                             InstrumentType underlyingInstrumentType,
                             ICalendar calendar,
                             IDayCount dayCount,
                             CurrencyCode payoffCcy,
                             CurrencyCode settlementCcy,
                             Date[] exerciseDates,
                             Date[] observationDates,
                             double notional                      = 1.0,
                             DayGap settlementGap                 = null,
                             Date optionPremiumPaymentDate        = null,
                             double optionPremium                 = 0.0,
                             string[] underlyingTickers           = null,
                             bool isMoneynessOption               = false,
                             double initialSpotPrice              = 0.0,
                             Dictionary <Date, double> dividends  = null,
                             bool hasNightMarket                  = false,
                             bool commodityFuturesPreciseTimeMode = false)
        {
            StartDate = startDate;

            Exercise              = exercise;
            OptionType            = optionType;
            Strike                = strike[0];
            Strikes               = strike;
            UnderlyingProductType = underlyingInstrumentType;

            Calendar               = calendar;
            DayCount               = dayCount;
            SettlmentGap           = settlementGap ?? new DayGap("+0BD");
            UnderlyingMaturityDate = SettlmentGap.Get(Calendar, maturityDate);

            ExerciseDates    = exerciseDates;
            ObservationDates = observationDates;

            UnderlyingTickers = underlyingTickers;

            Notional      = notional;
            PayoffCcy     = payoffCcy;
            SettlementCcy = settlementCcy;

            OptionPremiumPaymentDate = optionPremiumPaymentDate;
            OptionPremium            = optionPremium;

            IsMoneynessOption = isMoneynessOption;
            InitialSpotPrice  = initialSpotPrice;
            Dividends         = dividends;

            HasNightMarket = hasNightMarket;
            CommodityFuturesPreciseTimeMode = commodityFuturesPreciseTimeMode;
        }
Exemple #12
0
        public double YieldFromFullPrice(Cashflow[] cashflows,
                                         IDayCount dayCount,
                                         Frequency frequency,
                                         Date startDate,
                                         Date valueDate,
                                         double fullPrice,
                                         TradingMarket tradingMarket,
                                         bool irregularPayment = false)
        {
            var remainingCfs = cashflows.Where(x => x.PaymentDate > valueDate).ToList();

            if (!remainingCfs.Any())
            {
                return(0.0);
            }

            try
            {
                var left = -0.999999;
                if (remainingCfs.Count == 1)
                {
                    if (tradingMarket.Equals(TradingMarket.ChinaInterBank))
                    {
                        dayCount = new ModifiedAfb();
                    }
                    var timeToMaturity = dayCount.CalcDayCountFraction(valueDate, cashflows.Last().PaymentDate,
                                                                       remainingCfs.First().RefStartDate, remainingCfs.First().RefEndDate);
                    left = -1.0 / timeToMaturity + 1e-6;
                }
                else
                {
                    left = -1.0 * frequency.CountPerYear() + 1e-6;
                }
                var fcn = new SolveYtm(cashflows, dayCount, frequency, startDate, valueDate, fullPrice, tradingMarket, irregularPayment, this);
                //adjust left to avoid NaN
                var fLeft = fcn.F(left);
                var delta = 0.01;
                while (double.IsNaN(fLeft))
                {
                    var temp = fcn.F(left + delta);
                    if (temp < 0.0)
                    {
                        break;
                    }
                    fLeft = temp;
                    left += delta;
                }
                return(BrentZero.Solve(fcn, left, 1000000, 1e-12));
            }
            catch (Exception ex)
            {
                throw new PricingBaseException("Bond yield does not converge " + ex.GetDetail());
            }
        }
Exemple #13
0
        public DupireLocalVol(Date valuationDate, InterpolatedImpliedVolSurface impliedVol)
        {
            ValuationDate = valuationDate;
            ImpliedVol    = impliedVol;
            TimeBump      = new BumpingStrategy(2.74e-3, 2.74e-3, false);
            PriceBump     = new BumpingStrategy(1e-4, 1e-4, true);

            _dayCount    = new Act360();
            _minLocalVol = 0.05;
            _maxLocalVol = 2.0;
        }
Exemple #14
0
        public static List <Dictionary <Date, List <double> > > GeneratePathND(
            IStochasticProcessNd process,
            double[] x0,
            Date startDate,
            Date[] obsDates,
            ICalendar calendar,
            IDayCount basis,
            Random random)
        {
            var currentX = x0.ToList();

            var results = new List <Dictionary <Date, List <double> > > [2]
                          .Select(x => new Dictionary <Date, List <double> >())
                          .ToList();

            var normalRandomSamples = new List <List <double> >();

            for (var i = 0; i < obsDates.Length; ++i)             // i for each market
            {
                normalRandomSamples.Add(GetRandomSamples(random, process.Size));
            }

            //original path
            obsDates = obsDates.Where(x => x > startDate).ToArray();
            results[0][startDate] = currentX;
            var currentT = 0.0;

            for (var i = 0; i < obsDates.Count(); i++)
            {
                var dt = basis.CalcDayCountFraction(startDate, obsDates[i]);
                currentX  = process.Evolve(currentT, currentX, dt, normalRandomSamples[i]);
                currentT += dt;
                results[0][obsDates[i]] = currentX;
                startDate = obsDates[i];
            }

            //antithetic path
            obsDates = obsDates.Where(x => x > startDate).ToArray();
            results[1][startDate] = currentX;
            currentT = 0.0;

            for (var i = 0; i < obsDates.Count(); i++)
            {
                var dt = basis.CalcDayCountFraction(startDate, obsDates[i]);
                currentX  = process.Evolve(currentT, currentX, dt, normalRandomSamples[i].Select(x => - x).ToList());
                currentT += dt;
                results[1][obsDates[i]] = currentX;
                startDate = obsDates[i];
            }

            return(results);
        }
Exemple #15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="startDate">开始日</param>
 /// <param name="maturityDate">到期日</param>
 /// <param name="exercise">行权方式</param>
 /// <param name="optionType">看涨看跌</param>
 /// <param name="strike">行权价</param>
 /// <param name="rebate">敲出补偿收益</param>
 /// <param name="coupon">敲出额外收益</param>
 /// <param name="participationRate">名义本金有效比例</param>
 /// <param name="barrierType">障碍类型</param>
 /// <param name="lowerBarrier">障碍价格下限</param>
 /// <param name="upperBarrier">障碍价格上限</param>
 /// <param name="isDiscreteMonitored">是否离散观察</param>
 /// <param name="underlyingType">标的资产类型</param>
 /// <param name="calendar">交易日历</param>
 /// <param name="dayCount">日期规则</param>
 /// <param name="payoffCcy">收益计算币种</param>
 /// <param name="settlementCcy">结算币种</param>
 /// <param name="exerciseDates">行权日</param>
 /// <param name="observationDates">观察日</param>
 /// <param name="fixings">观察价格序列</param>
 /// <param name="notional">名义本金</param>
 /// <param name="settlementGap">结算日规则</param>
 /// <param name="optionPremiumPaymentDate">权利金支付日</param>
 /// <param name="optionPremium">权利金</param>
 /// <param name="isMoneynessOption">是否为相对行权价期权</param>
 /// <param name="initialSpotPrice">标的资产期初价格</param>
 /// <param name="dividends">标的资产分红</param>
 /// <param name="position">持仓方向</param>
 /// <param name="barrierShift">障碍价格偏移</param>
 /// <param name="barrierStatus">敲入敲出状态</param>
 /// <param name="hasNightMarket">标的资产是否有夜盘交易</param>
 /// <param name="commodityFuturesPreciseTimeMode">是否启用精确时间模式</param>
 public BarrierOption(Date startDate,
                      Date maturityDate,
                      OptionExercise exercise,
                      OptionType optionType,
                      double strike,
                      double rebate,
                      double coupon,
                      double participationRate,
                      BarrierType barrierType,
                      double lowerBarrier,
                      double upperBarrier,
                      bool isDiscreteMonitored,
                      InstrumentType underlyingType,
                      ICalendar calendar,
                      IDayCount dayCount,
                      CurrencyCode payoffCcy,
                      CurrencyCode settlementCcy,
                      Date[] exerciseDates,
                      Date[] observationDates,
                      Dictionary <Date, double> fixings,
                      double notional                      = 1,
                      DayGap settlementGap                 = null,
                      Date optionPremiumPaymentDate        = null,
                      double optionPremium                 = 0,
                      bool isMoneynessOption               = false,
                      double initialSpotPrice              = 0.0,
                      Dictionary <Date, double> dividends  = null,
                      Position position                    = Position.Buy,
                      double barrierShift                  = 0.0,
                      BarrierStatus barrierStatus          = BarrierStatus.Monitoring,
                      bool hasNightMarket                  = false,
                      bool commodityFuturesPreciseTimeMode = false
                      )
     : base(startDate, maturityDate, exercise, optionType, new double[] { strike }, underlyingType, calendar, dayCount,
            payoffCcy, settlementCcy, exerciseDates, observationDates, notional, settlementGap,
            optionPremiumPaymentDate, optionPremium,
            isMoneynessOption: isMoneynessOption, initialSpotPrice: initialSpotPrice, dividends: dividends, hasNightMarket: hasNightMarket,
            commodityFuturesPreciseTimeMode: commodityFuturesPreciseTimeMode)
 {
     Rebate              = rebate;
     Coupon              = coupon;
     ParticipationRate   = participationRate;
     BarrierType         = barrierType;
     Barrier             = lowerBarrier;
     IsDiscreteMonitored = isDiscreteMonitored;
     UpperBarrier        = upperBarrier;
     Fixings             = fixings;
     Position            = position;
     BarrierShift        = barrierShift;
     BarrierStatus       = barrierStatus;
 }
        private void GetExercisePrices(ConvertibleBond convertibleBond,
                                       IMarketCondition market,
                                       IDayCount dayCount,
                                       Date valueDate,
                                       double dt,
                                       VanillaOption[] options,
                                       PriceQuoteType[] optionStrikeType,
                                       out double[] callExercisePrices,
                                       out double[] putExercisePrices
                                       )
        {
            var infinity = 1.0e20;

            callExercisePrices = Enumerable.Range(0, _steps + 1).Select(x => infinity).ToArray();
            putExercisePrices  = Enumerable.Range(0, _steps + 1).Select(x => - infinity).ToArray();
            if (options == null)
            {
                return;
            }

            for (var i = 0; i < options.Length; ++i)
            {
                var option   = options[i];
                var start    = option.ExerciseDates.First();
                var end      = option.ExerciseDates.Last();
                var startInd = start <= valueDate ? 0 : (int)Math.Round(dayCount.CalcDayCountFraction(valueDate, start) / dt);
                var endInd   = start >= convertibleBond.UnderlyingMaturityDate ? _steps : (int)Math.Round(dayCount.CalcDayCountFraction(valueDate, end) / dt);
                for (var j = startInd; j <= endInd; ++j)
                {
                    if (option.OptionType == OptionType.Call)
                    {
                        callExercisePrices[j] = option.Strike;
                        if (optionStrikeType[i] == PriceQuoteType.Clean)
                        {
                            var date = new Term(j * dt, Period.Year).Next(valueDate);
                            callExercisePrices[j] += convertibleBond.GetAccruedInterest(date, market);
                        }
                    }
                    else
                    {
                        putExercisePrices[j] = option.Strike;
                        if (optionStrikeType[i] == PriceQuoteType.Clean)
                        {
                            var date = new Term(j * dt, Period.Year).Next(valueDate);
                            putExercisePrices[j] += convertibleBond.GetAccruedInterest(date, market);
                        }
                    }
                }
            }
        }
Exemple #17
0
        public SwapLeg(Date startDate,
                       Date maturityDate,
                       double notional,
                       bool notionalExchange,
                       CurrencyCode currency,
                       ICoupon coupon,
                       ICalendar calendar,
                       Frequency paymentFreq,
                       Stub paymentStub,
                       IDayCount dayCount,
                       BusinessDayConvention paymentBda,
                       DayGap settlementGap   = null,
                       Date firstPaymenetDate = null,
                       Date terminationDate   = null,
                       double terminateAmount = double.NaN
                       )
        {
            StartDate = startDate;
            UnderlyingMaturityDate = maturityDate;
            Notional          = notional;
            NotionalExchange  = notionalExchange;
            Currency          = currency;
            Coupon            = coupon;
            Calendar          = calendar;
            PaymentFreq       = paymentFreq;
            PaymentStub       = paymentStub;
            DayCount          = dayCount;
            PaymentBda        = paymentBda;
            SettlmentGap      = settlementGap ?? new DayGap("+0BD");
            FirstPaymentDate  = firstPaymenetDate;
            TerminationDate   = terminationDate;
            TerminationAmount = terminateAmount;

            if (FirstPaymentDate != null)
            {
                var temp = new Schedule(FirstPaymentDate, UnderlyingMaturityDate, PaymentFreq.GetTerm(), PaymentStub, Calendar, PaymentBda);
                Accruals = new Schedule(new[] { StartDate }.Union(temp));
            }
            else
            {
                Accruals = new Schedule(StartDate, UnderlyingMaturityDate, PaymentFreq.GetTerm(), PaymentStub, Calendar, PaymentBda);
            }

            if (TerminationDate != null)
            {
                Accruals = new Schedule(Accruals.Where(x => x < TerminationDate));
            }

            PaymentSchedule = new Schedule(Accruals.Skip(1));
        }
Exemple #18
0
            public BlackScholeCalculator(OptionType optionType,
                                         BinaryOptionPayoffType binaryOptionPayoffType,
                                         double strike,
                                         double spotPrice,
                                         double sigma,
                                         double dividendRate,
                                         double riskfreeRateAtExercise,
                                         double riskfreeRateAtMaturity,
                                         IDayCount curveDayCount,
                                         double cashOrNothingAmount,
                                         Date exerciseDate,
                                         Date maturityDate,
                                         Date valuationDate,
                                         IOption trade,
                                         InstrumentType underlyingInstrumentType,
                                         double notional               = 1.0,
                                         bool isDelayedPay             = false,
                                         double expiryDayRemainingLife = double.NaN,
                                         double timeIncrement          = 0.0)
            {
                _underlyingInstrumentType = underlyingInstrumentType;
                _isOptionOnFutures        = AnalyticalOptionPricerUtil.isFuturesOption(underlyingInstrumentType);
                _isOptionOnForward        = AnalyticalOptionPricerUtil.isForwardOption(underlyingInstrumentType);

                _optionType             = optionType;
                _binaryOptionPayoffType = binaryOptionPayoffType;
                _strike              = strike;
                _spotPrice           = spotPrice;
                _notional            = notional;
                _cashOrNothingAmount = cashOrNothingAmount;
                _sigma = sigma;

                _dividendRate           = dividendRate;
                _riskfreeRateAtExercise = riskfreeRateAtExercise;
                _riskfreeRateAtMaturity = riskfreeRateAtMaturity;

                _exerciseDate  = exerciseDate;
                _maturityDate  = maturityDate;
                _valuationDate = valuationDate;

                _trade = trade;

                _isDelayedPay           = isDelayedPay;
                _rfDfExerciseToMaturity = riskfreeRateAtMaturity / riskfreeRateAtExercise;

                _expiryDayRemainingLife = expiryDayRemainingLife;
                _timeIncrement          = timeIncrement;
                _curveDayCount          = curveDayCount;
            }
 public static double forwardPrice(bool isFwdFuturesOption, double spotPrice,
                                   double riskfreeDfAtExercise,
                                   double dividendRate,
                                   Date exerciseDate, Date valuationDate, IDayCount dayCount)
 {
     if (isFwdFuturesOption)
     {
         return(spotPrice);
     }
     else
     {
         return(spotPrice *
                Compound.Continuous.CalcDfFromZeroRate(dividendRate, dayCount.CalcDayCountFraction(valuationDate, exerciseDate))
                / riskfreeDfAtExercise);
     }
 }
Exemple #20
0
        public ImpliedVolSurface(Date valuationDate, Date[] dates, double[] strikes, double[,] values, Interpolation2D interp, String dcConvention = "Bus244", VolSurfaceType volSurfaceType = VolSurfaceType.StrikeVol)
            : base(dates, strikes, values, x => x.ToOADate(), x => x, interp)
        {
            _valuationDate = valuationDate;
            _interp        = interp;
            _surfType      = volSurfaceType;
            _dcConvention  = dcConvention;
            _dc            = dcConvention.ToDayCountImpl();

            if ((dates as ICollection <Date>).Count != values.GetLength(0) || (strikes as ICollection <double>).Count != values.GetLength(1))
            {
                throw new PricingLibraryException(string.Format("Size error for the implied volatility surface defintion"));
            }

            double[] maturityFractions = dates.Select((v, i) => _dc.CalcDayCountFraction(valuationDate, v)).ToArray();
            _interpolator = _interp.GetInterpolator(maturityFractions, strikes.Select((v, i) => v).ToArray(), ValueOnGrids);
        }
Exemple #21
0
 public FxOption(Date startDate,
                 Date maturityDate,
                 OptionExercise exercise,
                 OptionType optionType,
                 double strikeFxRate,
                 InstrumentType underlyingType,
                 ICalendar domCalendar,
                 CurrencyCode domCcy,
                 ICalendar fgnCalendar,
                 CurrencyCode fgnCcy,
                 IDayCount dayCount,
                 CurrencyCode payoffCcy,
                 CurrencyCode settlementCcy,
                 Date[] exerciseDates,
                 Date[] observationDates,
                 DayGap underlyingFxSpotSettlement,
                 double notionalInFgnCcy       = 1,
                 DayGap settlementGap          = null,
                 Date optionPremiumPaymentDate = null,
                 double optionPremium          = 0,
                 bool hasNightMarket           = false)
     : base(
         startDate: startDate,
         maturityDate: maturityDate,
         exercise: exercise,
         optionType: optionType,
         strike: new double[] { strikeFxRate },
         underlyingTickers: new string[] { "fgnCcy:domCcy" },
         underlyingInstrumentType: underlyingType,
         calendar: domCalendar,
         dayCount: dayCount,
         payoffCcy: payoffCcy,
         settlementCcy: settlementCcy,
         exerciseDates: exerciseDates,
         observationDates: observationDates,
         notional: notionalInFgnCcy,
         settlementGap: settlementGap,
         optionPremiumPaymentDate: optionPremiumPaymentDate,
         optionPremium: optionPremium,
         hasNightMarket: hasNightMarket)
 {
     FgnCalendar = fgnCalendar;
     FgnCcy      = fgnCcy;
     DomCcy      = domCcy;
     UnderlyingFxSpotSettlement = underlyingFxSpotSettlement;
 }
Exemple #22
0
        public BlackScholeCalculator(OptionType optionType,
                                     double strike,
                                     double spotPrice,
                                     double sigma,
                                     double riskfreeRateAtExercise,
                                     double riskfreeRateAtMaturity,
                                     IDayCount curveDayCount,
                                     double dividendRate,
                                     Date maturityDate,
                                     Date exerciseDate,
                                     Date valuationDate,
                                     IOption trade,
                                     InstrumentType underlyingInstrumentType,
                                     double notional,
                                     double expiryDayRemainingLife,
                                     double timeIncrement = 0.0)
        {
            _underlyingInstrumentType = underlyingInstrumentType;
            _isOptionOnFutures        = AnalyticalOptionPricerUtil.isFuturesOption(underlyingInstrumentType);
            _isOptionOnForward        = AnalyticalOptionPricerUtil.isForwardOption(underlyingInstrumentType);

            _optionType             = optionType;
            _strike                 = strike;
            _spotPrice              = spotPrice;
            _notional               = notional;
            _sigma                  = sigma;
            _riskfreeRateAtMaturity = riskfreeRateAtMaturity;
            _riskfreeRateAtExercise = riskfreeRateAtExercise;
            _dividendRate           = dividendRate;

            _trade         = trade;
            _maturityDate  = maturityDate;
            _exerciseDate  = exerciseDate;
            _valuationDate = valuationDate;

            _riskfreeDfAtExercise = CalcDfFromZeroRate(_riskfreeRateAtExercise, _exerciseDate, _valuationDate);
            _riskfreeDfAtMaturity = CalcDfFromZeroRate(_riskfreeRateAtMaturity, _maturityDate, _valuationDate);

            //just a internal indicator
            _isDelayedPay = maturityDate.CompareTo(_exerciseDate) > 0;

            _expiryDayRemainingLife = expiryDayRemainingLife;
            _timeIncrement          = timeIncrement;
            _curveDayCount          = curveDayCount;
        }
Exemple #23
0
        //internal use + keyPoint manipulation, i.e. solving zspread
        //Note: this api will bypass curve calibration
        public YieldCurve(
            string name,
            Date referenceDate,
            Tuple <Date, double>[] keyPoints,
            BusinessDayConvention bda,
            IDayCount dayCount,
            ICalendar calendar,
            CurrencyCode currency,
            Compound compound,
            Interpolation interpolation,
            YieldCurveTrait trait,
            IMarketCondition baseMarket = null,
            Expression <Func <IMarketCondition, object> >[] calibrateMktUpdateCondition = null,
            ISpread spread     = null,
            string[] keyTenors = null,
            InstrumentCurveDefinition rawDefinition = null
            )
        {
            Name          = name;
            ReferenceDate = referenceDate;
            Currency      = currency;
            Bda           = bda;
            DayCount      = dayCount;
            Compound      = compound;
            Calendar      = calendar;
            Interpolation = interpolation;
            Trait         = trait;
            BaseMarket    = baseMarket;
            Spread        = spread ?? new ZeroSpread(0.0);
            CalibrateMktUpdateCondition = calibrateMktUpdateCondition;
            MarketInstruments           = null;
            KeyPoints     = keyPoints.OrderBy(x => x.Item1).ToArray();
            KeyTenors     = keyTenors ?? KeyPoints.Select(x => new Term(x.Item1 - ReferenceDate, Period.Day)).Select(x => x.ToString()).ToArray();
            RawDefinition = rawDefinition;

            InputRateByTenor = KeyPoints.Select(x => Tuple.Create <string, double> (new Term(x.Item1 - ReferenceDate, Period.Day).ToString(), x.Item2)).
                               ToDictionary(v => v.Item1, v => v.Item2);

            //_curve = new Curve<Date>(ReferenceDate, KeyPoints, x => x.ToOADate(), interpolation);
            _curveXInYears = new Curve <double>(0.0,
                                                KeyPoints.Select(x => Tuple.Create(DayCount.CalcDayCountFraction(ReferenceDate, x.Item1), x.Item2)).ToArray(),
                                                x => x,
                                                Interpolation);
        }
 public DoubleSharkFinOption(Date startDate,
                             Date maturityDate,
                             OptionExercise exercise,
                             OptionType optionType,
                             double strike,
                             InstrumentType underlyingInstrumentType,
                             ICalendar calendar,
                             IDayCount dayCount,
                             CurrencyCode payoffCcy,
                             CurrencyCode settlementCcy,
                             Date[] exerciseDates,
                             Date[] observationDates,
                             double notional               = 1,
                             DayGap settlementGap          = null,
                             Date optionPremiumPaymentDate = null,
                             double optionPremium          = 0)
     : base(startDate, maturityDate, exercise, optionType, new double[] { strike }, underlyingInstrumentType, calendar, dayCount, payoffCcy, settlementCcy, exerciseDates, observationDates, notional, settlementGap, optionPremiumPaymentDate, optionPremium)
 {
 }
 public SolveYtm(Cashflow[] cashflows,
                 IDayCount dayCount,
                 Frequency frequency,
                 Date startDate,
                 Date valueDate,
                 double fullPrice,
                 TradingMarket tradeingMarket,
                 bool irregularPayment,
                 IBondYieldPricer bondYieldPricer = null)
 {
     _cashflows        = cashflows;
     _dayCount         = dayCount;
     _frequency        = frequency;
     _startDate        = startDate;
     _valueDate        = valueDate;
     _fullPrice        = fullPrice;
     _tradeingMarket   = tradeingMarket;
     _irregularPayment = irregularPayment;
     _bondYieldPricer  = bondYieldPricer ?? new BondYieldPricer();
 }
Exemple #26
0
        public double GetMacDuration(Cashflow[] cashflows,
                                     IDayCount dayCount,
                                     Frequency frequency,
                                     Date startDate,
                                     Date valueDate,
                                     double yield,
                                     TradingMarket tradingMarket)
        {
            var remainingCfs = cashflows.Where(x => x.PaymentDate > valueDate).ToList();

            if (!remainingCfs.Any())
            {
                return(0.0);
            }

            if (remainingCfs.Count == 1)
            {
                if (tradingMarket.Equals(TradingMarket.ChinaInterBank))
                {
                    dayCount = new ModifiedAfb();
                }
                return(dayCount.CalcDayCountFraction(valueDate, remainingCfs[0].PaymentDate, remainingCfs.First().RefStartDate, remainingCfs.First().RefEndDate));
            }

            var npv             = 0.0;
            var timeWeightedNpv = 0.0;
            var df     = 1.0;
            var freq   = frequency.CountPerYear();
            var totalT = 0.0;

            foreach (var remainingCf in remainingCfs)
            {
                var dt = dayCount.CalcDayCountFraction(valueDate, remainingCf.PaymentDate, remainingCf.RefStartDate, remainingCf.RefEndDate);
                df              *= 1.0 / Math.Pow(1 + yield / freq, freq * dt);
                npv             += remainingCf.PaymentAmount * df;
                totalT          += dt;
                timeWeightedNpv += remainingCf.PaymentAmount * df * totalT;
                valueDate        = remainingCf.PaymentDate;
            }
            return(timeWeightedNpv / npv);
        }
        public static double GetModifiedDuration(Cashflow[] cashflows,
                                                 IDayCount dayCount,
                                                 Frequency frequency,
                                                 Date startDate,
                                                 Date valueDate,
                                                 double yield,
                                                 TradingMarket tradeingMarket,
                                                 bool irregularPayment            = false,
                                                 IBondYieldPricer bondYieldPricer = null)
        {
            const double dy = 1e-4;

            if (bondYieldPricer == null)
            {
                bondYieldPricer = new BondYieldPricer();
            }
            var priceUp   = bondYieldPricer.FullPriceFromYield(cashflows, dayCount, frequency, startDate, valueDate, yield - dy, tradeingMarket, irregularPayment);
            var priceDown = bondYieldPricer.FullPriceFromYield(cashflows, dayCount, frequency, startDate, valueDate, yield + dy, tradeingMarket, irregularPayment);

            return((priceUp - priceDown) / dy / (priceDown + priceUp));
        }
Exemple #28
0
        public Loan(Date startDate,
                    Date maturityDate,
                    Date firstPaymentDate,
                    double notional,
                    int numOfPayment,
                    IDayCount dayCount,
                    Frequency frequency,
                    double coupon,
                    Date resetDate,
                    bool isFloatingRate,
                    IndexType indexType,
                    double floatingRateMultiplier,
                    AmortizationType amortizationType,
                    CurrencyCode currency = CurrencyCode.CNY,
                    IMortgageCalculator mortgageCalculator = null,
                    double taxRate = 0.0
                    )
        {
            StartDate = startDate;
            UnderlyingMaturityDate = maturityDate;
            FirstPaymentDate       = firstPaymentDate;
            NumOfPayment           = numOfPayment;
            Notional               = notional;
            DayCount               = dayCount;
            Frequency              = frequency;
            Coupon                 = coupon;
            TaxRate                = taxRate;
            ResetDate              = resetDate;
            IsFloatingRate         = isFloatingRate;
            IndexType              = indexType;
            FloatingRateMultiplier = floatingRateMultiplier;
            Currency               = currency;
            _implicitAccStartDate  = Frequency.GetTerm().Prev(FirstPaymentDate);
            AmortizationType       = amortizationType;
            MortgageCalculator     = mortgageCalculator ?? new SimpleMortgageCalculator(new Psa(), new Sda());

            Accruals        = new Schedule(_implicitAccStartDate, UnderlyingMaturityDate, Frequency.GetTerm(), Stub.ShortEnd).ToArray();
            _numPastPayment = NumOfPayment - (Accruals.Length - 1);
        }
Exemple #29
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="startDate">开始日</param>
 /// <param name="maturityDate">到期日</param>
 /// <param name="exercise">行权方式</param>
 /// <param name="optionType">看涨看跌</param>
 /// <param name="strike">行权价</param>
 /// <param name="underlyingProductType">标的资产类型</param>
 /// <param name="binaryOptionPayoffType">二元期权收益类型</param>
 /// <param name="cashOrNothingAmount">现金金额</param>
 /// <param name="calendar">交易日历</param>
 /// <param name="dayCount">日期规则</param>
 /// <param name="payoffCcy">收益计算币种</param>
 /// <param name="settlementCcy">结算币种</param>
 /// <param name="exerciseDates">行权日</param>
 /// <param name="observationDates">观察日</param>
 /// <param name="notional">名义本金</param>
 /// <param name="settlementGap">结算日规则</param>
 /// <param name="optionPremiumPaymentDate">权利金支付日</param>
 /// <param name="optionPremium">权利金</param>
 /// <param name="isMoneynessOption">是否为相对行权价期权</param>
 /// <param name="initialSpotPrice">标的资产期初价格</param>
 /// <param name="dividends">标的资产分红</param>
 /// <param name="binaryRebateType">二元期权补偿方式</param>
 /// <param name="hasNightMarket">标的资产是否有夜盘交易</param>
 /// <param name="commodityFuturesPreciseTimeMode">是否启用精确时间模式</param>
 public BinaryOption(Date startDate,
                     Date maturityDate,
                     OptionExercise exercise,
                     OptionType optionType,
                     double strike,
                     InstrumentType underlyingProductType,
                     BinaryOptionPayoffType binaryOptionPayoffType,
                     double cashOrNothingAmount,
                     ICalendar calendar,
                     IDayCount dayCount,
                     CurrencyCode payoffCcy,
                     CurrencyCode settlementCcy,
                     Date[] exerciseDates,
                     Date[] observationDates,
                     double notional                      = 1,
                     DayGap settlementGap                 = null,
                     Date optionPremiumPaymentDate        = null,
                     double optionPremium                 = 0,
                     bool isMoneynessOption               = false,
                     double initialSpotPrice              = 0.0,
                     Dictionary <Date, double> dividends  = null,
                     BinaryRebateType binaryRebateType    = BinaryRebateType.AtHit,
                     bool hasNightMarket                  = false,
                     bool commodityFuturesPreciseTimeMode = false)
     : base(startDate, maturityDate, exercise, optionType, new double[] { strike }, underlyingProductType, calendar, dayCount,
            payoffCcy, settlementCcy, exerciseDates, observationDates, notional, settlementGap,
            optionPremiumPaymentDate, optionPremium,
            isMoneynessOption: isMoneynessOption, initialSpotPrice: initialSpotPrice, dividends: dividends, hasNightMarket: hasNightMarket,
            commodityFuturesPreciseTimeMode: commodityFuturesPreciseTimeMode)
 {
     if (exercise == OptionExercise.European && ExerciseDates.Length != 1)
     {
         throw new PricingLibraryException("Binary option cannot have more than 1 exercise dates!");
     }
     BinaryOptionPayoffType = binaryOptionPayoffType;
     CashOrNothingAmount    = cashOrNothingAmount;
     BinaryRebateType       = binaryRebateType;
 }
Exemple #30
0
 public RangeAccrual(Date startDate,
                     Date maturityDate,
                     OptionExercise exercise,
                     OptionType optionType,
                     double strike,
                     RangeDefinition[] ranges,
                     InstrumentType underlyingInstrumentType,
                     ICalendar calendar,
                     IDayCount dayCount,
                     CurrencyCode payoffCcy,
                     CurrencyCode settlementCcy,
                     Date[] exerciseDates,
                     Date[] observationDates,
                     Dictionary <Date, double> fixings,
                     double notional               = 1,
                     DayGap settlementGap          = null,
                     Date optionPremiumPaymentDate = null,
                     double optionPremium          = 0)
     : base(startDate, maturityDate, exercise, optionType, new double[] { strike }, underlyingInstrumentType, calendar, dayCount, payoffCcy, settlementCcy, exerciseDates, observationDates, notional, settlementGap, optionPremiumPaymentDate, optionPremium)
 {
     Ranges  = ranges;
     Fixings = fixings;
 }