static void Main(string[] args) { Console.WriteLine("Creating stock dictionary"); Dictionary <string, Stock> stocks = new Dictionary <string, Stock>(); Console.WriteLine("Checking to see if there is already an data analysis for today"); if (File.Exists("stocksWithIndicators.bin") && new FileInfo("stocksWithIndicators.bin").CreationTime.Date == DateTime.Now.Date) { Console.WriteLine("There is. Recovering file"); StockState ss = new StockState(); stocks = ss.Deserialize("stocksWithIndicators.bin"); } else { Console.WriteLine("There is not. Procceding with Analysis."); Console.WriteLine("Getting most recent stock market file"); HistoryFileSelector hfs = new HistoryFileSelector(@"C:\Users\Cliente\Downloads"); string mostRecent = hfs.GetMostRecentFileFullPath(); Console.WriteLine("Reading data from file"); stocks = Reader.GetAllStockData(mostRecent); Console.WriteLine("Analyzing data"); sw.Start(); MarketHistoryAnalyzer.FillAllWithDefaults(stocks, PrintProgress); sw.Stop(); Console.WriteLine("Saving to disk"); StockState sc1 = new StockState(stocks); sc1.Serialize("stocksWithIndicators.bin"); } Console.WriteLine("Removing stocks not traded every day"); List <Stock> tradedEveryday = StockComparer.RemoveStocksNotTradedEveryday(stocks); Console.WriteLine("Creating Stock Comparator"); StockComparer sc = new StockComparer(tradedEveryday); Console.WriteLine("Running comparison"); //List<Stock> rankedStocks = StockComparer.RankOfBestStocks(tradedEveryday); sc.RankStocksByCompare(); Console.WriteLine("Saving to disk"); StockState sc2 = new StockState(sc.RankedStocks); sc2.Serialize("rankedStocks.bin"); Console.WriteLine("Emailing results"); EmailNotifier en = new EmailNotifier("ff12sender", "33914047"); en.Send(sc.RankedStocks); Console.WriteLine("All done. Check your email"); Console.WriteLine("Press any key to exit"); Console.ReadKey(); }
public void TestRankOfBestStocks() //static { //Dictionary<string, Stock> allStocks = Reader.GetAllStockData("COTAHIST_A2016.TXT"); MarketHistoryAnalyzer.FillAllWithDefaults(allStocks); List <Stock> stkRank = StockComparer.RankOfBestStocks(allStocks); }
public void TestFillAllWithDefaults() { //Dictionary<string, Stock> allStocks = Reader.GetAllStockData("COTAHIST_A2016.TXT"); //Stock petr = allStocks["PETR3"]; MarketHistoryAnalyzer.FillAllWithDefaults(petr); }
public void TestRankObjectLevel() { //Dictionary<string, Stock> allStocks = Reader.GetAllStockData("COTAHIST_A2016.TXT"); MarketHistoryAnalyzer.FillAllWithDefaults(allStocks); StockComparer sc = new StockComparer(allStocks); sc.RankBestStocks(); List <Stock> rank = sc.RankedStocks; }
public void TestQuantityOfIndicators() { //Dictionary<string, Stock> allStocks = Reader.GetAllStockData("COTAHIST_A2016.TXT"); //Stock petr = allStocks["PETR3"]; int indsBefore = petr.indicators.QuantityOfIndicators; MarketHistoryAnalyzer.FillAllWithDefaults(petr); int indsAfter = petr.indicators.QuantityOfIndicators; }
public bool RunAnalysis() { //UpdateLabel ul = new UpdateLabel(updateInfoLabel); updateInfoLabel("Creating stock dictionary"); Dictionary <string, Stock> stocks = new Dictionary <string, Stock>(); //string filePath = fileLocationTxtBox.Text; updateInfoLabel("Reading data from file"); stocks = Reader.GetAllStockData(fileLocation); updateInfoLabel("Analyzing data"); MarketHistoryAnalyzer.FillAllWithDefaults(stocks, SetProgress); updateInfoLabel("Saving to disk"); StockState sc1 = new StockState(stocks); sc1.Serialize("stocksWithIndicators.bin"); updateInfoLabel("Removing stocks not traded every day"); List <Stock> tradedEveryday = StockComparer.RemoveStocksNotTradedEveryday(stocks); updateInfoLabel("Creating Stock Comparator"); StockComparer sc = new StockComparer(tradedEveryday); updateInfoLabel("Running comparison"); sc.RankStocksByCompare(); updateInfoLabel("Saving to disk"); StockState sc2 = new StockState(sc.RankedStocks); sc2.Serialize("rankedStocks.bin"); updateInfoLabel("Emailing results"); EmailNotifier en = new EmailNotifier("ff12sender", "33914047"); en.Send(sc.RankedStocks); updateInfoLabel("All done. Check your email"); return(true); }
public void TestFillAllWithDefaultsWithList() { //Dictionary<string, Stock> allStocks = Reader.GetAllStockData("COTAHIST_A2016.TXT"); Stock stk1 = allStocks["PETR3"]; Stock stk2 = allStocks["ABEV3"]; Stock stk3 = allStocks["BBAS3"]; Stock stk4 = allStocks["BBDC3"]; Stock stk5 = allStocks["EMBR3"]; List <Stock> allS = new List <Stock>(); allS.Add(stk1); allS.Add(stk2); allS.Add(stk3); allS.Add(stk4); allS.Add(stk5); MarketHistoryAnalyzer.FillAllWithDefaults(allS); }
public void TestFillAllWithDefaultsWithDictionary() { //Dictionary<string, Stock> allStocks = Reader.GetAllStockData("COTAHIST_A2016.TXT"); MarketHistoryAnalyzer.FillAllWithDefaults(allStocks); }