public void CalcForDateRange(String date_e, DBInst dbInst) {
		//获取当前时间
		SimpleDateFormat sdf	= new SimpleDateFormat("yyyyMMdd");  
		
		if (date_e.equals(DATE_NOW)) { 
			date_e = sdf.format(new Date()); 
		}
		
		log.info("calc from " + date_s + " to " + date_e);
		
		Date date;
		String date_str = "";
		
		try {
			
			Record record = new Record();
			
			date 		= sdf.parse(date_s);
			date_str	= sdf.format(date);
			
			while (Integer.parseInt(date_str) <= Integer.parseInt(date_e)) {
				double profit = CalcForProfit(date_str);
				Position position = CalcForPositionAmount(date_str);
				//System.out.println("date:" + date_str + ",profit:" + profit + ",amount:" + amount);
				
				//获取上证大盘的指数
				//StockPrice.PriceRecord sh_pr = sp.GetStockPrice(StockPrice.CODE_SZZS, TransDetailRecord.MARKET_SH, date_str);
				PriceRecord sh_pr = spn.GetStockPriceFromDB(TransDetailRecord.MARKET_SH, StockPrice.CODE_SZZS, date_str);
				
				//获取深证大盘的指数
				//StockPrice.PriceRecord sz_pr = sp.GetStockPrice(StockPrice.CODE_SZCZ, TransDetailRecord.MARKET_SZ, date_str);
				PriceRecord sz_pr = spn.GetStockPriceFromDB(TransDetailRecord.MARKET_SZ, StockPrice.CODE_SZCZ, date_str);
				
				record.date = date_str;
				record.sh_price	= sh_pr.close;
				record.sz_price	= sz_pr.close;
				record.total	= this.total;
				record.position	= position.amount;
				//record.rate		= (record.total == 0) ? 0 : record.position / record.total * 100;
				record.rate		= position.stock_num / 10 * 100;
				record.profit	= profit;
				
				//写入到DB中
				StoreRecordToDB(dbInst, record);
				
				date.setTime((date.getTime() / 1000 + 86400) * 1000);
				date_str = sdf.format(date);
			}
		} catch (Exception e) {
			log.error("calc from " + date_s + " to " + date_e + " failed!", e);
			e.printStackTrace();
		}
		
		ScanProfitRecord();
		
		//完成后把结束日期更新到标识文件中
		try {
			FileWriter fw;
			fw = new FileWriter(FLAG_FILE_DIR + flag_file, false);
	        String write_context = date_str + " " + String.valueOf(this.total) + " " + this.desc;
	        fw.write(write_context);
	        fw.close();
		} catch (Exception e) {
			log.error("save flag to " + FLAG_FILE_DIR + flag_file + " failed!");
			System.exit(0);
		}

	}