Beispiel #1
0
 public static YieldTermStructure factory <Interpolator>(this ITraits <YieldTermStructure> self,
                                                         int settlementDays,
                                                         Calendar calendar,
                                                         DayCounter dayCounter,
                                                         List <Handle <Quote> > jumps = null,
                                                         List <Date> jumpDates        = null,
                                                         Interpolator interpolator    = default(Interpolator))
     where Interpolator : class, IInterpolationFactory, new()
 {
     if (self.GetType().Equals(typeof(Discount)))
     {
         return(new InterpolatedDiscountCurve <Interpolator>(settlementDays, calendar, dayCounter, jumps, jumpDates, interpolator));
     }
     else if (self.GetType().Equals(typeof(ZeroYield)))
     {
         return(new InterpolatedZeroCurve <Interpolator>(settlementDays, calendar, dayCounter, jumps, jumpDates, interpolator));
     }
     else if (self.GetType().Equals(typeof(ForwardRate)))
     {
         return(new InterpolatedForwardCurve <Interpolator>(settlementDays, calendar, dayCounter, jumps, jumpDates, interpolator));
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
 public static DefaultProbabilityTermStructure factory <Interpolator>(this ITraits <DefaultProbabilityTermStructure> self,
                                                                      int settlementDays,
                                                                      Calendar calendar,
                                                                      DayCounter dayCounter,
                                                                      List <Handle <Quote> > jumps = null,
                                                                      List <Date> jumpDates        = null,
                                                                      Interpolator interpolator    = default(Interpolator))
     where Interpolator : class, IInterpolationFactory, new()
 {
     if (self.GetType().Equals(typeof(SurvivalProbability)))
     {
         return(new InterpolatedSurvivalProbabilityCurve <Interpolator>(settlementDays, calendar, dayCounter, jumps, jumpDates, interpolator));
     }
     else if (self.GetType().Equals(typeof(HazardRate)))
     {
         return(new InterpolatedHazardRateCurve <Interpolator>(settlementDays, calendar, dayCounter, jumps, jumpDates, interpolator));
     }
     else if (self.GetType().Equals(typeof(DefaultDensity)))
     {
         return(new InterpolatedDefaultDensityCurve <Interpolator>(settlementDays, calendar, dayCounter, jumps, jumpDates, interpolator));
     }
     else
     {
         return(null);
     }
 }
Beispiel #3
0
 public static YieldTermStructure factory <Interpolator>(this ITraits <YieldTermStructure> self,
                                                         List <Date> dates,
                                                         List <double> discounts,
                                                         DayCounter dayCounter,
                                                         Calendar calendar,
                                                         Interpolator interpolator)
     where Interpolator : class, IInterpolationFactory, new()
 {
     if (self.GetType().Equals(typeof(Discount)))
     {
         return(new InterpolatedDiscountCurve <Interpolator>(dates, discounts, dayCounter, calendar, interpolator));
     }
     else if (self.GetType().Equals(typeof(ZeroYield)))
     {
         return(new InterpolatedZeroCurve <Interpolator>(dates, discounts, dayCounter, calendar, interpolator));
     }
     else if (self.GetType().Equals(typeof(ForwardRate)))
     {
         return(new InterpolatedForwardCurve <Interpolator>(dates, discounts, dayCounter, calendar, interpolator));
     }
     else
     {
         return(null);
     }
 }
Beispiel #4
0
 public static DefaultProbabilityTermStructure factory <Interpolator>(this ITraits <DefaultProbabilityTermStructure> self,
                                                                      List <Date> dates,
                                                                      List <double> densities,
                                                                      DayCounter dayCounter,
                                                                      Interpolator interpolator)
     where Interpolator : class, IInterpolationFactory, new()
 {
     if (self.GetType().Equals(typeof(HazardRate)))
     {
         return(new InterpolatedHazardRateCurve <Interpolator>(dates, densities, dayCounter, interpolator));
     }
     else if (self.GetType().Equals(typeof(DefaultDensity)))
     {
         return(new InterpolatedDefaultDensityCurve <Interpolator>(dates, densities, dayCounter, interpolator));
     }
     else
     {
         return(null);
     }
 }
Beispiel #5
0
 public static YieldTermStructure factory <Interpolator>(this ITraits <YieldTermStructure> self,
                                                         List <Date> dates,
                                                         List <double> discounts,
                                                         DayCounter dayCounter,
                                                         List <Handle <Quote> > jumps,
                                                         List <Date> jumpDates,
                                                         Interpolator interpolator = default(Interpolator))
     where Interpolator : class, IInterpolationFactory, new()
 {
     if (self.GetType().Equals(typeof(Discount)))
     {
         return(new InterpolatedDiscountCurve <Interpolator>(dates, discounts, dayCounter, jumps, jumpDates, interpolator));
     }
     else if (self.GetType().Equals(typeof(ForwardRate)))
     {
         return(new InterpolatedForwardCurve <Interpolator>(dates, discounts, dayCounter, jumps, jumpDates, interpolator));
     }
     else
     {
         return(null);
     }
 }