Exemplo n.º 1
0
 /// <summary>
 /// Kui XML andmed saavad failist loetud, valmistatakse finantsandmete tabel ja saadetakse päringud turuhindade osas.
 /// </summary>
 public void XmlDataReady()
 {
     if (_dataSource == DataSource.XML)
     {
         FinDataDao.SortFinDatas();
         if (FinDataDao.FinDatas.Count > 0)
         {
             YahooFScraper yh = new YahooFScraper(this);
             yh.GetPriceData(_finDataDao.FinDatas[0].BsSymbol);
             yh.GetIndexData("SPY");
             _inputVm.LaeAndmed(_finDataDao.FinDatas[0].BsSymbol);
             RatioCalculator.Calculate(_finDataDao.FinDatas);
             _finAnalysisVm.PrepareTable(_finDataDao.FinDatas);
             if (_mainWindow != null)
             {
                 _mainWindow.XmlReady(_xmlFile);
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Peamine (universaalne) meetod, mida kutsuda andmete valmistamiseks olenemata allikast, kust andmed pärit on
        /// </summary>
        public void PrepareData()
        {
            YahooFScraper yh = new YahooFScraper(this);
            _finAnalysisVm.ClearTable();
            if (_dataSource == DataSource.XML)
            {
                XmlScraper xmlScraper = new XmlScraper(this);
                xmlScraper.GetData(_xmlFile, _finDataDao, this);
                //FinDataDao.SortFinDatas();
                //if (FinDataDao.FinDatas.Count > 0)
                //{
                //    yh.GetPriceData(_finDataDao.FinDatas[0].BsSymbol);
                //    yh.GetIndexData("SPY");
                //    _inputVm.LaeAndmed(_finDataDao.FinDatas[0].BsSymbol);
                //    RatioCalculator.Calculate(_finDataDao.FinDatas);
                //    _finAnalysisVm.PrepareTable(_finDataDao.FinDatas);
                //}
            }
            if (_dataSource == DataSource.XLS)
            {
                yh.GetPriceData(_symbol);
                yh.GetIndexData("SPY");
                FinDataDao.SortFinDatas();
                RatioCalculator.Calculate(_finDataDao.FinDatas);
                _finAnalysisVm.PrepareTable(_finDataDao.FinDatas);
                if (_mainWindow != null)
                {
                    _mainWindow.YchartsReady();
                }

            }
        }