Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DeterministicCurves"/> class with just a discounting curve.
 /// Additional rate forecast curves are added with <see cref="AddRateForecast(IFloatingRateSource)"/>, and
 /// FXC forecast sources are added with <see cref="AddFXForecast(IFXSource)"/>.
 /// </summary>
 /// <param name="discountCurve">The discount curve.</param>
 public DeterministicCurves(IDiscountingSource discountCurve)
 {
     _numeraireCurrency = discountCurve.GetCurrency();
     _discountCurve     = discountCurve;
     _forecastCurves    = new Dictionary <string, IFloatingRateSource>();
     _fxCurves          = new Dictionary <string, IFXSource>();
 }
 public ShiftedDiscountSource(IDiscountingSource underlyingCurve, Date[] dates, double[] effectiveRateBumps)
 {
     this.underlyingCurve    = underlyingCurve;
     this.dates              = dates;
     this.effectiveRateBumps = effectiveRateBumps;
     hasParallelShift        = false;
 }
Beispiel #3
0
        public static IFloatingRateSource CreateRateForecastCurveFromDiscount(
            [ExcelArgument(Description = "The floating rate that this curve will be used to forecast.")]
            FloatRateIndex floatingRateIndex,
            [ExcelArgument(Description =
                               "The name of the discount curve that will be used to obtain the forward rates.")]
            IDiscountingSource discountCurve,
            [QuantSAExcelArgument(
                 Description =
                     "Optional: The name of the fixing curve for providing floating rates at dates before the anchor date of the discount curve.  If it is left out then the first floating rate implied by the discount curve will be used for all historical fixes.",
                 Default = null)]
            IFloatingRateSource fixingCurve)
        {
            if (fixingCurve == null)
            {
                // Calculate the first fixing off the curve to use at all past dates.
                var df1       = 1.0;
                var laterDate = discountCurve.GetAnchorDate().AddTenor(floatingRateIndex.Tenor);
                var df2       = discountCurve.GetDF(laterDate);
                var dt        = (laterDate - discountCurve.GetAnchorDate()) / 365.0;
                var rate      = (df1 / df2 - 1) / dt;
                fixingCurve = new FloatingRateFixingCurve1Rate(discountCurve.GetAnchorDate(), rate, floatingRateIndex);
            }

            return(new ForecastCurveFromDiscount(discountCurve, floatingRateIndex, fixingCurve));
        }
Beispiel #4
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));
     }
 }
 /// <summary>
 /// Will use the discount factors to obtain the forward rates after the curve's anchor date and the fixing curve before that date.
 /// </summary>
 /// <param name="discountCurve"></param>
 /// <param name="index"></param>
 /// <param name="fixingCurve"></param>
 public ForecastCurveFromDiscount(IDiscountingSource discountCurve, FloatingIndex index,
                                  IFloatingRateSource fixingCurve)
 {
     this.discountCurve = discountCurve;
     this.index         = index;
     this.fixingCurve   = fixingCurve;
 }
Beispiel #6
0
        public static double ValueSwap(IRSwap swap, Date valueDate, IDiscountingSource curve)
        {
            // Get the required objects off the map
            var index = swap.GetFloatingIndex();

            // Calculate the first fixing off the curve to use at all past dates.
            var df1       = curve.GetDF(valueDate);
            var laterDate = valueDate.AddTenor(index.Tenor);
            var df2       = curve.GetDF(laterDate);
            var dt        = (laterDate - valueDate) / 365.0;
            var rate      = (df1 / df2 - 1) / dt;

            //Set up the valuation engine.
            IFloatingRateSource forecastCurve = new ForecastCurveFromDiscount(curve, index,
                                                                              new FloatingRateFixingCurve1Rate(valueDate, rate, index));
            var curveSim = new DeterministicCurves(curve);

            curveSim.AddRateForecast(forecastCurve);
            var coordinator = new Coordinator(curveSim, new List <Simulator>(), 1);

            // Run the valuation
            var value = coordinator.Value(new Product[] { swap }, valueDate);

            return(value);
        }
