public void DownloadPrices() { // FXIT-20171013 // var dt = new DateTime(2020, 1, 12); var dt = FileUtils.GetLastScrape(this._scrapeConfig.ForexiteDownload.ForexiteArchivePath); while (dt <= DateTime.Today) { if (dt.DayOfWeek == DayOfWeek.Saturday) { dt = dt.AddDays(1); continue; } ForexiteFile fx = new ForexiteFile(dt, this._scrapeConfig.ForexiteDownload.ForexiteArchivePath); emailBody.AppendLine(fx.NameZipFile()); try { fx.DownloadFile(); // dl.DownloadPriceFile(dt, this._scrapeConfig.ForexiteDownload.ForexiteArchivePath); } catch (Exception ex) { emailBody.AppendLine("error downloading: " + ex.Message); } dt = dt.AddDays(1); Thread.Sleep(2500); } }
static void pricesForWeek() { /* * var dtToday = DateTime.Now; * var dayOfWeek = Convert.ToInt16(dtToday.DayOfWeek); * var sun = dtToday.AddDays(dayOfWeek * -1); * var sat = sun.AddDays(6); */ // downloadMissingPriceFiles(); // var dt = DateTime.Now; var dr = DateTime.Now.ThisWeek(); var dr1 = DateTime.Now.AddDays(-11).WeekOf(); ForexiteFile fx = new ForexiteFile(DateTime.Now.Previous(DayOfWeek.Saturday)); dr = DateTime.Now.PreviousWeek(); ForexPrices fxp = new ForexPrices(); foreach (var dt in dr) { fxp.PriceRecords.AddRange(fx.GetForexPrices(dt).PriceRecords); } int t = 0; // fx.DownloadFile(); var csv = fxp.SymbolTimeStats.ToCsv(true); File.WriteAllLines("symbolTimeStats.csv", csv); int u = 0; }
static void pricesForMultipleDates() { // 6/5/2020 - 14:30 // 1/10/2020 - 14:30 ForexiteFile fx = new ForexiteFile(new DateTime(2020, 1, 10)); var recs = fx.GetPriceRecords("EURUSD"); // recs.AddRange(fx.GetPriceRecords(new DateTime(2020, 3, 6), "EURUSD")); recs.ToCsvFileOHLC("prices.csv", true); }