예제 #1
0
 public static object _CreateEquityModel(string objectName,
                                         object[,] discountCurve,
                                         object[,] shares,
                                         object[,] spotPrices,
                                         object[,] volatilities,
                                         object[,] divYields,
                                         object[,] correlations,
                                         object[,] rateForecastCurves)
 {
     try
     {
         IDiscountingSource _discountCurve = XU.GetObject0D <IDiscountingSource>(discountCurve, "discountCurve");
         Share[]            _shares        = XU.GetShare1D(shares, "shares");
         Double[]           _spotPrices    = XU.GetDouble1D(spotPrices, "spotPrices");
         Double[]           _volatilities  = XU.GetDouble1D(volatilities, "volatilities");
         Double[]           _divYields     = XU.GetDouble1D(divYields, "divYields");
         Double[,] _correlations = XU.GetDouble2D(correlations, "correlations");
         IFloatingRateSource[] _rateForecastCurves = XU.GetObject1D <IFloatingRateSource>(rateForecastCurves, "rateForecastCurves");
         NumeraireSimulator    _result             = XLEquities.CreateEquityModel(_discountCurve, _shares, _spotPrices, _volatilities, _divYields, _correlations, _rateForecastCurves);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
예제 #2
0
 public static object _CreateMultiHWAndFXToy(string objectName,
                                             object[,] anchorDate,
                                             object[,] numeraireCcy,
                                             object[,] rateSimulators,
                                             object[,] currencies,
                                             object[,] spots,
                                             object[,] vols,
                                             object[,] correlations)
 {
     try
     {
         Date          _anchorDate     = XU.GetDate0D(anchorDate, "anchorDate");
         Currency      _numeraireCcy   = XU.GetCurrency0D(numeraireCcy, "numeraireCcy");
         HullWhite1F[] _rateSimulators = XU.GetObject1D <HullWhite1F>(rateSimulators, "rateSimulators");
         Currency[]    _currencies     = XU.GetCurrency1D(currencies, "currencies");
         Double[]      _spots          = XU.GetDouble1D(spots, "spots");
         Double[]      _vols           = XU.GetDouble1D(vols, "vols");
         Double[,] _correlations = XU.GetDouble2D(correlations, "correlations");
         NumeraireSimulator _result = XLFX.CreateMultiHWAndFXToy(_anchorDate, _numeraireCcy, _rateSimulators, _currencies, _spots, _vols, _correlations);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
예제 #3
0
        public static double[] EPE([ExcelArgument(Description = "A list of products.")] Product[] products,
                                   [ExcelArgument(Description = "The value date.")] Date valueDate,
                                   [ExcelArgument(Description = "The dates at which the expected positive exposure is required.")] Date[] forwardValueDates,
                                   [ExcelArgument(Description = "A model able to handle all the market observables required to calculate the cashflows in the portfolio.")] NumeraireSimulator model,
                                   [ExcelArgument(Description = "The number of simulations required.")] int nSims)
        {
            Coordinator coordinator = new Coordinator(model, new List <Simulator>(), nSims);

            return(coordinator.EPE(products, valueDate, forwardValueDates));
        }
예제 #4
0
        public static double[,] PFE([ExcelArgument(Description = "A list of products.")] Product[] products,
                                    [ExcelArgument(Description = "The value date.")] Date valueDate,
                                    [ExcelArgument(Description = "The dates at which the expected positive exposure is required.")] Date[] forwardValueDates,
                                    [ExcelArgument(Description = "The required percentiles.  95th percentile should be entered as 0.95.  Can be a list of percentiles and the PFE will be calculated at each of the provided levels.")] double[] requiredPecentiles,
                                    [ExcelArgument(Description = "A model able to handle all the market observables required to calculate the cashflows in the portfolio.")] NumeraireSimulator model,
                                    [ExcelArgument(Description = "The number of simulations required.")] int nSims)
        {
            Coordinator coordinator = new Coordinator(model, new List <Simulator>(), nSims);

            return(coordinator.PFE(products, valueDate, forwardValueDates, requiredPecentiles));
        }
예제 #5
0
        public static ResultStore Value([ExcelArgument(Description = "A list of products.")] Product[] products,
                                        [QuantSAExcelArgument(Description = "The value date.")] Date valueDate,
                                        [QuantSAExcelArgument(Description = "A model able to handle all the market observables required to calculate the cashflows in the portfolio.")] NumeraireSimulator model,
                                        [QuantSAExcelArgument(Description = "Optional.  The number of simulations required if the model requires simulation.  If left blank will use a default value depending on the model.", Default = "1")] int nSims)
        {
            //int N = (nSims[0, 0] is ExcelMissing) ? 1 : XU.GetInt0D(nSims, "nSims");

            Coordinator coordinator = new Coordinator(model, new List <Simulator>(), nSims);
            double      value       = coordinator.Value(products, valueDate);
            ResultStore result      = new ResultStore();

            result.Add("value", value);
            return(result);
        }
예제 #6
0
 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));
     }
 }
예제 #7
0
 public static object _Value(string objectName,
                             object[,] products,
                             object[,] valueDate,
                             object[,] model,
                             object[,] nSims)
 {
     try
     {
         Product[]          _products  = XU.GetObject1D <Product>(products, "products");
         Date               _valueDate = XU.GetDate0D(valueDate, "valueDate");
         NumeraireSimulator _model     = XU.GetObject0D <NumeraireSimulator>(model, "model");
         Int32              _nSims     = XU.GetInt320D(nSims, "nSims", 1);
         ResultStore        _result    = XLValuation.Value(_products, _valueDate, _model, _nSims);
         return(XU.AddObject(objectName, _result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
예제 #8
0
 public static object[,] _EPE(object[,] products,
                              object[,] valueDate,
                              object[,] forwardValueDates,
                              object[,] model,
                              object[,] nSims)
 {
     try
     {
         Product[]          _products          = XU.GetObject1D <Product>(products, "products");
         Date               _valueDate         = XU.GetDate0D(valueDate, "valueDate");
         Date[]             _forwardValueDates = XU.GetDate1D(forwardValueDates, "forwardValueDates");
         NumeraireSimulator _model             = XU.GetObject0D <NumeraireSimulator>(model, "model");
         Int32              _nSims             = XU.GetInt320D(nSims, "nSims");
         Double[]           _result            = XLValuation.EPE(_products, _valueDate, _forwardValueDates, _model, _nSims);
         return(XU.ConvertToObjects(_result));
     }
     catch (Exception e)
     {
         return(XU.Error2D(e));
     }
 }