Пример #1
0
        public void DownloadExcel(DateTime date, string stockCode, string stockName)
        {
            var httpDownloader = new HTTP();
            var url            = string.Format("http://market.finance.sina.com.cn/downxls.php?date={0}&symbol={1}", string.Format("{0:yyyy-MM-dd}", date), Convertor.AddStockCodePrefix(stockCode));
            var filePath       = string.Format(@"F:\Excel\{0}{1}{2:yyyyMMdd}.xls", stockCode, stockName, date);

            filePath = filePath.Replace("*", "[星]");
            if (!File.Exists(filePath))
            {
                var data = httpDownloader.GetFile(url);
                File.WriteAllBytes(filePath, data);
                ThreadManager.Pause(seconds: 3);
            }
        }