예제 #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)
            };
        }
예제 #2
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)
     };
 }
예제 #3
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)
     };
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PriceableVanillaFxOption"/> class.
 /// </summary>
 /// <param name="cashlfowId">The stream id.</param>
 /// <param name="startIndex">The start Index. If null then the cash flow is not a differenctial.</param>
 /// <param name="observedIndex">The observed Index. If null then the cash flow is not a differenctial. </param>
 /// <param name="isCurrency1Base">The isCurrency1Base flag. </param>
 /// <param name="currency2PayerIsBase">The currency2PayerIsBase lag.</param>
 /// <param name="isSettlementInCurrency1">The isSettlementInCurrency1 flag</param>
 /// <param name="hybridValuation">Is hybrid valuation used, or the base fa curve. </param>
 /// <param name="currency1NotionalAmount">The currency1 notional amount.</param>
 /// <param name="fixingDateRelativeOffset">The fixingDateRelativeOffset.</param>
 /// <param name="strike">The strike. </param>
 /// <param name="fxOptionType">THe option type: currently only call or pt </param>
 /// <param name="paymentDate">The payment date.</param>
 /// <param name="fixingCalendar">The fixingCalendar.</param>
 /// <param name="paymentCalendar">The paymentCalendar.</param>
 protected PriceableVanillaFxOption
 (
     string cashlfowId
     , FxRate startIndex
     , FxRate observedIndex
     , bool isCurrency1Base
     , bool currency2PayerIsBase
     , bool isSettlementInCurrency1
     , bool hybridValuation
     , Money currency1NotionalAmount
     , decimal strike
     , FxOptionType fxOptionType
     , AdjustableOrAdjustedDate paymentDate
     , RelativeDateOffset fixingDateRelativeOffset
     , IBusinessCalendar fixingCalendar
     , IBusinessCalendar paymentCalendar)
     : base
     (
         cashlfowId
         , startIndex
         , observedIndex
         , isCurrency1Base
         , currency2PayerIsBase
         , isSettlementInCurrency1
         , hybridValuation
         , currency1NotionalAmount
         , paymentDate
         , fixingDateRelativeOffset
         , fixingCalendar
         , paymentCalendar)
 {
     Strike       = strike;
     FxOptionType = FxOptionType.Call;
     if (fxOptionType != FxOptionType.Call)//TODO Only call or put.
     {
         FxOptionType = FxOptionType.Put;
     }
     VolatilitySurfaceName = CurveNameHelpers.GetFxVolatilityMatrixName(startIndex, "FxSpot");
     ModelIdentifier       = "VanillaFxOptionModel";
 }