示例#1
0
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="pt">The pt.</param>
        /// <param name="interpolationType">The interpolation.</param>
        /// <param name="extrapolation">if set to <c>true</c> [extrapolation].</param>
        /// <param name="times">A vetical array of times.</param>
        /// <param name="values">A vertical array of values.</param>
        /// <returns>The value at that point.</returns>
        public Double GetPointValue(Double pt, string interpolationType, bool extrapolation, Excel.Range times, Excel.Range values)
        {
            List <double> unqtimes  = DataRangeHelper.StripDoubleRange(times);
            List <double> unqvalues = DataRangeHelper.StripDoubleRange(values);

            return(CurveAnalytics.GetValue(pt, interpolationType, extrapolation, unqtimes.ToArray(), unqvalues.ToArray()));
        }
示例#2
0
        ///<summary>
        /// Gets the interpolated value from the curve.
        ///</summary>
        ///<param name="baseDate">The based date.</param>
        ///<param name="targetDate">The target date.</param>
        /// <param name="interpolationType">The interpolation.</param>
        /// <param name="extrapolation">if set to <c>true</c> [extrapolation].</param>
        /// <param name="times">A vetical array of times.</param>
        /// <param name="values">A vertical array of values.</param>
        /// <returns>The value at that point.</returns>
        public Double GetDateValue(DateTime baseDate, DateTime targetDate, string interpolationType, bool extrapolation, Excel.Range times, Excel.Range values)
        {
            List <double> unqtimes  = DataRangeHelper.StripDoubleRange(times);
            List <double> unqvalues = DataRangeHelper.StripDoubleRange(values);
            IPoint        point     = new DateTimePoint1D(baseDate, targetDate);

            return(CurveAnalytics.GetDateValue(point, interpolationType, extrapolation, unqtimes.ToArray(), unqvalues.ToArray()));
        }
示例#3
0
 public void TestGetValue1()
 {
     foreach (var pt in testpts)
     {
         var result = CurveAnalytics.GetValue(pt, interp, true, times, rates);
         Debug.WriteLine(String.Format("rate : {0} Time: {1}", pt, result));
     }
 }
示例#4
0
 public void TestGetValue1()
 {
     foreach (var pt in Testpts)
     {
         var result = CurveAnalytics.GetValue(pt, Interp, true, Times, Rates);
         Debug.WriteLine($"rate : {pt} Time: {result}");
     }
 }
示例#5
0
        public void TestGetValue2()
        {
            var baseDate = new DateTime(2008, 3, 3);

            for (var i = 1; i < 10; i++)
            {
                var    targetDate = baseDate.AddMonths(3 * i);
                IPoint point      = new DateTimePoint1D(baseDate, targetDate);
                var    result     = CurveAnalytics.GetDateValue(point, interp, true, times, rates);
                Debug.WriteLine(String.Format("rate : {0} Date: {1}", targetDate, result));
            }
        }
示例#6
0
        public void TestGetValue2()
        {
            var baseDate = new DateTime(2008, 3, 3);

            for (var i = 1; i < 10; i++)
            {
                var    targetDate = baseDate.AddMonths(3 * i);
                IPoint point      = new DateTimePoint1D(baseDate, targetDate);
                var    result     = CurveAnalytics.GetDateValue(point, Interp, true, Times, Rates);
                Debug.WriteLine($"rate : {targetDate} Date: {result}");
            }
        }