public static Decimal CalculateStrikeDelta(bool isCall, decimal swapBreakEvenRate, decimal strike, double timeToExpiry, double timeToIndex, IVolatilitySurface indexVolSurface)
        {
            var volatility = (decimal)indexVolSurface.GetValue(timeToIndex, (double)strike);
            var result     = OptionAnalytics.OptWithGreeks(isCall, (double)swapBreakEvenRate, (double)strike, (double)volatility, timeToExpiry)[6];

            return((decimal)result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This assumes that the rest dates are consistent with the curve.
        /// </summary>
        /// <param name="valuationDate"></param>
        /// <param name="paymentDate">The payment date. The same rest period is assumed as with the spot date.</param>
        /// <param name="indexCurve">The index curve should be already in the correct form for the fx.</param>
        /// <param name="currency2">Normally the foreign rate curve.</param>
        /// <param name="currency2PerCurrency1">The currency2PerCurrency1 flag. </param>
        /// <param name="currency1">Normally the domestic rate curve. </param>
        /// <param name="indexVolatilitySurface">The index volatility surface. </param>
        /// <param name="expiryTime">The expiry time. </param>
        /// <param name="timeToIndex">The time to reset or expiry. </param>
        /// <param name="strike">The strike. </param>
        /// <param name="fxOptionType">The option type. </param>
        public FxOptionLegAnalytic(DateTime valuationDate, DateTime paymentDate, IFxCurve indexCurve, IRateCurve currency1, IRateCurve currency2,
                                   bool currency2PerCurrency1, decimal strike, decimal expiryTime, decimal timeToIndex, IVolatilitySurface indexVolatilitySurface, FxOptionType fxOptionType)
        {
            //ToReportingCurrencyRate = EvaluateReportingCurrencyFxRate(valuationDate, reportingCurrencyFxCurve);
            var todayRate = indexCurve.GetForward(valuationDate, valuationDate); //TODO The spot rate may not be the same due to the carry effect, but the evolution works.
            var df1       = currency1.GetDiscountFactor(valuationDate, paymentDate);
            var df2       = currency2.GetDiscountFactor(valuationDate, paymentDate);
            var forward   = df1 / df2;

            if (!currency2PerCurrency1)
            {
                forward = df2 / df1;
            }
            ForwardFxRate = (decimal)(todayRate * forward);
            OptionType    = fxOptionType;
            Strikes       = new List <decimal> {
                strike
            };
            ExpiryTimes = new List <decimal> {
                expiryTime
            };
            TimeToIndices = new List <decimal> {
                timeToIndex
            };
            Volatilities = new List <decimal> {
                (decimal)indexVolatilitySurface.GetValue((double)timeToIndex, (double)strike)
            };
        }
 /// <summary>
 /// Initiates a new model.
 /// </summary>
 /// <param name="valuationDate">The valuation date.</param>
 /// <param name="startDate">The start date of the coupon.</param>
 /// <param name="endDate">The end date of the coupon.</param>
 /// <param name="paymentDate">The payment date of the cash flow.</param>
 /// <param name="timeToIndex">The timeToIndex. Not necessarily the time to expiry. This is used for surface interpolation..</param>
 /// <param name="capStrike">The cap strike.</param>
 /// <param name="floorStrike">The floor strike.</param>
 /// <param name="reportingCurrencyFxCurve">THe fx curve. It must already be normalised.</param>
 /// <param name="discountCurve">The rate curve to use for discounting.</param>
 /// <param name="forecastCurve">The forecast curve.</param>
 /// <param name="indexVolSurface">The index volatility surface.</param>
 public RateOptionCouponAnalytic(DateTime valuationDate, DateTime startDate, DateTime endDate, DateTime paymentDate,
                                 decimal timeToIndex, decimal capStrike, decimal floorStrike, IFxCurve reportingCurrencyFxCurve, IRateCurve discountCurve, IRateCurve forecastCurve, IVolatilitySurface indexVolSurface)
     : this(valuationDate, startDate, endDate, paymentDate, timeToIndex, capStrike, reportingCurrencyFxCurve, discountCurve, forecastCurve, indexVolSurface)
 {
     IsCollar              = true;
     CollarFloorStrike     = floorStrike;
     CollarFloorVolatility = (decimal)indexVolSurface.GetValue((double)timeToIndex, (double)floorStrike);
 }
 /// <summary>
 /// Initiates a new model.
 /// </summary>
 /// <param name="valuationDate">The valuation date.</param>
 /// <param name="startDate">The start date of the coupon.</param>
 /// <param name="endDate">The end date of the coupon.</param>
 /// <param name="paymentDate">The payment date of the cash flow.</param>
 /// <param name="timeToIndex">The timeToIndex. Not necessarily the time to expiry. This is used for surface interpolation..</param>
 /// <param name="strike">The strike.</param>
 /// <param name="reportingCurrencyFxCurve">THe fx curve. It must already be normalised.</param>
 /// <param name="discountCurve">The rate curve to use for discounting.</param>
 /// <param name="forecastCurve">The forecast curve.</param>
 /// <param name="indexVolSurface">The index volatility surface.</param>
 public RateOptionCouponAnalytic(DateTime valuationDate, DateTime startDate, DateTime endDate, DateTime paymentDate,
                                 decimal timeToIndex, decimal strike, IFxCurve reportingCurrencyFxCurve, IRateCurve discountCurve, IRateCurve forecastCurve, IVolatilitySurface indexVolSurface)
     : base(valuationDate, startDate, endDate, paymentDate, reportingCurrencyFxCurve, discountCurve, forecastCurve)
 {
     Strike      = strike;
     TimeToIndex = timeToIndex;
     Volatility  = (decimal)indexVolSurface.GetValue((double)timeToIndex, (double)strike);
 }
 ///// <param name="isCall">The isCall flag. If [true] then the the option is a call.</param>
 ///// <param name="rate">The rate.</param>
 ///// <param name="timeToExpiry">The time To Expiry.</param>
 /// <summary>
 /// Initiates a new model.
 /// </summary>
 /// <param name="valuationDate">The valuation date.</param>
 /// <param name="timeToIndex">The timeToIndex. Not necessarily the time to expiry. This is used for surface interpolation..</param>
 /// <param name="strike">The strike.</param>
 /// <param name="reportingCurrencyFxCurve">THe fx curve. It must already be normalised.</param>
 /// <param name="indexVolSurface">THe volatility surface to use. </param>
 ///// <param name="discountCurve">The rate curve to use for discounting.</param>
 public SimpleIRSwaptionInstrumentAnalytic(DateTime valuationDate,                                                //DateTime paymentDate, bool isCall,
                                           decimal timeToIndex, decimal strike,
                                                                                                                  //decimal timeToExpiry, decimal rate,
                                           IFxCurve reportingCurrencyFxCurve, IVolatilitySurface indexVolSurface) //IRateCurve discountCurve, /// <param name="paymentDate">The payment date of the cash flow.</param>
 {
     ToReportingCurrencyRate = EvaluateReportingCurrencyFxRate(valuationDate, reportingCurrencyFxCurve);
     TimeToIndex             = timeToIndex;
     Strike     = strike;
     Volatility = (decimal)indexVolSurface.GetValue((double)timeToIndex, (double)strike);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Intantiates a new model.
 /// </summary>
 /// <param name="valuationDate">The valuation date.</param>
 /// <param name="paymentDate">The payment date of the cash flow.</param>
 /// <param name="reportingCurrencyFxCurve">THe fx curve. It must already be normalised.</param>
 /// <param name="indexCurve">The rate curve to use for calculating the forward index.</param>
 /// <param name="discountCurve">The rate curve to use for discounting.</param>
 /// <param name="indexVolSurface">The index volatility surface.</param>
 /// <param name="expiryTime">The expiry time. </param>
 /// <param name="timeToIndex">The time to reset or expiry. </param>
 /// <param name="strike">The strike. </param>
 /// <param name="fxOptionType">The option type. </param>
 public FxOptionAnalytic(DateTime valuationDate, DateTime paymentDate, decimal strike, decimal expiryTime, decimal timeToIndex,
                         IFxCurve reportingCurrencyFxCurve, ICurve indexCurve, IRateCurve discountCurve, IVolatilitySurface indexVolSurface, FxOptionType fxOptionType)
     : base(valuationDate, paymentDate, reportingCurrencyFxCurve, indexCurve, discountCurve)
 {
     OptionType = fxOptionType;
     Strikes    = new List <decimal> {
         strike
     };
     ExpiryTimes = new List <decimal> {
         expiryTime
     };
     TimeToIndices = new List <decimal> {
         timeToIndex
     };
     Volatilities = new List <decimal> {
         (decimal)indexVolSurface.GetValue((double)timeToIndex, (double)strike)
     };
 }
Exemplo n.º 7
0
 /// <summary>
 /// This assumes that the rest dates are consistent with the curve.
 /// </summary>
 /// <param name="valuationDate"></param>
 /// <param name="paymentDate"></param>
 /// <param name="indexCurve"></param>
 /// <param name="expiryTime">The expiry time. </param>
 /// <param name="timeToIndex">The time to reset or expiry. </param>
 /// <param name="strike">The strike. </param>
 /// <param name="indexVolatilitySurface">The index volatility surface. </param>
 /// <param name="fxOptionType">The option type. </param>
 public FxOptionLegAnalytic(DateTime valuationDate, DateTime paymentDate, IFxCurve indexCurve, decimal strike, decimal expiryTime, decimal timeToIndex
                            , IVolatilitySurface indexVolatilitySurface, FxOptionType fxOptionType)
 {
     //ToReportingCurrencyRate = EvaluateReportingCurrencyFxRate(valuationDate, reportingCurrencyFxCurve);
     ForwardFxRate = (decimal)indexCurve.GetForward(valuationDate, paymentDate);
     OptionType    = fxOptionType;
     Strikes       = new List <decimal> {
         strike
     };
     ExpiryTimes = new List <decimal> {
         expiryTime
     };
     TimeToIndices = new List <decimal> {
         timeToIndex
     };
     Volatilities = new List <decimal> {
         (decimal)indexVolatilitySurface.GetValue((double)timeToIndex, (double)strike)
     };
 }