public async Task FinvizEarningCalendarDownloaderTest() { var setting = new FinvizEarningCalendarSetting("CYBR"); var downloader = new FinvizEarningCalendarDownloader(setting); var url = setting.GetUrl(); Debug.WriteLine(url); var earningDate = await downloader.DownloadObjectTaskAsync().ConfigureAwait(false); var earningDates = await downloader.BatchDownloadObjectsTaskAsync( setting.GetUrls(tickers)).ConfigureAwait(false); Debug.WriteLine(earningDate.ToString()); foreach (var earning in earningDates) { Debug.WriteLine(earning.Ticker.PadRight(5) + " " + earning.ToString()); } var filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\earningCalendar.txt"; using (StreamWriter file = File.CreateText(filePath)) { foreach (var earning in earningDates) { file.WriteLine(earning.Ticker.PadRight(5) + " " + earning.ToString()); } } }
static async Task DownloadEarning(string tickers) { var setting = new FinvizEarningCalendarSetting("SPY"); var downloader = new FinvizEarningCalendarDownloader(setting); var earningDates = await downloader.BatchDownloadObjectsTaskAsync( setting.GetUrls(tickers)).ConfigureAwait(false); var earningList = earningDates.ToList(); earningList.Sort(Comparer <TickerEarningDate> .Create((d1, d2) => d1.EarningDate.CompareTo(d2.EarningDate))); var filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\earningCalendar.txt"; using (StreamWriter file = File.CreateText(filePath)) { foreach (var earning in earningList) { file.WriteLine(earning.Ticker.PadRight(5) + " " + earning.ToString()); } } // @"AAPL,YHOO,MSFT,GOOGL,CYBR,BA,ADBE,HDP,NEWR,WYNN,LVS,tsla,nflx,pcln,amzn, // FB,LNKD,TWTR,JD,JMEI,TKMR,CELG,BIIB,ICPT,PCYC,INCY,DATA,NOW,GILD,SPLK,TSO, // LNG,EOG,APC,GPRO,MSFT,CSCO,BRCM,INTC,NUAN,RCL,CYBR,MCO,DFS,AXP,MA,V,GS,BAC, // C,JUNO,KITE,BLUE,GMCR") }