コード例 #1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        static void Main(string[] args)
        {
            var urlFile = args.Count() > 0 && File.Exists(args[0]) ? args[0] : "UrlList.txt";

            UrlFileManager manager = new UrlFileManager(urlFile);

            Console.WriteLine("Reading file {0}\r\n\tUrl Count: {1}\r\n{2}",
                              manager.File, manager.Urls.Count(), new String('*', 35));

            foreach (var url in manager.Urls)
            {
                try
                {
                    CryptoCompareUrl model = new CryptoCompareUrl(url);

                    Console.WriteLine("Processing Url {0}\r\n\tType: {1}\r\n\tFrom Symbol: {2}",
                                      model.GetUrlPath(), model.GetUrlType(), model.FromSymbol);

                    OutputEtl etl = new JsonEtl();
                    Console.WriteLine("\tOutput: {0}\r\n{1}", model.GetRootFileName(), new String('*', 35));
                    etl.ToCsv(model);
                }
                catch (Exception ex)
                {
                    Console.Beep(500, 1000);
                    Console.WriteLine("Can't process url {0}\r\n{1}", url, ex.Message);
                    continue;
                }
            }
            Console.WriteLine("Finished processing urls");
            System.Threading.Thread.Sleep(1000 * 30);
        }
コード例 #2
0
        public void test_output_files()
        {
            UrlFileManager manager = new UrlFileManager();

            manager.Add(URL);

            CryptoCompareUrl model = new CryptoCompareUrl(manager.Urls.First());
            JsonEtl          etl   = new JsonEtl();

            etl.ToCsv(model);

            Assert.IsTrue(File.Exists("pairs_ACT@_100_record_Id.csv"));
            Assert.IsTrue(File.Exists("pairs_ACT@_100_exchange.csv"));
        }