Пример #1
0
        public void Load(IEnumerable<int> stockids)
        {
            IStockDBReader reader = new StockMongoDBReader();
            foreach (int id in stockids)
            {
                StockHistory hist = new StockHistory();
                IEnumerable<StockData> stocks = reader.Load(id);

                hist.InitAllStocks(id, stocks);

                Histories_.Add(hist);
            }
        }
Пример #2
0
        public IStockHistory GetPartStockHistory(DateTime startDate, DateTime endDate)
        {
            if (startDate >= endDate)
            {
                throw new ArgumentException();
            }

            IStockHistory hist = new StockHistory();
            DateTime currentDate = startDate;
            while (currentDate < endDate)
            {
                IStockData sd = GetStock(currentDate);
                if (sd != null)
                {
                    hist.AddStock(currentDate, sd);
                }
                currentDate = DateFunc.GetNextWorkday(currentDate);
            }

            return hist;
        }