/// <summary>
 /// Initializes a new instance of the <see cref="DeterministicCreditWithFXJump"/> class.
 /// </summary>
 /// <param name="survivalProbSource">A curve that provides survival probabilities.  Usually a hazard curve.</param>
 /// <param name="ccyPair">The other currency required in the simulation.  The valuation currency will
 /// be inferred from the <paramref name="valueCurrencyDiscount"/>.  This value needs to be explicitly set
 /// since <paramref name="fxSource"/> may provide multiple pairs.</param>
 /// <param name="fxSource">The source FX spot and forwards.</param>
 /// <param name="valueCurrencyDiscount">The value currency discount curve.</param>
 /// <param name="fxVol">The FX volatility.</param>
 /// <param name="relJumpSizeInDefault">The relative jump size in default.  For example if the value currency is ZAR and the
 /// other currency is USD then the FX is modeled as ZAR per USD and in default the FX rate will change to:
 /// rate before default * (1 + relJumpSizeInDefault).</param>
 /// <param name="expectedRecoveryRate">The constant recovery rate that will be assumed to apply in default.</param>
 public DeterministicCreditWithFXJump(SurvivalProbabilitySource survivalProbSource,
                                      CurrencyPair ccyPair, IFXSource fxSource, IDiscountingSource valueCurrencyDiscount,
                                      double fxVol, double relJumpSizeInDefault, double expectedRecoveryRate)
 {
     _survivalProbSource    = survivalProbSource;
     _fxSource              = fxSource;
     _valueCurrencyDiscount = valueCurrencyDiscount;
     _fxVol = fxVol;
     _relJumpSizeInDefault = relJumpSizeInDefault;
     _simRecoveryRate      = expectedRecoveryRate;
     _currencyPair         = ccyPair;
 }
 public static double GetSurvivalProb(
     [QuantSAExcelArgument(Description = "The hazard rate curve or other source of default probabilities.")]
     SurvivalProbabilitySource survivalProbabilitySource,
     [QuantSAExcelArgument(Description =
                               "If date2 is omitted the date until which survival is calculated.  If date2 is provided the date from which survival is calculated.")]
     Date date1,
     [QuantSAExcelArgument(
          Description =
              "Optional: If provided then the survival probability is calculated from date1 until date2.",
          Default = null)]
     Date date2)
 {
     return(date2 == null
         ? survivalProbabilitySource.GetSP(date1)
         : survivalProbabilitySource.GetSP(date1, date2));
 }
 public static DeterministicCreditWithFXJump CreateModelDeterministicCreditWithFXJump(
     [QuantSAExcelArgument(Description =
                               "A curve that provides survival probabilities.  Usually a hazard curve.")]
     SurvivalProbabilitySource survivalProbSource,
     [QuantSAExcelArgument(Description =
                               "The currency pair to be simulated.  It should have the value currency as its counter currency.")]
     CurrencyPair currencyPair,
     [QuantSAExcelArgument(Description = "The source FX spot and forwards.")]
     IFXSource fxSource,
     [QuantSAExcelArgument(Description = "The value currency discount curve.")]
     IDiscountingSource valueCurrencyDiscount,
     [QuantSAExcelArgument(Description = "The FX volatility.")]
     double fxVol,
     [QuantSAExcelArgument(Description =
                               "The relative jump size in default.  For example if the value currency is ZAR and the other currency is USD then the fx is modelled as ZAR per USD and in default the fx rate will change to: rate before default * (1 + relJumpSizeInDefault).")]
     double relJumpSizeInDefault,
     [QuantSAExcelArgument(Description = "The constant recovery rate that will be assumed to apply in default.")]
     double expectedRecoveryRate)
 {
     return(new DeterministicCreditWithFXJump(survivalProbSource, currencyPair,
                                              fxSource, valueCurrencyDiscount,
                                              fxVol, relJumpSizeInDefault, expectedRecoveryRate));
 }