public static object _CreateModelDeterministicCreditWithFXJump(string objectName, object[,] survivalProbSource, object[,] otherCurrency, object[,] fxSource, object[,] valueCurrencyDiscount, object[,] fxVol, object[,] relJumpSizeInDefault, object[,] expectedRecoveryRate) { try { ISurvivalProbabilitySource _survivalProbSource = XU.GetObject0D <ISurvivalProbabilitySource>(survivalProbSource, "survivalProbSource"); Currency _otherCurrency = XU.GetCurrency0D(otherCurrency, "otherCurrency"); IFXSource _fxSource = XU.GetObject0D <IFXSource>(fxSource, "fxSource"); IDiscountingSource _valueCurrencyDiscount = XU.GetObject0D <IDiscountingSource>(valueCurrencyDiscount, "valueCurrencyDiscount"); Double _fxVol = XU.GetDouble0D(fxVol, "fxVol"); Double _relJumpSizeInDefault = XU.GetDouble0D(relJumpSizeInDefault, "relJumpSizeInDefault"); Double _expectedRecoveryRate = XU.GetDouble0D(expectedRecoveryRate, "expectedRecoveryRate"); DeterministicCreditWithFXJump _result = XLCredit.CreateModelDeterministicCreditWithFXJump(_survivalProbSource, _otherCurrency, _fxSource, _valueCurrencyDiscount, _fxVol, _relJumpSizeInDefault, _expectedRecoveryRate); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
[JsonIgnore] private Dictionary <int, double> _simulation; // stores the simulated share prices at each required date /// <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(ISurvivalProbabilitySource 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 DeterministicCreditWithFXJump CreateModelDeterministicCreditWithFXJump( [QuantSAExcelArgument(Description = "A curve that provides survival probabilities. Usually a hazard curve.")] ISurvivalProbabilitySource survivalProbSource, [QuantSAExcelArgument(Description = "The other currency required in the simulation. The valuation currency will be inferred from the valueCurrencyDiscount. This value needs to be explicitly set since fxSource may provide multiple pairs.")] Currency otherCurrency, [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, otherCurrency, fxSource, valueCurrencyDiscount, fxVol, relJumpSizeInDefault, expectedRecoveryRate)); }
public static double GetSurvivalProb( [QuantSAExcelArgument(Description = "The hazard rate curve or other source of default probabilities.")] ISurvivalProbabilitySource survivalProbabilitySource, [QuantSAExcelArgument(Description = "If date2 is ommitted 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) { if (date2 == null) { return(survivalProbabilitySource.GetSP(date1)); } else { return(survivalProbabilitySource.GetSP(date1, date2)); } }
public static object _GetSurvivalProb(object[,] survivalProbabilitySource, object[,] date1, object[,] date2) { try { ISurvivalProbabilitySource _survivalProbabilitySource = XU.GetObject0D <ISurvivalProbabilitySource>(survivalProbabilitySource, "survivalProbabilitySource"); Date _date1 = XU.GetDate0D(date1, "date1"); Date _date2 = XU.GetDate0D(date2, "date2", null); Double _result = XLCredit.GetSurvivalProb(_survivalProbabilitySource, _date1, _date2); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
/// <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="otherCurrency">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 modelled 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(ISurvivalProbabilitySource survivalProbSource, Currency otherCurrency, IFXSource fxSource, IDiscountingSource valueCurrencyDiscount, double fxVol, double relJumpSizeInDefault, double expectedRecoveryRate) { this.survivalProbSource = survivalProbSource; valueCurrency = valueCurrencyDiscount.GetCurrency(); this.fxSource = fxSource; this.valueCurrencyDiscount = valueCurrencyDiscount; this.fxVol = fxVol; this.relJumpSizeInDefault = relJumpSizeInDefault; ReferenceEntity refEntity = survivalProbSource.GetReferenceEntity(); defaultTime = new DefaultTime(refEntity); defaultRecovery = new DefaultRecovery(refEntity); currencyPair = new CurrencyPair(otherCurrency, valueCurrency); anchorDate = valueCurrencyDiscount.GetAnchorDate(); spot = fxSource.GetRate(anchorDate); simRecoveryRate = expectedRecoveryRate; }
public static DeterministicCreditWithFXJump CreateModelDeterministicCreditWithFXJump( [QuantSAExcelArgument(Description = "A curve that provides survival probabilities. Usually a hazard curve.")] ISurvivalProbabilitySource 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)); }