I am trying to retrieve open positions and seeing the following exception...Can somebody help here? This was working yesterday... Code: (Kite 3.0 Java API client ) kiteConnect.getPositions();
Error:
com.zerodhatech.kiteconnect.kitehttp.exceptions.GeneralException at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:52) ~[classes/:?] at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20) ~[classes/:?] at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.getRequest(KiteRequestHandler.java:53) ~[classes/:?] at com.zerodhatech.kiteconnect.KiteConnect.getPositions(KiteConnect.java:436) ~[classes/:?] at com.ideas.trading.api.OrdersImpl.getPositions(OrdersImpl.java:40) ~[classes/:?] at com.ideas.trading.business.commands.ListPositionsCommand.execute(ListPositionsCommand.java:28) [classes/:?] at com.ideas.trading.business.CommandLineMenu.showPositions(CommandLineMenu.java:139) [classes/:?] at com.ideas.trading.business.CommandLineMenu.processInput(CommandLineMenu.java:109) [classes/:?] at com.ideas.trading.business.CommandLineMenu.showMenu(CommandLineMenu.java:87) [classes/:?] at com.ideas.trading.business.CommandLineMenu.showMenu(CommandLineMenu.java:91) [classes/:?] at com.ideas.trading.business.CommandLineMenu.showMenu(CommandLineMenu.java:91) [classes/:?] at com.ideas.trading.business.CommandLineMenu.showMenu(CommandLineMenu.java:91) [classes/:?] at com.ideas.trading.business.SmartTrader.showCommandLineMenu(SmartTrader.java:57) [classes/:?] at com.ideas.trading.business.SmartTrader.main(SmartTrader.java:53) [classes/:?]
Here are http log lines.....
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: <-- 404 Not Found https://api.kite.trade/portfolio/ordermgmt (95ms)
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: Server: nginx
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: Date: Thu, 26 Apr 2018 10:26:20 GMT
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: Content-Type: application/json
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: Content-Length: 90
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: Connection: keep-alive
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO:
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: {"status":"error","message":"Route not found","data":null,"error_type":"GeneralException"}
Apr 26, 2018 3:56:20 PM okhttp3.internal.platform.Platform log
INFO: <-- END HTTP (90-byte body)
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.ordermgmt"), 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;
}
positions endpoint is https://api.kite.trade/portfolio/positions