InterruptedIOException while raising order for options

TR6675
Can't raise f&O orders via kiteconnect java api. As a end user, dont have much control but still tried resetting connection timeout in KiteRequestHandler. Still it didnt work.

GOt this error while raising nifty and banknifty order. Happening since last week. Got the same error even today.

java.io.InterruptedIOException: interrupted
last price 37849.5
at okio.Timeout.throwIfReached(Timeout.kt:98)
at okio.OutputStreamSink.write(Okio.kt:53)
at okio.AsyncTimeout$sink$1.write(AsyncTimeout.kt:103)
at okio.RealBufferedSink.flush(RealBufferedSink.kt:247)
at okhttp3.internal.http1.Http1ExchangeCodec.finishRequest(Http1ExchangeCodec.kt:155)
at okhttp3.internal.connection.Exchange.finishRequest(Exchange.kt:91)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:74)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:100)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:197)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:148)
at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:84)
at com.zerodhatech.kiteconnect.KiteConnect.placeOrder(KiteConnect.java:353)
at com.prashanth.LiveStreamsHandler$8.onTicks(LiveStreamsHandler.java:216)
at com.zerodhatech.ticker.KiteTicker$3.onBinaryMessage(KiteTicker.java:296)
at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
tick timestamp Thu Feb 17 10:59:41 IST 2022
  • SRIJAN
    SRIJAN edited February 2022
    Is it happening only for order placing?? Are you trying to place order inside onTicks?? If yes,you shouldn't be doing that. No logic should be put inside onTicks thread. You have to pass the ticks to another thread to perform computations and place orders without blocking the main onTicks thread.
  • TR6675
    Tried outside in a seperate thread. If it works, I will add business flow.

    Can you share some examples of NFO order in java? Examples has only for equities.

    Tried setting stop loss order, getting input exception. Worked for order type limit for same symbol

    OrderParams orderParams = new OrderParams();
    orderParams.disclosedQuantity=0;
    orderParams.validity = Constants.VALIDITY_DAY;
    orderParams.tradingsymbol = "MARUTI22FEB8600CE";
    orderParams.orderType = Constants.ORDER_TYPE_SL;
    orderParams.triggerPrice = 125d;
    orderParams.price=124d;
    orderParams.product = Constants.PRODUCT_NRML;
    orderParams.exchange = Constants.EXCHANGE_NFO;
    orderParams.transactionType = Constants.TRANSACTION_TYPE_SELL;

    Order order = kiteConnect.placeOrder(orderParams, Constants.VARIETY_REGULAR);

    Exception in thread "main" com.zerodhatech.kiteconnect.kitehttp.exceptions.InputException
    at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.dealWithException(KiteResponseHandler.java:54)
    at com.zerodhatech.kiteconnect.kitehttp.KiteResponseHandler.handle(KiteResponseHandler.java:20)
    at com.zerodhatech.kiteconnect.kitehttp.KiteRequestHandler.postRequest(KiteRequestHandler.java:86)
    at com.zerodhatech.kiteconnect.KiteConnect.placeOrder(KiteConnect.java:353)
    at com.prashanth.Examples.placeOrder(Examples.java:118)
    at com.prashanth.ClientClass.main(ClientClass.java:69)
  • sujith
    You can either run javakiteconnect with debug logs on or print the exception message.
  • TR6675
    The Kiteconnect exception thrown does not includes business information. It should include whats missing, currently just throws InputException. Earlier post includes the complete exception stack trace
  • SRIJAN
    @TR6675 You have to enable debug logs when you initialize KiteConnect object. Or you can catch and print the exception.
Sign In or Register to comment.