void ValidateCompaniesVolume()
        {
            List <string> volumeCompanies = volumeChartBindingData.Select(c => c.CompanyName).ToList();
            List <string> exceptCompanies = companies.Except(volumeCompanies).ToList();

            for (int i = 0; i < volumeChartBindingData.Count; i++)
            {
                CompaniesVolumeData volumeData = volumeChartBindingData[i];
                if (!companies.Contains(volumeData.CompanyName))
                {
                    var res = watchLisBindingData.Where(c => exceptCompanies.Contains(c.CompanyName)).ToList();
                    if (res.Count > 0)
                    {
                        double maxVolume = res.Max(c => c.Volume);
                        CompanyTradingDataViewModel vm = watchLisBindingData.Where(c => c.Volume == maxVolume).Select(c => c).FirstOrDefault();
                        exceptCompanies.Remove(vm.CompanyName);
                        volumeChartBindingData[i] = new CompaniesVolumeData()
                        {
                            CompanyName = vm.CompanyName,
                            Volume      = (int)maxVolume
                        };
                    }
                }
            }
        }
 void GetVolumeDynamicsDataAsyncCompleted(CompanyStockData[] cd)
 {
     foreach (CompanyStockData companyStockData in cd)
     {
         CompanyTradingDataViewModel vm = watchLisBindingData.Where(c => c.CompanyName == companyStockData.CompanyName).Select(c => c).FirstOrDefault();
         vm.VolumeDynamics = CreateVolumeDynamicsBindingData(companyStockData.Data);
     }
     TryEndUpdateBindingData();
 }
        void UpdateVolumeDynamicsAsyncCompleted(CompanyStockData[] cd)
        {
            foreach (CompanyStockData companynStockData in cd)
            {
                try {
                    if (companynStockData.Data.Length == 0)
                    {
                        continue;
                    }
                    DateTime                    current = dates[currentDate];
                    CompanyTradingData          ctd     = GetCompanyTradingData(companynStockData.Data[0], current);
                    CompanyTradingDataViewModel vm      = watchLisBindingData.Where(c => c.CompanyName == companynStockData.CompanyName).Select(c => c).FirstOrDefault();
                    if (vm == null)
                    {
                        continue;
                    }
                    IList <TradingDataViewModel> volDyn = vm.VolumeDynamics as IList <TradingDataViewModel>;

                    if (vm.VolumeDynamics == null || ((IList)vm.VolumeDynamics).Count == 0)
                    {
                        return;
                    }
                    if (tickCount == 2)
                    {
                        ctd.Volume = Math.Round((ctd.Volume / 1000000), 2);
                        volDyn.Add(new TradingDataViewModel(ctd));
                    }
                    if (tickCount != 2)
                    {
                        TradingDataViewModel tdvm = new TradingDataViewModel(volDyn[volDyn.Count - 1].TradingData);
                        tdvm.Volume = Math.Round((ctd.Volume / 1000000), 2);
                        tdvm.Close  = ctd.Close;
                        tdvm.Low    = lowestPrice;
                        tdvm.High   = highestPrice;
                        tdvm.Price  = ctd.Price;
                        volDyn[volDyn.Count - 1] = tdvm;
                    }
                }
                catch {
                    currentDate++;
                    UpdateStockChartBindingDataAsync();
                }
            }
            TryEndUpdateBindingData();
        }