public static List <string> ToCsv(this List <ForexTimePeriodStats> timeStats, bool withHeader = false)
        {
            List <string> csv = new List <string>();

            if (withHeader)
            {
                csv.Add(ForexTimePeriodStats.ToTimeStatCsvHeader());
            }

            foreach (ForexTimePeriodStats rec in timeStats)
            {
                csv.Add(rec.ToTimeStatCsv());
            }
            return(csv);
        }
        static async Task getIndicators()
        {
            var ntpIndicatorData      = new NtpIndicatorData();
            List <IndicatorData> recs = await ntpIndicatorData.GetIndicatorsForCcyAndName("USD", "Non-Farm Employment Change");

            List <string> csvList  = new List <string>();
            List <string> csvStats = new List <string>();

            csvStats.Add(ForexTimePeriodStats.ToTimeStatCsvHeader());
            foreach (var rec in recs)
            {
                // Console.WriteLine(rec.ReleaseDateTime.AddHours(2));
                var dt = DateTime.Parse(rec.ReleaseDate + " " + rec.ReleaseTime).AddHours(6).AddMinutes(1);
                rec.ReleaseDateTime = dt;
                Console.WriteLine(rec.ReleaseDateTime);

                var fxp = new ForexPrices();
                try
                {
                    fxp.Read(dt, "EURUSD");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    continue;
                }
                fxp.PriceRecords = fxp.PriceRecords
                                   .Where(r => r.PriceDateTime.TimeOfDay >= rec.ReleaseDateTime.TimeOfDay && r.PriceDateTime.TimeOfDay <= rec.ReleaseDateTime.AddMinutes(180).TimeOfDay)
                                   .ToList();
                Console.WriteLine("price recs: " + fxp.PriceRecords.Count());
                Console.WriteLine("");
                //csvList.AddRange(fxp.PriceRecords.ToCsvListOHLC());
                //csvList.Add("");
                if (fxp.SymbolTimeStats.Count() > 0)
                {
                    csvStats.AddRange(fxp.SymbolTimeStats.ToCsv());
                }
                else
                {
                    Console.WriteLine("no recs");
                }
            }

            // File.WriteAllLines("nfpList.csv", csvList.ToArray());
            File.WriteAllLines("nfpListTimeStats.csv", csvStats.ToArray());
        }