Exemplo n.º 1
0
 private static void DownloadSpecialStockonOneDay()
 {
     var aStock = new StockInfo {Symbol = "600004"};
     var oneDay = "20160215";
     var mgr = new StockManager();
     mgr.DownloadOneDaySpecialStock(aStock, oneDay);
 }
Exemplo n.º 2
0
        public static void SaveTo(StockInfo stockInfo, string from, string to)
        {
            var data = GetPriceFromNet(stockInfo.StockCode, from, to);

            using (var sw = new StreamWriter(CommonInfo.FilePath(stockInfo.Symbol)))
            {
                sw.Write(data);
            }
        }
Exemplo n.º 3
0
        public void Init()
        {
            stock603969 = new StockInfo();
            stock603969.StockType = StockType.SH;
            stock603969.Symbol = "603969";

            stock000016 = new StockInfo
            {
                StockType = StockType.SZ,
                Symbol = "000016",
            };
        }
Exemplo n.º 4
0
        public static List<StockInfo> GetStocksFor(string stockCodePosition, StockType stockType)
        {
            var stocks = new List<StockInfo>();
            using (var sr = new StreamReader(stockCodePosition))
            {
                while (!sr.EndOfStream)
                {
                    var line = sr.ReadLine();
                    var items = line.Split(new char[] {' '});
                    var aStockInfo = new StockInfo();

                    aStockInfo.Name = items[0];
                    aStockInfo.Symbol = items[1];
                    aStockInfo.StockType = stockType;

                    stocks.Add(aStockInfo);
                }
            }
            return stocks;
        }        
Exemplo n.º 5
0
 public void DownloadSpecialStock(StockInfo stockInfo, string from, string to)
 {
     BundleStock.SaveTo(stockInfo, from, to);
 }
Exemplo n.º 6
0
 public BundleStock DownloadOneDaySpecialStock(StockInfo stockInfo, string strDate)
 {
     return BundleStock.AppendTodayStock(stockInfo.StockCode, strDate);
 }
Exemplo n.º 7
0
 public BundleStock DownloadTodaySpecialStock(StockInfo stockInfo)
 {
     return BundleStock.AppendTodayStock(stockInfo.StockCode, DateTime.Now.ToString("yyyyMMdd"));
 }
Exemplo n.º 8
0
 public Stock(StockInfo info)
 {
     this.stockInfo = info;
 }
Exemplo n.º 9
0
 public static List<BundleStock> Load(StockInfo stockInfo)
 {
     var file = CommonInfo.FilePath(stockInfo.Symbol);
     var ret = new List<BundleStock>();
     using (var sr = new StreamReader(file))
     {
         while (!sr.EndOfStream)
         {
             var line = sr.ReadLine();
             var aStock = ConvertFrom(line);
             if (aStock != null && aStock.Close > 0)
                 ret.Add(aStock);
         }
     }
     return ret.OrderByDescending(it=>it.Date).ToList();
 }