Correct way to get ltp using KiteConnect.getLTP()

snikam
Hello All,

I'm using following code :
static {
symbolList = new String[10];
symbolList[0] = "NFO:NIFTY18JUN11100CE";
symbolList[1] = "NFO:NIFTY18JUN11000CE";
symbolList[2] = "NFO:NIFTY18JUN10900CE";
symbolList[3] = "NFO:NIFTY18JUN10800CE";
symbolList[4] = "NFO:NIFTY18JUN10700CE";
symbolList[5] = "NFO:NIFTY18JUN10700PE";
symbolList[6] = "NFO:NIFTY18JUN10600PE";
symbolList[7] = "NFO:NIFTY18JUN10500PE";
symbolList[8] = "NFO:NIFTY18JUN10400PE";
symbolList[9] = "NFO:NIFTY18JUN10300PE";
}
and later :
try {
quoteMap = kite.getLTP(symbolList);
} catch (JSONException e) {
msg = "JSONException in QuoteTest.getQuotes()";
LOGIN_LOGGER.info(msg);
return null;
} catch (IOException e) {
msg = "IOException in QuoteTest.getQuotes()";
LOGIN_LOGGER.info(msg);
return null;
} catch (KiteException e) {
msg = "KiteException in QuoteTest.getQuotes()";
LOGIN_LOGGER.info(msg);
return null;
}
All the time I'm getting KiteException .
I'm doing something terribly wrong?

- Sachin
  • tonystark
    Can you log "e.message"? It will have the error message.
  • snikam
    e.getMessage() gives null all the time.
  • tonystark
    Can you enable logging of KiteConnect by calling the setEnableLogging function immediately after initializing the KiteConnect instance?
  • snikam
    18-Jun-2018 08:28:17.373 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1850 ms
    18-Jun-2018 08:30:00.633 INFO [Timer-0] okhttp3.internal.platform.Platform.log --> GET https://api.kite.trade/quote/ltp?i=NFO:NIFTY18JUN11100CE&i=NFO:NIFTY18JUN11000CE&i=NFO:NIFTY18JUN10900CE&i=NFO:NIFTY18JUN10800CE&i=NFO:NIFTY18JUN10700CE&i=NFO:NIFTY18JUN10700PE&i=NFO:NIFTY18JUN10600PE&i=NFO:NIFTY18JUN10500PE&i=NFO:NIFTY18JUN10400PE&i=NFO:NIFTY18JUN10300PE
    18-Jun-2018 08:30:00.634 INFO [Timer-0] okhttp3.internal.platform.Platform.log User-Agent: javakiteconnect/3.0.0
    18-Jun-2018 08:30:00.634 INFO [Timer-0] okhttp3.internal.platform.Platform.log X-Kite-Version: 3
    18-Jun-2018 08:30:00.634 INFO [Timer-0] okhttp3.internal.platform.Platform.log Authorization: token xxxxxxx:null
    18-Jun-2018 08:30:00.634 INFO [Timer-0] okhttp3.internal.platform.Platform.log --> END GET
    18-Jun-2018 08:30:01.000 INFO [Timer-0] okhttp3.internal.platform.Platform.log <-- 403 Forbidden
  • tonystark
    Looks like your access token is invalid. Can you try with a new access token?
Sign In or Register to comment.