Beispiel #7
0
 public static object GetSpecialDF([QuantSAExcelArgument(Description = "The discounting curve.")]
                                   IDiscountingSource discountingSource,
                                   [QuantSAExcelArgument(Description = "date")]
                                   Date date)
 {
     return(discountingSource.GetDF(date));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeterminsiticCurves"/> class with just a discounting curve.
 /// Additional rate forecast curves are added with <see cref="AddRateForecast(IFloatingRateSource)"/>, and
 /// FXC forecast sources are added with <see cref="AddFXForecast(IFXSource)"/>.
 /// </summary>
 /// <param name="discountCurve">The discount curve.</param>
 public DeterminsiticCurves(IDiscountingSource discountCurve)
 {
     numeraireCurrency  = discountCurve.GetCurrency();
     this.discountCurve = discountCurve;
     forecastCurves     = new Dictionary <MarketObservable, IFloatingRateSource>();
     fxCurves           = new Dictionary <MarketObservable, IFXSource>();
 }
Beispiel #9
0
        public static double ValueZARSwap1Curve([ExcelArgument(Description = "The name of the swap.")] IRSwap swap,
                                                [ExcelArgument(Description = "The date on which valuation is required.  Cannot be before the anchor date of the curve.")] Date valueDate,
                                                [ExcelArgument(Description = "The discounting curve.  Will also be used for forecasting Jibar and providing the most recent required Jibar fix.")] IDiscountingSource curve)
        {
            // Get the required objects off the map
            FloatingIndex index = swap.GetFloatingIndex();

            // Calculate the first fixing off the curve to use at all past dates.
            double df1       = curve.GetDF(valueDate);
            Date   laterDate = valueDate.AddTenor(index.tenor);
            double df2       = curve.GetDF(laterDate);
            double dt        = (laterDate - valueDate) / 365.0;
            double rate      = (df1 / df2 - 1) / dt;

            //Set up the valuation engine.
            IFloatingRateSource forecastCurve = new ForecastCurveFromDiscount(curve, index,
                                                                              new FloatingRateFixingCurve1Rate(rate, index));
            DeterminsiticCurves curveSim = new DeterminsiticCurves(curve);

            curveSim.AddRateForecast(forecastCurve);
            Coordinator coordinator = new Coordinator(curveSim, new List <Simulator>(), 1);

            // Run the valuation
            double value = coordinator.Value(new Product[] { swap }, valueDate);

            return(value);
        }
 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));
     }
 }
Beispiel #11
0
 public static double GetDF([ExcelArgument(Description = "The curve from which the DF is required.")]
                            IDiscountingSource curve,
                            [ExcelArgument(Description =
                                               "The date on which the discount factor is required.  Cannot be before the anchor date of the curve.")]
                            Date date)
 {
     return(curve.GetDF(date));
 }
 /// <summary>
 /// Will use the discount factors to obtain the forward rates after the curve's anchor date and the fixing curve before
 /// that date.
 /// </summary>
 /// <param name="discountCurve"></param>
 /// <param name="index"></param>
 /// <param name="fixingCurve"></param>
 public ForecastCurveFromDiscount(IDiscountingSource discountCurve, FloatRateIndex index,
                                  IFloatingRateSource fixingCurve)
 {
     _discountCurve = discountCurve;
     _index         = index;
     _fixingCurve   = fixingCurve;
     _name          = new FloatingRateSourceDescription(index).Name;
 }
Beispiel #13
0
 public static object CreateFXForecastCurve([ExcelArgument(Description = "The base currency.  Values are measured in units of counter currency per one base currency.(Currency)")] Currency baseCurrency,
                                            [ExcelArgument(Description = "The counter currency.  Values are measured in units of counter currency per one base currency.(Currency)")] Currency counterCurrency,
                                            [ExcelArgument(Description = "The rate at the anchor date of the two curves.")] double fxRateAtAnchorDate,
                                            [ExcelArgument(Description = "A curve that will be used to obatin forward rates.")] IDiscountingSource baseCurrencyFXBasisCurve,
                                            [ExcelArgument(Description = "A curve that will be used to obtain forward rates.")] IDiscountingSource counterCurrencyFXBasisCurve)
 {
     return(new FXForecastCurve(baseCurrency, counterCurrency, fxRateAtAnchorDate, baseCurrencyFXBasisCurve,
                                counterCurrencyFXBasisCurve));
 }
        public static NumeraireSimulator CreateCurveModel([ExcelArgument(Description = "The discounting curve")] IDiscountingSource discountCurve,
                                                          [ExcelArgument(Description = "The floating rate forecast curves for all the rates that the products in the portfolio will need.")] IFloatingRateSource[] rateForecastCurves,
                                                          [ExcelArgument(Description = "The FX rate forecast curves for all the cashflow currencies other than the discounting currency.")] IFXSource[] fxForecastCurves)
        {
            DeterminsiticCurves model = new DeterminsiticCurves(discountCurve);

            model.AddRateForecast(rateForecastCurves);
            model.AddFXForecast(fxForecastCurves);
            return(model);
        }
 public void Init()
 {
     discountCurve = new DatesAndRates(Currency.ZAR, anchorDate,
                                       new Date[] { anchorDate, anchorDate.AddMonths(120) },
                                       new double[] { 0.07, 0.09 });
     rateForecastCurves = new List <IFloatingRateSource>
     {
         new ForecastCurveFromDiscount(discountCurve, FloatingIndex.JIBAR3M, new FloatingRateFixingCurve1Rate(0.07, FloatingIndex.JIBAR3M))
     }.ToArray();
 }
