public void SetUp() { _field = new NormalizedBasicEPSGrowth(); _field.SetPeriodValue("3M", 1); _field.SetPeriodValue("1Y", 5); _field.SetPeriodValue("2Y", 2); }
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()); }
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]); }
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); }
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); }