示例#1
0
 public void SetUp()
 {
     _field = new NormalizedBasicEPSGrowth();
     _field.SetPeriodValue("3M", 1);
     _field.SetPeriodValue("1Y", 5);
     _field.SetPeriodValue("2Y", 2);
 }
示例#2
0
        public void NonEmptyStoreToString()
        {
            var field = new NormalizedBasicEPSGrowth();

            field.SetPeriodValue(QuantConnect.Data.Fundamental.Period.OneYear, 1);
            field.SetPeriodValue(QuantConnect.Data.Fundamental.Period.TenYears, 10);

            Assert.AreEqual($"{QuantConnect.Data.Fundamental.Period.OneYear}:1;" +
                            $"{QuantConnect.Data.Fundamental.Period.TenYears}:10", field.ToString());
        }
示例#3
0
        public void SetPeriodValue()
        {
            var field = new NormalizedBasicEPSGrowth();

            // add the default value
            field.SetPeriodValue(QuantConnect.Data.Fundamental.Period.OneYear, 1);
            field.SetPeriodValue(QuantConnect.Data.Fundamental.Period.TenYears, 10);

            Assert.IsTrue(field.HasValue);
            Assert.AreEqual(1, field.Value);
            var names = field.GetPeriodNames().ToList();

            Assert.AreEqual(QuantConnect.Data.Fundamental.Period.OneYear, names[0]);
            Assert.AreEqual(QuantConnect.Data.Fundamental.Period.TenYears, names[1]);

            var values = field.GetPeriodValues();

            Assert.AreEqual(2, values.Count);
            Assert.AreEqual(1, values[QuantConnect.Data.Fundamental.Period.OneYear]);
            Assert.AreEqual(10, values[QuantConnect.Data.Fundamental.Period.TenYears]);
        }
示例#4
0
        public void EmptyStoreSetPeriodValue()
        {
            var field = new NormalizedBasicEPSGrowth();

            // add the default value
            field.SetPeriodValue(QuantConnect.Data.Fundamental.Period.OneYear, 1);

            Assert.IsTrue(field.HasValue);
            Assert.AreEqual(1, field.Value);
            Assert.AreEqual(QuantConnect.Data.Fundamental.Period.OneYear, field.GetPeriodNames().Single());

            var values = field.GetPeriodValues();

            Assert.AreEqual(1, values.Count);
            Assert.AreEqual(1, values.First().Value);
            Assert.AreEqual(QuantConnect.Data.Fundamental.Period.OneYear, values.First().Key);
        }
示例#5
0
        public void UpdateValues()
        {
            var field = new NormalizedBasicEPSGrowth();

            // add the default value
            field.SetPeriodValue(QuantConnect.Data.Fundamental.Period.OneYear, 1);

            // update the default value
            var data = new Dictionary <string, decimal> {
                { QuantConnect.Data.Fundamental.Period.OneYear, 2 }
            };

            field.UpdateValues(new NormalizedBasicEPSGrowth(data));

            Assert.IsTrue(field.HasValue);
            Assert.AreEqual(2, field.Value);
            Assert.AreEqual(QuantConnect.Data.Fundamental.Period.OneYear, field.GetPeriodNames().Single());

            var values = field.GetPeriodValues();

            Assert.AreEqual(1, values.Count);
            Assert.AreEqual(2, values.First().Value);
            Assert.AreEqual(QuantConnect.Data.Fundamental.Period.OneYear, values.First().Key);
        }