public Position CalcForPositionAmount(String date) {
		
		log.info("start to calc position amount for date " + date);
		
		double position_amount	= 0;
		int stock_num = 0; //股票个数
		
		for (String key : td.trans_map.keySet().toArray(new String[0])) {
			
//			String[] arrs = key.split("\005");
//			String market	= arrs[0];
//			String code		= arrs[1];
			
			ArrayList<TransDetailRecord> list = td.trans_map.get(key);
			TransDetailRecord record		= null;
			TransDetailRecord record_pre	= record;
			
			int i;
			for (i = 0; i < list.size(); i++) {
				
				record = list.get(i);
				
				String stock_date	= record.date;
				
				//如果指定日期为入、出场当天，则都算仓位
				if (date.compareTo(stock_date) == 0) { 
					position_amount += record.deal_amount;
					stock_num++;
					break;
				}
				//找到指定日期的位置，然后判断其前一个交易是否为入场，如果是则算仓位
				else if (date.compareTo(stock_date) < 0) { 
					if ((record_pre != null) && (record_pre.opt == TransDetailRecord.OPT_IN)) { 
						position_amount += record_pre.deal_amount;
						stock_num++;
					}
					break;
				}
				
				record_pre	= record;
			}
			
			//如果遍历完了，说明指定日期大于所有交易，则如果最后的交易是买入，则计算仓位
			if (i == list.size()) { 
				if (record_pre.opt == TransDetailRecord.OPT_IN) { 
					position_amount += record_pre.deal_amount;
					stock_num++;
				}
			}
		}
		
		Position position = new Position();
		position.amount 	= position_amount;
		position.stock_num	= stock_num;
		
		return position;
	}