// Create the output file (StreamWriter) that will be used.
        public void CreateOutputFile(string pathname)
        {
            m_writer = GFile.CreateOutputFile(pathname, TickerOutput.CsvHeaders);

            /*//var loc = Assembly.GetExecutingAssembly().Location;
             * if (pathname != null)
             * {
             *  m_writer = new StreamWriter(pathname, append: true);
             * }
             * else
             * {
             *  string filename = string.Format("tickers_{0}.DF.csv", DateTime.Now.ToString("yyyy-MM-dd_HHmmss"));
             *  pathname = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename);
             *  m_writer = new StreamWriter(pathname, append: false);
             *  m_writer.WriteLine(TickerOutput.CsvHeaders);
             * }*/
        }
        public void GainersTask(bool display = false)
        {
            var headers = CoinMarketCapTicker.CsvHeaders + ",Exchanges";
            var writer  = GFile.CreateOutputFile("sploders_raw", headers);

            if (display)
            {
                Console.WriteLine(headers);
            }

            while (true)
            {
                var g24 = m_cmc.GetBiggestGainers24h();

                var now = DateTime.Now;
                m_rawGainers24[now] = new Dictionary <string, CoinMarketCapTicker>();
                int count = 0;
                foreach (var t in g24)
                {
                    m_rawGainers24[now][t.symbol] = t;

                    var mr = CoinMarketCapApi.GetMarkets(t.name);
                    var marketExchanges = mr.Select(m => m.exchange).Distinct();
                    //var mr = CoinMarketCapApi.GetMarkets(t.name, removeDuplicates: true);
                    //var marketExchanges = mr.Select(x => x.pair);
                    var exchanges = marketExchanges.Intersect(m_workingExchanges);
                    if (exchanges.Count() > 0)
                    {
                        var exchangesString = string.Join('|', exchanges);
                        var output          = string.Format("{0},{1}", t.ToCsv(), exchangesString);
                        if (display)
                        {
                            Console.WriteLine(output);
                        }
                        writer.WriteLine(output);
                        ++count;
                    }
                }
                writer.FlushAsync();
                var timeString = now.ToString("yyyy-MM-dd HH:mm:ss");
                Console.WriteLine("     {0}  {1} symbols output", timeString, count);

                Thread.Sleep(40000);
            }
        }