Example #1
0
 public Curve(CurveType curveType, CompoundingType compoundingType, MaturityType?compoundingFrequency, MaturityType maturityType, double[] terms, double[] rates)
 {
     SetTermsAndRates(terms, rates, maturityType);
     CurveType            = curveType;
     CompoundingType      = compoundingType;
     CompoundingFrequency = compoundingFrequency;
 }
        public AbstractCompTypeTransformer GetTransformer(CompoundingType compoundingType, MaturityType?compoundingFrequency = null)
        {
            switch (compoundingType)
            {
            case CompoundingType.Continuous:
                return(new ContinuousCompTypeTransformer());

            case CompoundingType.KTimesPerYear:
                return(new KTimesPerYearCompTypeTransformer(compoundingFrequency.Value));

            case CompoundingType.Simple:
                return(new SimpleCompTypeTransformer());

            default:
                throw new NotImplementedException($"Cannot get  transformer, unknown CompoundingType: {compoundingType}" !);
            }
        }