I am trying to retrieve ltp of multiple shares and I am getting an exception "IllegalStateException". But, if i loop the share list and retrieve each share ltp seperately, then there is no issue. Currently in my case, I am trying to retrieve 902 symbol LTP's (<1000). As far as i remember one can retrieve upto 1000 symbol LTP's in one go. I donot understand how to fix this. Can you check on this one?
java.lang.IllegalStateException: closed at okio.RealBufferedSource.select(RealBufferedSource.kt:220) at okhttp3.internal.Util.readBomAsCharset(Util.kt:256) at okhttp3.ResponseBody.string(ResponseBody.kt:187) at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:24) at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.getRequest(KiteRequestHandler.java:152) at com.zerodhatech.kiteconnect.KiteConnect.getLTP(KiteConnect.java:719)
The stack trace I did post it and it could be seen once approved since it's big. Meanwhile when i used debug mode, i see "414 Request-URI Too Large".
1) Can you tell me how many characters are allowed in the request url, so that I can reduce the number of shares in one call. If there is any other better solution, please let me know.
2) There are too much information during the debug mode, i would like to restrict to just "Request" and "Response" and any "errors". That's all , can you suggest me how to do it.
A 414 is a standard HTTP status code. It is not something that is imposed by Kite Connect. Since different tokens are of different lengths, you need to do some trial and error.
The debug logs print request header and body with response header and body. There is no additional filter for that. You can fork the library and add it. javakiteconnect is an open source project.
I have tested number of symbols to pass at one time for retrieving ltp values. People can make use of this if required.
Allowed number of characters in the url- 14720 (some near number above this value) "https://api.kite.trade/quote/ltp" (35 characters) For every symbol [9 extra count, 9 here belongs to "NSE%3A" and ("?i=" or "&i=")]
So identify number of symbols based on this information for each iteration of retrieving ltp values and then you can loop multiple times till your list of symbols are checked.
java.lang.IllegalStateException: closed
at okio.RealBufferedSource.select(RealBufferedSource.kt:220)
at okhttp3.internal.Util.readBomAsCharset(Util.kt:256)
at okhttp3.ResponseBody.string(ResponseBody.kt:187)
at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:24)
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.getRequest(KiteRequestHandler.java:152)
at com.zerodhatech.kiteconnect.KiteConnect.getLTP(KiteConnect.java:719)
PS: Make sure to remove app and client-specific tokens.
1) Can you tell me how many characters are allowed in the request url, so that I can reduce the number of shares in one call. If there is any other better solution, please let me know.
2) There are too much information during the debug mode, i would like to restrict to just "Request" and "Response" and any "errors". That's all , can you suggest me how to do it.
The debug logs print request header and body with response header and body. There is no additional filter for that. You can fork the library and add it. javakiteconnect is an open source project.
For the debug logs, i will try to check on that, thanks for the suggestion.
Allowed number of characters in the url- 14720 (some near number above this value)
"https://api.kite.trade/quote/ltp" (35 characters)
For every symbol [9 extra count, 9 here belongs to "NSE%3A" and ("?i=" or "&i=")]
So identify number of symbols based on this information for each iteration of retrieving ltp values and then you can loop multiple times till your list of symbols are checked.