public void BatchDownloadFinancialReport() { DbMongo mongo = new DbMongo(); mongo.connect(); String[] stocks = new string[] { "2379" }; foreach (String stock in stocks) { YearSeason yearseason = mongo.FinancialReport_FindLatest(stock); yearseason = (yearseason == null) ? new YearSeason(104, 1) : yearseason.next(); for (int year = 104; year <= 108; year++) { for (int season = 1; season <= 4; season++) { if (SeasonalReportReady(year, season)) { int try_count = 1; Boolean download_success = false; do { download_success = DownloadSeasonalReport(stock, year, season); Thread.Sleep(1000 * try_count); } while (!download_success && (try_count < 10)); } } } } }
public void DBSave(BsonDocument financial, String stock_index, int year, int season) { DbMongo db = new DbMongo(); db.connect(); db.FinancialReport_save(financial, stock_index, year, season); }
private void btn_query_Click(object sender, RoutedEventArgs e) { String stock_selected = (String)combo_stock_index.SelectedItem; StockTradeInfo[] hist = DbSql.GetStockTradeHistory(stock_selected, 50, true); show_kd(kd_canvas, hist); DbMongo mongo = new DbMongo(); mongo.connect(); financial_reports = mongo.FinancialReport_FindAll(stock_selected); show_financial(financial_reports); }