コード例 #1
0
ファイル: ModuleSpread.cs プロジェクト: TigerSCR/TigerAppWPF
        //montant*(a+b*(z)) avec z=duration-c
        protected override void calculate(List <Title> source)
        {
            //formule temp en attendant les accesseurs
            foreach (Title t0 in source)
            {
                int           x, y;
                double        a, b, c, z;
                TitleNominale t = t0 as TitleNominale;

                x = ((int)t.GetMaturity.TotalDays / 365) / 5;
                c = x * 5;
                y = t.GetRating;
                z = t.GetDuration - c;

                /*inutile désormais on dit directement dans title que pas de rating = 7
                 * if(y==null)
                 *  y=7;*/

                if (t is Corp)
                {
                    a = corp_A[x, y];
                    b = corp_B[x, y];

                    results.Add(t, t.Total * a * b * z);
                }
                else if (t is Govt && DataConfig.getDataConfig().ListUE.Contains(t.Country))
                {
                    a = covered_A[x, y];
                    b = covered_B[x, y];

                    results.Add(t, t.Total * a * b * z);
                }
                else
                {
                    a = nonEEA_A[x, y];
                    b = nonEEA_B[x, y];

                    results.Add(t, t.Total * a * b * z);
                }
            }
        }
コード例 #2
0
        public Title(string _isin, int _qtty, string country, string currency, string name, double value, int _id_Mcorp, string _name_Mcorp, int rating)
        {
            this.isin       = _isin;
            this.qtty       = _qtty;
            this.country    = country;
            this.currency   = currency;
            this.name       = name;
            this.value      = value;
            this.id_Mcorp   = _id_Mcorp;
            this.name_Mcorp = _name_Mcorp;
            this.rating     = rating;

            config = DataConfig.getDataConfig();
            if (config.ListOCDE.Contains(this.country))
            {
                this.oecd = true;
            }
            if (config.ListUE.Contains(this.country))
            {
                this.eu = true;
            }

            this.total = this.value * this.qtty;
        }