void DownloadOneStock(StockServerFactory fact, int stockId, DateTime startDate, DateTime endDate) { if (!StockMarketChecker.IsChinaShanghaiStock(stockId)) { return; } Code curCode = Code.newInstance(StockMarketChecker.ToYahooStockId(stockId)); Duration duration = new Duration(startDate, endDate); StockHistoryServer history = fact.getStockHistoryServer(curCode, duration); if (history == null) { return; } int numberOfDate = history.getNumOfCalendar(); for (int i = 0; i < numberOfDate; i++) { SimpleDate dt = history.getCalendar(i); DotNetStock.Engine.Stock stock = history.getStock(dt); StockData data = StockDataAdapter.ToStockData(stock); StockSaver_.Add(data); } }
static int ConvertStockId(string symbol) { return(StockMarketChecker.YahooStockIdToInt(symbol)); }