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; }
/// <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; }