Beispiel #16
0
 public void Init()
 {
     _discountCurve = new DatesAndRates(TestHelpers.ZAR, _anchorDate,
                                        new[] { _anchorDate, _anchorDate.AddMonths(120) },
                                        new[] { 0.07, 0.09 });
     _rateForecastCurves = new List <IFloatingRateSource>
     {
         new ForecastCurveFromDiscount(_discountCurve, TestHelpers.Jibar3M,
                                       new FloatingRateFixingCurve1Rate(_anchorDate, 0.07, TestHelpers.Jibar3M))
     }.ToArray();
 }
Beispiel #17
0
        /// <summary>
        /// Discount and add all the cashflows to the anchor date of <paramref name="discountingSource"/>.
        /// <para>
        /// Assumes all cashflows are in the future and in the same currency as <paramref name="discountingSource"/>.
        /// </para>
        /// </summary>
        /// <param name="cfs"></param>
        /// <param name="discountingSource"></param>
        /// <returns></returns>
        public static double PV(this List <Cashflow> cfs, IDiscountingSource discountingSource)
        {
            var pv = 0.0;

            foreach (var cf in cfs)
            {
                pv += cf.Amount * discountingSource.GetDF(cf.Date);
            }

            return(pv);
        }
Beispiel #18
0
 public static NumeraireSimulator CreateEquityModel([QuantSAExcelArgument(Description = "The discounting curve.  Will be used for discounting and as the drift rate for the equities.")] IDiscountingSource discountCurve,
                                                    [QuantSAExcelArgument(Description = "Share codes.  A list of strings to identify the shares.  These need to match those used in the product that will be valued.")] Share[] shares,
                                                    [QuantSAExcelArgument(Description = "The values of all the shares on the anchor date of the discounting curve. ")] double[] spotPrices,
                                                    [QuantSAExcelArgument(Description = "A single volatility for each share.")] double[] volatilities,
                                                    [QuantSAExcelArgument(Description = "A single continuous dividend yield rate for each equity.")] double[] divYields,
                                                    [QuantSAExcelArgument(Description = "A square matrix of correlations between shares, the rows and columns must be in the same order as the shares were listed in shareCodes.")] double[,] correlations,
                                                    [QuantSAExcelArgument(Description = "The floating rate forecast curves for all the rates that the products in the portfolio will need.")] IFloatingRateSource[] rateForecastCurves)
 {
     return(new EquitySimulator(shares, spotPrices, volatilities, divYields, correlations, discountCurve,
                                rateForecastCurves));
 }
        [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;
        }
Beispiel #20
0
        public static HullWhite1F CreateHWModelDemo([ExcelArgument(Description = "The constant rate of mean reversion.")] double meanReversion,
                                                    [ExcelArgument(Description = "The constant short rate volatility.  Note that this is a Gaussian vol and will in general be lower than the vol that would be used in Black.")] double flatVol,
                                                    [ExcelArgument(Description = "The curve to which zero coupon bond prices will be calibrated.")] IDiscountingSource baseCurve,
                                                    [ExcelArgument(Description = "The indices that should be forecast with this same cuve.  No spreads are added.")] FloatingIndex forecastIndices)
        {
            Date        anchorDate    = baseCurve.GetAnchorDate();
            double      flatCurveRate = -Math.Log(baseCurve.GetDF(anchorDate.AddTenor(Tenor.Years(1))));
            HullWhite1F model         = new HullWhite1F(baseCurve.GetCurrency(), meanReversion, flatVol, flatCurveRate, flatCurveRate, anchorDate);

            model.AddForecast(forecastIndices);
            return(model);
        }
Beispiel #21
0
 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 object GetSpecialDF([ExcelArgument(Description = "Name of discounting curve.")] String name,
                                   [ExcelArgument(Description = "date")] object[,] date)
 {
     try
     {
         IDiscountingSource discountCurve = PluginConnection.objectMap.GetObjectFromID <IDiscountingSource>(name);
         return(discountCurve.GetDF(ExcelUtilities.GetDate0D(date, "date")));
     }
     catch (Exception e)
     {
         return(ExcelUtilities.Error0D(e));
     }
 }
Beispiel #23
0
        public static double ValueZARSwap1Curve([ExcelArgument(Description = "The name of the swap.")]
                                                IRSwap swap,
                                                [ExcelArgument(Description =
                                                                   "The date on which valuation is required.  Cannot be before the anchor date of the curve.")]
                                                Date valueDate,
                                                [ExcelArgument(Description =
                                                                   "The discounting curve.  Will also be used for forecasting Jibar and providing the most recent required Jibar fix.")]
                                                IDiscountingSource curve)
        {
            var value = IRSwapEx.ValueSwap(swap, valueDate, curve);

            return(value);
        }
