Ejemplo n.º 1
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)
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Evaluating the fx rate.
        /// </summary>
        /// <returns>The fx rate</returns>
        protected decimal EvaluateReportingCurrencyFxRate(DateTime valuationDate, IFxCurve fxCurve)
        {
            var result = 1.0m;

            if (fxCurve != null)
            {
                result = (decimal)fxCurve.GetForward(valuationDate, valuationDate);
            }
            return(result);
        }
Ejemplo n.º 3
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">Normaly the foreign rate curve.</param>
        /// <param name="currency2PerCurrency1">The currency2PerCurrency1 flag. </param>
        /// <param name="currency1">Normally the domestic rate curve. </param>
        public FxLegAnalytic(DateTime valuationDate, DateTime paymentDate, IFxCurve indexCurve, IRateCurve currency1, IRateCurve currency2,
                             bool currency2PerCurrency1)
        {
            //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);
        }
Ejemplo n.º 4
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)
     };
 }
Ejemplo n.º 5
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>
 public FxLegAnalytic(DateTime valuationDate, DateTime paymentDate, IFxCurve indexCurve)
 {
     //ToReportingCurrencyRate = EvaluateReportingCurrencyFxRate(valuationDate, reportingCurrencyFxCurve);
     ForwardFxRate = (decimal)indexCurve.GetForward(valuationDate, paymentDate);
 }