public Portfolio getPortfolio(){
		HashMap<String,String> var = new HashMap<String,String>();
		String result = apiCall(CMD.PORTFOLIO,var);
		JSONObject jsonPortfolio = new JSONObject(result);
		String status = jsonPortfolio.getString(STATUS);
		//check if request was successful
		if(!status.equals(OK)) return null;
		
		Portfolio portfolio = new Portfolio();
		
		//get position information
		
		JSONArray positions = new JSONArray();
		/* 
		 * try to get the array, but if there is no positions,
		 * there won't be an JSONArray object, so an exception will be thrown
		 */
		try{
			positions = jsonPortfolio.getJSONArray("portfolio");
		}catch(JSONException e){}
		
		for(int i =0; i<positions.length();i++){
			JSONObject pos = positions.getJSONObject(i);
			String symbol = pos.getString("symbol");
			String name = pos.getString("name");
			long quantity = pos.getLong("quantity");
			double bookValue = pos.getDouble("bookvalue");
			double marketValue = pos.getDouble("marketvalue");
			
			portfolio.addPosition(symbol, name, quantity, bookValue, marketValue);
		}
		
		//get balance information
		result = apiCall(CMD.BALANCE,var);
		JSONObject jsonBalance = new JSONObject(result);
		status = jsonBalance.getString(STATUS);
		//check if request was successful
		if(!status.equals(OK)) return null;
		
		JSONObject balance = jsonBalance.getJSONObject("balance");
		portfolio.balance = balance.getDouble("balance");
		portfolio.balanceAvailable = balance.getDouble("balanceavailable");
		
		return portfolio;
	}