Get error in getOHCL() method

aakashps1995
i am getting error in third line,
whenever i call kiteConnect,getOHCL() method second time i am getting this error

String[] instrument = {"NSE:NIFTY BANK"};
double bnl = kiteConnect.getOHLC(instrument).get("NSE:NIFTY BANK").lastPrice;
double bnc = kiteConnect.getOHLC(instrument).get("NSE:NIFTY BANK").ohlc.close;

and error is

Exception in thread "main" com.zerodhatech.kiteconnect.kitehttp.exceptions.NetworkException at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:58)
at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20)
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.getRequest(KiteRequestHandler.java:82)
at com.zerodhatech.kiteconnect.KiteConnect.getOHLC(KiteConnect.java:535)


please tell me how to solve this error
  • sujith
    sujith edited January 2018
    Hi @aakashps1995,
    I tried with the same param and I got success response
    {"status":"success","data":{"NSE:NIFTY BANK":{"instrument_token":260105,"last_price":27041.2,
    "ohlc":{"open":26940.5,"high":27074.9,"low":26841.2,"close":26909.5}}}}


    Are you sure you have the updated jar?
    You can download new jar from repository's release page.
  • sujith
    You can enable debugging and check error message in the response.
  • aakashps1995
    Hii @sujith
    see this screen shot
    I got error when i call kiteConnect,getOHCL() method second time
    i already updated jar file,
    No how can i solve this ??

  • sujith
    If you are using new javakiteconnect, you can enable debugging like this.
    Can you paste the error message from server or response from the server?
  • aakashps1995
    aakashps1995 edited January 2018
    HI @sujith sir,
    i am getting this error message
    {"status": "error", "message": "Too many requests", "error_type": "NetworkException"}
  • sujith
    @aakashps1995,
    You can make only one request per second to that endpoint.
    You will have to basically request for all the instruments in one call.
This discussion has been closed.