Beispiel #24
0
 public static FXForecastCurve CreateFXForecastCurve(
     [ExcelArgument(Description = "The currency pair that the curve forecasts.")]
     CurrencyPair currencyPair,
     [ExcelArgument(Description = "The rate at the anchor date of the two curves.")]
     double fxRateAtAnchorDate,
     [ExcelArgument(Description = "A curve that will be used to obtain forward rates.")]
     IDiscountingSource baseCurrencyFXBasisCurve,
     [ExcelArgument(Description = "A curve that will be used to obtain forward rates.")]
     IDiscountingSource counterCurrencyFXBasisCurve)
 {
     return(new FXForecastCurve(currencyPair, fxRateAtAnchorDate, baseCurrencyFXBasisCurve,
                                counterCurrencyFXBasisCurve));
 }
Beispiel #25
0
 public static object _GetDF(object[,] curve,
                             object[,] date)
 {
     try
     {
         IDiscountingSource _curve = XU.GetObject0D <IDiscountingSource>(curve, "curve");
         Date   _date   = XU.GetDate0D(date, "date");
         Double _result = XLRates.GetDF(_curve, _date);
         return(XU.ConvertToObjects(_result));
     }
     catch (Exception e)
     {
         return(XU.Error0D(e));
     }
 }
Beispiel #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EquitySimulator"/> class.
 /// </summary>
 /// <param name="shares">An array of shares that will be simulated.</param>
 /// <param name="prices">The prices of the supplied shares.</param>
 /// <param name="vols">The annualized volatilites of the supplied shares.</param>
 /// <param name="divYields">The continous dividend yields.</param>
 /// <param name="correlations">The correlation matrix for all the shares.</param>
 /// <param name="discountCurve">The discount curve that will be also be used to determine the drift on the shares.</param>
 /// <param name="rateForecastCurves">Deterministic rate forecast curves, used for example when a
 /// structure includes a loan whose interest needs to be calculated during the simulation.</param>
 public EquitySimulator(Share[] shares, double[] prices, double[] vols, double[] divYields,
                        double[,] correlations, IDiscountingSource discountCurve, IFloatingRateSource[] rateForecastCurves)
 {
     this.shares             = shares;
     this.prices             = prices;
     this.vols               = vols;
     this.divYields          = divYields;
     this.discountCurve      = discountCurve;
     anchorDate              = discountCurve.GetAnchorDate();
     normal                  = new MultivariateNormalDistribution(Vector.Zeros(prices.Length), correlations);
     this.rateForecastCurves = new Dictionary <MarketObservable, IFloatingRateSource>();
     foreach (var floatingRateSource in rateForecastCurves)
     {
         this.rateForecastCurves.Add(floatingRateSource.GetFloatingIndex(), floatingRateSource);
     }
 }
        /// <summary>
        /// Curve based valuation of <see cref="FloatLeg"/>.  Assumes that correct forecast and discount curves have been provided.
        /// </summary>
        /// <param name="leg"></param>
        /// <param name="forecastCurve"></param>
        /// <param name="discountCurve"></param>
        /// <returns></returns>
        public static double CurvePV(this FloatLeg leg, IFloatingRateSource forecastCurve,
                                     IDiscountingSource discountCurve)
        {
            var legIndex     = forecastCurve.GetFloatingIndex();
            var resetDates1  = leg.GetRequiredIndexDates(legIndex);
            var indexValues1 = new double[resetDates1.Count];

            for (var i = 0; i < resetDates1.Count; i++)
            {
                indexValues1[i] = forecastCurve.GetForwardRate(resetDates1[i]);
            }
            leg.SetIndexValues(legIndex, indexValues1);
            var cfs1   = leg.GetCFs();
            var value1 = cfs1.PV(discountCurve);

            return(value1);
        }
Beispiel #28
0
 public static object _ValueZARSwap1Curve(object[,] swap,
                                          object[,] valueDate,
                                          object[,] curve)
 {
     try
     {
         IRSwap             _swap      = XU.GetObject0D <IRSwap>(swap, "swap");
         Date               _valueDate = XU.GetDate0D(valueDate, "valueDate");
         IDiscountingSource _curve     = XU.GetObject0D <IDiscountingSource>(curve, "curve");
         Double             _result    = XLRates.ValueZARSwap1Curve(_swap, _valueDate, _curve);
         return(XU.ConvertToObjects(_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));
     }
 }
Beispiel #30
0
 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));
     }
 }