public static double[] CreateTermArray(MaturityType maturityType, double maxTerm, double minTerm = 0, bool skipMinTerm = false)
        {
            decimal increment;

            switch (maturityType)
            {
            case MaturityType.Annually:
                increment = 1;
                break;

            case MaturityType.SemiAnnually:
                increment = decimal.Divide(1, 2);
                break;

            case MaturityType.Quarterly:
                increment = decimal.Divide(1, 4);
                break;

            case MaturityType.Monthly:
                increment = decimal.Divide(1, 12);
                break;

            case MaturityType.Custom:
            default:
                throw new NotImplementedException($"Cannot determine predefined terms for a curve of maturity type {maturityType}");
            }
            var minTermDecimal = (decimal)minTerm + (skipMinTerm ? increment : 0);
            var maxTermDecimal = (decimal)maxTerm;


            return(Array.ConvertAll(CreateArrayConstantIncrement(maxTermDecimal, increment, minTermDecimal), x => (double)x));
        }
Exemple #2
0
        public static string GetMaturityTypeString(MaturityType maturityType)
        {
            var stringLocalizer = (IStringLocalizer <Helper>)PrismApplicationBase.Current.Container.Resolve(typeof(IStringLocalizer <Helper>));

            switch (maturityType)
            {
            case MaturityType.Early:
                return(stringLocalizer.GetString("early"));

            case MaturityType.SemiEarly:
                return(stringLocalizer.GetString("semi_early"));

            case MaturityType.Intermediate:
                return(stringLocalizer.GetString("intermediate"));

            case MaturityType.SemiLate:
                return(stringLocalizer.GetString("semi_late"));

            case MaturityType.Late:
                return(stringLocalizer.GetString("late"));

            default:
                return("");
            }
        }
Exemple #3
0
        public void SetTermsAndRates(IDictionary <double, double> termsAndRates, MaturityType maturityType = MaturityType.Custom)
        {
            var terms = termsAndRates.Keys.ToArray();
            var rates = termsAndRates.Values.ToArray();

            SetTermsAndRates(terms, rates, maturityType);
        }
        public StreamingContent(string title, string desc, MaturityType maturity, double stars, GenreType genre)
        {
            Title    = title;
            Desc     = desc;
            Maturity = maturity;
            Stars    = stars;

            Genre = genre;
        }
Exemple #5
0
        public void SetMaturity_CheckFamilyFriendly(MaturityType rating, bool expectedFriendly)
        {
            StreamingContent content = new StreamingContent();

            content.Maturity = rating;
            bool actual   = content.IsFamilyFriendly;
            bool expected = expectedFriendly;

            Assert.AreEqual(actual, expected);
        }
Exemple #6
0
 public Movie(string title, string desc, MaturityType maturity, GenreType genre, double stars, double runTime)
     : base(title, desc, maturity, stars, genre)
 {
     RunTime = runTime;
 }
Exemple #7
0
 public KTimesPerYearCompTypeTransformer(MaturityType compoundingFrequency) : base(compoundingFrequency)
 {
 }
Exemple #8
0
 public void SetTermsAndRates(double[] terms, double[] rates, MaturityType maturityType = MaturityType.Custom)
 {
     Terms        = terms;
     MaturityType = maturityType;
     _rates       = rates;
 }
Exemple #9
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;
 }