public static object _CreateFXForecastCurve(string objectName, object[,] baseCurrency, object[,] counterCurrency, object[,] fxRateAtAnchorDate, object[,] baseCurrencyFXBasisCurve, object[,] counterCurrencyFXBasisCurve) { try { var _baseCurrency = XU.GetSpecialType0D <Currency>(baseCurrency, "baseCurrency"); var _counterCurrency = XU.GetSpecialType0D <Currency>(counterCurrency, "counterCurrency"); var _fxRateAtAnchorDate = XU.GetDouble0D(fxRateAtAnchorDate, "fxRateAtAnchorDate"); var _baseCurrencyFXBasisCurve = XU.GetObject0D <IDiscountingSource>(baseCurrencyFXBasisCurve, "baseCurrencyFXBasisCurve"); var _counterCurrencyFXBasisCurve = XU.GetObject0D <IDiscountingSource>(counterCurrencyFXBasisCurve, "counterCurrencyFXBasisCurve"); var _result = XLFX.CreateFXForecastCurve(_baseCurrency, _counterCurrency, _fxRateAtAnchorDate, _baseCurrencyFXBasisCurve, _counterCurrencyFXBasisCurve); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreatePCACurveSimulator(string objectName, object[,] anchorDate, object[,] initialRates, object[,] tenors, object[,] components, object[,] vols, object[,] multiplier, object[,] useRelative, object[,] floorAtZero) { try { Date _anchorDate = XU.GetDate0D(anchorDate, "anchorDate"); Double[] _initialRates = XU.GetDouble1D(initialRates, "initialRates"); Tenor[] _tenors = XU.GetTenor1D(tenors, "tenors"); Double[,] _components = XU.GetDouble2D(components, "components"); Double[] _vols = XU.GetDouble1D(vols, "vols"); Double _multiplier = XU.GetDouble0D(multiplier, "multiplier"); Boolean _useRelative = XU.GetBoolean0D(useRelative, "useRelative"); Boolean _floorAtZero = XU.GetBoolean0D(floorAtZero, "floorAtZero"); Object _result = XLCurves.CreatePCACurveSimulator(_anchorDate, _initialRates, _tenors, _components, _vols, _multiplier, _useRelative, _floorAtZero); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateFloatLeg(string objectName, object[,] currency, object[,] floatingIndex, object[,] resetDates, object[,] paymentDates, object[,] notionals, object[,] spreads, object[,] accrualFractions) { try { var _currency = XU.GetSpecialType0D <Currency>(currency, "currency"); var _floatingIndex = XU.GetSpecialType0D <FloatingIndex>(floatingIndex, "floatingIndex"); var _resetDates = XU.GetDate1D(resetDates, "resetDates"); var _paymentDates = XU.GetDate1D(paymentDates, "paymentDates"); var _notionals = XU.GetDouble1D(notionals, "notionals"); var _spreads = XU.GetDouble1D(spreads, "spreads"); var _accrualFractions = XU.GetDouble1D(accrualFractions, "accrualFractions"); var _result = XLRates.CreateFloatLeg(_currency, _floatingIndex, _resetDates, _paymentDates, _notionals, _spreads, _accrualFractions); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateMultiHWAndFXToy(string objectName, object[,] anchorDate, object[,] numeraireCcy, object[,] rateSimulators, object[,] currencies, object[,] spots, object[,] vols, object[,] correlations) { try { var _anchorDate = XU.GetDate0D(anchorDate, "anchorDate"); var _numeraireCcy = XU.GetSpecialType0D <Currency>(numeraireCcy, "numeraireCcy"); var _rateSimulators = XU.GetObject1D <HullWhite1F>(rateSimulators, "rateSimulators"); var _currencies = XU.GetSpecialType1D <Currency>(currencies, "currencies"); var _spots = XU.GetDouble1D(spots, "spots"); var _vols = XU.GetDouble1D(vols, "vols"); var _correlations = XU.GetDouble2D(correlations, "correlations"); var _result = XLFX.CreateMultiHWAndFXToy(_anchorDate, _numeraireCcy, _rateSimulators, _currencies, _spots, _vols, _correlations); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateZARBermudanSwaption(string objectName, object[,] exerciseDates, object[,] longOptionality, object[,] startDate, object[,] tenor, object[,] rate, object[,] payFixed, object[,] notional) { try { var _exerciseDates = XU.GetDate1D(exerciseDates, "exerciseDates"); var _longOptionality = XU.GetBoolean0D(longOptionality, "longOptionality"); var _startDate = XU.GetDate0D(startDate, "startDate"); var _tenor = XU.GetSpecialType0D <Tenor>(tenor, "tenor"); var _rate = XU.GetDouble0D(rate, "rate"); var _payFixed = XU.GetBoolean0D(payFixed, "payFixed"); var _notional = XU.GetDouble0D(notional, "notional"); var _result = XLRates.CreateZARBermudanSwaption(_exerciseDates, _longOptionality, _startDate, _tenor, _rate, _payFixed, _notional); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object FormulaBlackScholes([ExcelArgument(Description = "Strike")] object[,] strike, [ExcelArgument(Description = "The value date as and Excel date.")] object[,] valueDate, [ExcelArgument(Description = "The exercise date of the option. Must be greater than the value date.")] object[,] exerciseDate, [ExcelArgument(Description = "The spot proce of the underlying at the value date.")] object[,] spotPrice, [ExcelArgument(Description = "Annualized volatility.")] object[,] vol, [ExcelArgument(Description = "Continuously compounded risk free rate.")] object[,] riskfreeRate, [ExcelArgument(Description = "Continuously compounded dividend yield.")] object[,] divYield) { try { return(BlackEtc.BlackScholes(PutOrCall.Call, XU.GetDouble0D(strike, "strike"), (XU.GetDate0D(exerciseDate, "exerciseDate") - XU.GetDate0D(valueDate, "valueDate")) / 365.0, XU.GetDouble0D(spotPrice, "spotPrice"), XU.GetDouble0D(vol, "vol"), XU.GetDouble0D(riskfreeRate, "riskfreeRate"), XU.GetDouble0D(divYield, "divYield"))); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateEquityModel(string objectName, object[,] discountCurve, object[,] shares, object[,] spotPrices, object[,] volatilities, object[,] divYields, object[,] correlations, object[,] rateForecastCurves) { try { var _discountCurve = XU.GetObject0D <IDiscountingSource>(discountCurve, "discountCurve"); var _shares = XU.GetSpecialType1D <Share>(shares, "shares"); var _spotPrices = XU.GetDouble1D(spotPrices, "spotPrices"); var _volatilities = XU.GetDouble1D(volatilities, "volatilities"); var _divYields = XU.GetDouble1D(divYields, "divYields"); var _correlations = XU.GetDouble2D(correlations, "correlations"); var _rateForecastCurves = XU.GetObject1D <IFloatingRateSource>(rateForecastCurves, "rateForecastCurves"); var _result = XLEquities.CreateEquityModel(_discountCurve, _shares, _spotPrices, _volatilities, _divYields, _correlations, _rateForecastCurves); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateCDS(string objectName, object[,] refEntity, object[,] ccy, object[,] paymentDates, object[,] notionals, object[,] rates, object[,] accrualFractions, object[,] boughtProtection) { try { var _refEntity = XU.GetSpecialType0D <ReferenceEntity>(refEntity, "refEntity"); var _ccy = XU.GetSpecialType0D <Currency>(ccy, "ccy"); var _paymentDates = XU.GetDate1D(paymentDates, "paymentDates"); var _notionals = XU.GetDouble1D(notionals, "notionals"); var _rates = XU.GetDouble1D(rates, "rates"); var _accrualFractions = XU.GetDouble1D(accrualFractions, "accrualFractions"); var _boughtProtection = XU.GetBoolean0D(boughtProtection, "boughtProtection"); var _result = XLCredit.CreateCDS(_refEntity, _ccy, _paymentDates, _notionals, _rates, _accrualFractions, _boughtProtection); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateModelDeterministicCreditWithFXJump(string objectName, object[,] survivalProbSource, object[,] otherCurrency, object[,] fxSource, object[,] valueCurrencyDiscount, object[,] fxVol, object[,] relJumpSizeInDefault, object[,] expectedRecoveryRate) { try { var _survivalProbSource = XU.GetObject0D <ISurvivalProbabilitySource>(survivalProbSource, "survivalProbSource"); var _otherCurrency = XU.GetSpecialType0D <Currency>(otherCurrency, "otherCurrency"); var _fxSource = XU.GetObject0D <IFXSource>(fxSource, "fxSource"); var _valueCurrencyDiscount = XU.GetObject0D <IDiscountingSource>(valueCurrencyDiscount, "valueCurrencyDiscount"); var _fxVol = XU.GetDouble0D(fxVol, "fxVol"); var _relJumpSizeInDefault = XU.GetDouble0D(relJumpSizeInDefault, "relJumpSizeInDefault"); var _expectedRecoveryRate = XU.GetDouble0D(expectedRecoveryRate, "expectedRecoveryRate"); var _result = XLCredit.CreateModelDeterministicCreditWithFXJump(_survivalProbSource, _otherCurrency, _fxSource, _valueCurrencyDiscount, _fxVol, _relJumpSizeInDefault, _expectedRecoveryRate); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateFloatLeg(string objectName, object[,] currency, object[,] floatingIndex, object[,] resetDates, object[,] paymentDates, object[,] notionals, object[,] spreads, object[,] accrualFractions) { try { Currency _currency = XU.GetCurrency0D(currency, "currency"); FloatingIndex _floatingIndex = XU.GetFloatingIndex0D(floatingIndex, "floatingIndex"); Date[] _resetDates = XU.GetDate1D(resetDates, "resetDates"); Date[] _paymentDates = XU.GetDate1D(paymentDates, "paymentDates"); Double[] _notionals = XU.GetDouble1D(notionals, "notionals"); Double[] _spreads = XU.GetDouble1D(spreads, "spreads"); Double[] _accrualFractions = XU.GetDouble1D(accrualFractions, "accrualFractions"); FloatLeg _result = XLRates.CreateFloatLeg(_currency, _floatingIndex, _resetDates, _paymentDates, _notionals, _spreads, _accrualFractions); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object CreateProductFromFile([ExcelArgument(Description = "Name of product")] string name, [ExcelArgument(Description = "Full path to the file.")] string filename) { try { Product runtimeProduct = RuntimeProduct.CreateFromScript(filename); return(XU.AddObject(name, runtimeProduct)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateBusiness252DayCount(string objectName, object[,] calendar) { try { var _calendar = XU.GetSpecialType0D <Calendar>(calendar, "calendar"); var _result = XLConventions.CreateBusiness252DayCount(_calendar); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _IsHoliday(object[,] date, object[,] calendar) { try { var _date = XU.GetDate0D(date, "date"); var _calendar = XU.GetSpecialType0D <Calendar>(calendar, "calendar"); var _result = XLConventions.IsHoliday(_date, _calendar); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _GetFXRate(object[,] fxCurve, object[,] date) { try { var _fxCurve = XU.GetObject0D <IFXSource>(fxCurve, "fxCurve"); var _date = XU.GetDate0D(date, "date"); var _result = XLFX.GetFXRate(_fxCurve, _date); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _GetDF(object[,] curve, object[,] date) { try { var _curve = XU.GetObject0D <IDiscountingSource>(curve, "curve"); var _date = XU.GetDate0D(date, "date"); var _result = XLRates.GetDF(_curve, _date); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _DFFromRate(object[,] rate, object[,] compounding, object[,] yearFraction) { try { var _rate = XU.GetDouble0D(rate, "rate"); var _compounding = XU.GetSpecialType0D <CompoundingConvention>(compounding, "compounding"); var _yearFraction = XU.GetDouble0D(yearFraction, "yearFraction"); var _result = XLConventions.DFFromRate(_rate, _compounding, _yearFraction); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _GetYearFraction(object[,] date1, object[,] date2, object[,] convention) { try { var _date1 = XU.GetDate0D(date1, "date1"); var _date2 = XU.GetDate0D(date2, "date2"); var _convention = XU.GetSpecialType0D <DayCountConvention>(convention, "convention"); var _result = XLConventions.GetYearFraction(_date1, _date2, _convention); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
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)); } }
public static object _ValueZARSwap1Curve(object[,] swap, object[,] valueDate, object[,] curve) { try { var _swap = XU.GetObject0D <IRSwap>(swap, "swap"); var _valueDate = XU.GetDate0D(valueDate, "valueDate"); var _curve = XU.GetObject0D <IDiscountingSource>(curve, "curve"); var _result = XLRates.ValueZARSwap1Curve(_swap, _valueDate, _curve); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _ApplyBusinessDayAdjustment(object[,] date, object[,] convention, object[,] calendar) { try { var _date = XU.GetDate0D(date, "date"); var _convention = XU.GetSpecialType0D <BusinessDayConvention>(convention, "convention"); var _calendar = XU.GetSpecialType0D <Calendar>(calendar, "calendar"); var _result = XLConventions.ApplyBusinessDayAdjustment(_date, _convention, _calendar); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _FitCurveNelsonSiegel(string objectName, object[,] anchorDate, object[,] dates, object[,] rates) { try { Date _anchorDate = XU.GetDate0D(anchorDate, "anchorDate"); Date[] _dates = XU.GetDate1D(dates, "dates"); Double[] _rates = XU.GetDouble1D(rates, "rates"); ICurve _result = XLCurves.FitCurveNelsonSiegel(_anchorDate, _dates, _rates); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateDatesAndRatesCurve(string objectName, object[,] dates, object[,] rates, object[,] currency) { try { Date[] _dates = XU.GetDate1D(dates, "dates"); Double[] _rates = XU.GetDouble1D(rates, "rates"); Currency _currency = XU.GetCurrency0D(currency, "currency", Currency.ANY); IDiscountingSource _result = XLCurves.CreateDatesAndRatesCurve(_dates, _rates, _currency); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateEquityCall(string objectName, object[,] share, object[,] exerciseDate, object[,] strike) { try { var _share = XU.GetSpecialType0D <Share>(share, "share"); var _exerciseDate = XU.GetDate0D(exerciseDate, "exerciseDate"); var _strike = XU.GetDouble0D(strike, "strike"); var _result = XLEquities.CreateEquityCall(_share, _exerciseDate, _strike); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateDatesAndRatesCurve(string objectName, object[,] dates, object[,] rates, object[,] currency) { try { var _dates = XU.GetDate1D(dates, "dates"); var _rates = XU.GetDouble1D(rates, "rates"); var _currency = XU.GetSpecialType0D(currency, "currency", Currency.ANY); var _result = XLCurves.CreateDatesAndRatesCurve(_dates, _rates, _currency); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateCashLeg(string objectName, object[,] paymentDates, object[,] amounts, object[,] currencies) { try { var _paymentDates = XU.GetDate1D(paymentDates, "paymentDates"); var _amounts = XU.GetDouble1D(amounts, "amounts"); var _currencies = XU.GetSpecialType1D <Currency>(currencies, "currencies"); var _result = XLRates.CreateCashLeg(_paymentDates, _amounts, _currencies); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateCurveModel(string objectName, object[,] discountCurve, object[,] rateForecastCurves, object[,] fxForecastCurves) { try { IDiscountingSource _discountCurve = XU.GetObject0D <IDiscountingSource>(discountCurve, "discountCurve"); IFloatingRateSource[] _rateForecastCurves = XU.GetObject1D <IFloatingRateSource>(rateForecastCurves, "rateForecastCurves"); IFXSource[] _fxForecastCurves = XU.GetObject1D <IFXSource>(fxForecastCurves, "fxForecastCurves"); NumeraireSimulator _result = XLValuation.CreateCurveModel(_discountCurve, _rateForecastCurves, _fxForecastCurves); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateRateForecastCurveFromDiscount(string objectName, object[,] floatingRateIndex, object[,] discountCurve, object[,] fixingCurve) { try { FloatingIndex _floatingRateIndex = XU.GetFloatingIndex0D(floatingRateIndex, "floatingRateIndex"); IDiscountingSource _discountCurve = XU.GetObject0D <IDiscountingSource>(discountCurve, "discountCurve"); IFloatingRateSource _fixingCurve = XU.GetObject0D <IFloatingRateSource>(fixingCurve, "fixingCurve", null); IFloatingRateSource _result = XLRates.CreateRateForecastCurveFromDiscount(_floatingRateIndex, _discountCurve, _fixingCurve); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateCashLeg(string objectName, object[,] paymentDates, object[,] amounts, object[,] currencies) { try { Date[] _paymentDates = XU.GetDate1D(paymentDates, "paymentDates"); Double[] _amounts = XU.GetDouble1D(amounts, "amounts"); Currency[] _currencies = XU.GetCurrency1D(currencies, "currencies"); CashLeg _result = XLRates.CreateCashLeg(_paymentDates, _amounts, _currencies); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _RateConvert(object[,] rate, object[,] compoundingFrom, object[,] compoundingTo, object[,] yearFraction) { try { var _rate = XU.GetDouble0D(rate, "rate"); var _compoundingFrom = XU.GetSpecialType0D <CompoundingConvention>(compoundingFrom, "compoundingFrom"); var _compoundingTo = XU.GetSpecialType0D <CompoundingConvention>(compoundingTo, "compoundingTo"); var _yearFraction = XU.GetDouble0D(yearFraction, "yearFraction", double.NaN); var _result = XLConventions.RateConvert(_rate, _compoundingFrom, _compoundingTo, _yearFraction); return(XU.ConvertToObjects(_result)); } catch (Exception e) { return(XU.Error0D(e)); } }
public static object _CreateHazardCurve(string objectName, object[,] referenceEntity, object[,] anchorDate, object[,] dates, object[,] hazardRates) { try { var _referenceEntity = XU.GetSpecialType0D <ReferenceEntity>(referenceEntity, "referenceEntity"); var _anchorDate = XU.GetDate0D(anchorDate, "anchorDate"); var _dates = XU.GetDate1D(dates, "dates"); var _hazardRates = XU.GetDouble1D(hazardRates, "hazardRates"); var _result = XLCredit.CreateHazardCurve(_referenceEntity, _anchorDate, _dates, _hazardRates); return(XU.AddObject(objectName, _result)); } catch (Exception e) { return(XU.Error0D(e)); } }