public Map<String, List<Position>> getPositions() throws KiteException, JSONException, IOException {
        Map<String, List<Position>> positionsMap = new HashMap<>();
        JSONObject response = new KiteRequestHandler(proxy).getRequest(routes.get("portfolio.positions"), apiKey, accessToken);
        JSONObject allPositions = response.getJSONObject("data");
        positionsMap.put("net", Arrays.asList(gson.fromJson(String.valueOf(allPositions.get("net")), Position[].class)));
        positionsMap.put("day", Arrays.asList(gson.fromJson(String.valueOf(allPositions.get("day")), Position[].class)));
        return positionsMap;
    }
public Map < String , List < Position > > getPositions ( ) throws KiteException , JSONException , IOException { Map < String , List < Position > > positionsMap = new HashMap < > ( ) ; JSONObject response = new KiteRequestHandler ( proxy ) . getRequest ( routes . get ( "portfolio.positions" ) , apiKey , accessToken ) ; JSONObject allPositions = response . getJSONObject ( "data" ) ; positionsMap . put ( "net" , Arrays . asList ( gson . fromJson ( String . valueOf ( allPositions . get ( "net" ) ) , Position [ ] . class ) ) ) ; positionsMap . put ( "day" , Arrays . asList ( gson . fromJson ( String . valueOf ( allPositions . get ( "day" ) ) , Position [ ] . class ) ) ) ; return positionsMap ; }
Retrieves the list of positions.
@return List of positions.
@throws KiteException is thrown for all Kite trade related errors.
@throws JSONException is thrown when there is exception while parsing response.
@throws IOException is thrown when there is connection error.