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));
     }
 }
Example #2
0
 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));
     }
 }
Example #3
0
 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));
     }
 }
Example #4
0
 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));
     }
 }
Example #5
0
 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));
     }
 }
Example #6
0
 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 _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));
     }
 }
Example #8
0
 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));
     }
 }
Example #9
0
 public static object _CreateHWModelDemo(string objectName,
                                         object[,] meanReversion,
                                         object[,] flatVol,
                                         object[,] baseCurve,
                                         object[,] forecastIndices)
 {
     try
     {
         var _meanReversion   = XU.GetDouble0D(meanReversion, "meanReversion");
         var _flatVol         = XU.GetDouble0D(flatVol, "flatVol");
         var _baseCurve       = XU.GetObject0D <IDiscountingSource>(baseCurve, "baseCurve");
         var _forecastIndices = XU.GetSpecialType0D <FloatingIndex>(forecastIndices, "forecastIndices");
         var _result          = XLRates.CreateHWModelDemo(_meanReversion, _flatVol, _baseCurve, _forecastIndices);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
Example #10
0
 public static object _CreateLoanFixedRate(string objectName,
                                           object[,] currency,
                                           object[,] balanceDates,
                                           object[,] balanceAmounts,
                                           object[,] fixedRate)
 {
     try
     {
         var _currency       = XU.GetSpecialType0D <Currency>(currency, "currency");
         var _balanceDates   = XU.GetDate1D(balanceDates, "balanceDates");
         var _balanceAmounts = XU.GetDouble1D(balanceAmounts, "balanceAmounts");
         var _fixedRate      = XU.GetDouble0D(fixedRate, "fixedRate");
         var _result         = XLRates.CreateLoanFixedRate(_currency, _balanceDates, _balanceAmounts, _fixedRate);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
Example #11
0
 public static object _CreateZARFRA(string objectName,
                                    object[,] tradeDate,
                                    object[,] notional,
                                    object[,] rate,
                                    object[,] fraCode,
                                    object[,] payFixed)
 {
     try
     {
         var _tradeDate = XU.GetDate0D(tradeDate, "tradeDate");
         var _notional  = XU.GetDouble0D(notional, "notional");
         var _rate      = XU.GetDouble0D(rate, "rate");
         var _fraCode   = XU.GetSpecialType0D <string>(fraCode, "fraCode");
         var _payFixed  = XU.GetBoolean0D(payFixed, "payFixed");
         var _result    = XLRates.CreateZARFRA(_tradeDate, _notional, _rate, _fraCode, _payFixed);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
Example #12
0
 public static object _CreateZARSwap(string objectName,
                                     object[,] startDate,
                                     object[,] tenor,
                                     object[,] rate,
                                     object[,] payFixed,
                                     object[,] notional)
 {
     try
     {
         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.CreateZARSwap(_startDate, _tenor, _rate, _payFixed, _notional);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
Example #13
0
 public static object _CreateLoanFloatingRate(string objectName,
                                              object[,] currency,
                                              object[,] balanceDates,
                                              object[,] balanceAmounts,
                                              object[,] floatingIndex,
                                              object[,] floatingSpread)
 {
     try
     {
         Currency         _currency       = XU.GetCurrency0D(currency, "currency");
         Date[]           _balanceDates   = XU.GetDate1D(balanceDates, "balanceDates");
         Double[]         _balanceAmounts = XU.GetDouble1D(balanceAmounts, "balanceAmounts");
         FloatingIndex    _floatingIndex  = XU.GetFloatingIndex0D(floatingIndex, "floatingIndex");
         Double           _floatingSpread = XU.GetDouble0D(floatingSpread, "floatingSpread");
         LoanFloatingRate _result         = XLRates.CreateLoanFloatingRate(_currency, _balanceDates, _balanceAmounts, _floatingIndex, _floatingSpread);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
Example #14
0
 public static object _CreateLoanFloatingRate(string objectName,
                                              object[,] currency,
                                              object[,] balanceDates,
                                              object[,] balanceAmounts,
                                              object[,] floatingIndex,
                                              object[,] floatingSpread)
 {
     try
     {
         var _currency       = XU.GetSpecialType0D <Currency>(currency, "currency");
         var _balanceDates   = XU.GetDate1D(balanceDates, "balanceDates");
         var _balanceAmounts = XU.GetDouble1D(balanceAmounts, "balanceAmounts");
         var _floatingIndex  = XU.GetSpecialType0D <FloatingIndex>(floatingIndex, "floatingIndex");
         var _floatingSpread = XU.GetDouble0D(floatingSpread, "floatingSpread");
         var _result         = XLRates.CreateLoanFloatingRate(_currency, _balanceDates, _balanceAmounts, _floatingIndex,
                                                              _floatingSpread);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }