Exemple #1
0
        private void buttonAverageVolume_Click(object sender, EventArgs e)
        {
            int symbolId = comboBoxCustomGroupMember.SelectedIndex;
            List <PointData> listStockData = _symbolService.GetSymbolTradeData(symbolId);

            int numberOfDays = int.Parse(textBoxNumberOfDays.Text);

            Volume volume        = new Volume();
            int    averageVolume = volume.CalculateAverageVolume(listStockData, numberOfDays);

            listBox1.Items.Add(symbolId + " Average Volume in Last " + numberOfDays + " Day[s] is " + averageVolume);
        }
Exemple #2
0
        public void CalculateAverageVolumeTest()
        {
            Volume           volume = new Volume();
            List <PointData> points = new List <PointData>();

            points.Add(new PointData()
            {
                Volume = 0
            });

            points.Add(new PointData()
            {
                Volume = 1000
            });

            points.Add(new PointData()
            {
                Volume = 2000
            });
            int average = volume.CalculateAverageVolume(points, 3);

            Assert.AreEqual(1000, average);
        }