code: public Margin getMargins(String segment) throws KiteException, JSONException, IOException {
          String url = routes.get("user.margins.segment").replace(":segment", segment);
          JSONObject response = new KiteRequestHandler(proxy).getRequest(url, apiKey, accessToken);
          return gson.fromJson(String.valueOf(response.get("data")), Margin.class);
      }
docs: Gets account balance and cash margin details for a particular segment.
  Example for segment can be equity or commodity.
  @param segment can be equity or commodity.
  @return Margins object.
  @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.