Placing Orders has issues

naveen278
When I place order

order = kiteSdk.placeOrder(orderParams, Constants.VARIETY_REGULAR);

I am getting kitehttp.exceptions.InputException.
I put all the values same as Zerodha website for orderParams but it is giving this exception.

Regards,
Naveen

Tagged:
  • SRIJAN
    SRIJAN edited June 2
    You can run javakiteconnect with debug logs or print the exception to know the exact issue.

    Do you have totp enabled?? That might be the issue.
  • naveen278
    how to enable totp?
  • SRIJAN
    Print the exception and you will know.
  • naveen278
    For placeOrder when I tried to catch InputException it is not allowing. It is giving compilation error.
  • naveen278
    I am getting from exception both as null

    Got the kite exception message : null
    Got the kite exception getLocalizedMessage : null
  • naveen278
    I have two factor authentication already but when I place orders with kiteSdk.placeOrder(orderParams, Constants.VARIETY_REGULAR);
    I am getting exception and when I print the message I get

    Got the kite exception message : null
  • naveen278
    what to do here?
  • naveen278
    Below is the order values set

    OrderParams orderParams = new OrderParams();
    orderParams.quantity = 1;
    orderParams.orderType = Constants.ORDER_TYPE_LIMIT;
    orderParams.tradingsymbol = "ASHOKLEY";
    orderParams.product = Constants.PRODUCT_CNC;
    orderParams.exchange = Constants.EXCHANGE_NSE;
    orderParams.transactionType = Constants.TRANSACTION_TYPE_BUY;
    orderParams.validity = Constants.VALIDITY_DAY;
    orderParams.price = 122.2;
    orderParams.triggerPrice = 0.0;
    orderParams.tag = "myTag"; //tag is optional and it cannot be more than 8 characters and only alphanumeric is allowed
    System.out.println("The connectoKite Step 7 " );
  • naveen278
    its giving exception
  • SRIJAN
    You are placing order with limit price lower than the circuit .
  • naveen278
    I changed it to circuit price still not working
  • naveen278
    I changed to 143.85 still not working. Also exception does not have any clear message causing more confusion and problems.
  • SRIJAN
    Run javakiteconnect with debug logs on and paste the logs here.
  • naveen278
    naveen278 edited June 2
    This is the error


    Jun 02, 2022 3:40:17 PM okhttp3.internal.platform.Platform log
    INFO: --> GET https://api.kite.trade/user/margins/equity
    Jun 02, 2022 3:40:17 PM okhttp3.internal.platform.Platform log
    INFO: User-Agent: javakiteconnect/3.1.14
    Jun 02, 2022 3:40:17 PM okhttp3.internal.platform.Platform log
    INFO: X-Kite-Version: 3
    Jun 02, 2022 3:40:17 PM okhttp3.internal.platform.Platform log
    INFO: Authorization: token sdsdfasdfassfsh4:adsfjkladsjfklja5gNriJ4tHY5e
    Jun 02, 2022 3:40:17 PM okhttp3.internal.platform.Platform log
    INFO: --> END GET
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: <-- 200 https://api.kite.trade/user/margins/equity (320ms)
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: date: Thu, 02 Jun 2022 10:10:18 GMT
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: content-type: application/json
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: cf-cache-status: DYNAMIC
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: strict-transport-security: max-age=15552000; includeSubDomains
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: server: cloudflare
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: cf-ray: 714f65ffaaed1d35-BLR
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO:
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: {"status":"success","data":{"enabled":true,"net":1108,"available":{"adhoc_margin":0,"cash":1108,"opening_balance":1108,"live_balance":1108,"collateral":0,"intraday_payin":0},"utilised":{"debits":0,"exposure":0,"m2m_realised":0,"m2m_unrealised":0,"option_premium":0,"payout":0,"span":0,"holding_sales":0,"turnover":0,"liquid_collateral":0,"stock_collateral":0,"delivery":0}}}
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: <-- END HTTP (374-byte body)
    The connectoKite Step 6
    The margin cash is 1108
    The uttilized debits is 0
    The connectoKite Step 7
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: --> POST https://api.kite.trade/orders/regular
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: Content-Type: application/x-www-form-urlencoded
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: Content-Length: 150
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: User-Agent: javakiteconnect/3.1.14
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: X-Kite-Version: 3
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: Authorization: token aws2uxxxxxxxxh4:ooppsakksdirfksflakjsfdlkjsfd
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO:
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: product=CNC&quantity=1&trigger_price=0.0&price=142.05&tradingsymbol=ASHOKLEY&exchange=NSE&validity=DAY&tag=myTag&transaction_type=BUY&order_type=LIMIT
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: --> END POST (150-byte body)
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: <-- 400 https://api.kite.trade/orders/regular (48ms)
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: date: Thu, 02 Jun 2022 10:10:18 GMT
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: content-type: application/json
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: content-length: 357
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: cf-cache-status: DYNAMIC
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: strict-transport-security: max-age=15552000; includeSubDomains
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: server: cloudflare
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: cf-ray: 714f66002bad1d35-BLR
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO:
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: {"status":"error","message":"LIMIT orders are not allowed during post-market session. Try placing a CNC Market order. [Read more.](https://support.zerodha.com/category/trading-and-markets/margin-leverage-and-product-and-order-types/articles/what-does-the-error-16473-only-board-lot-market-orders-are-allowed-mean)","data":null,"error_type":"InputException"}
    Jun 02, 2022 3:40:18 PM okhttp3.internal.platform.Platform log
    INFO: <-- END HTTP (357-byte body)
    Got the kite exception message : null
    Got the kite exception getLocalizedMessage : null
    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:359)
    at KiteConnectValue.connectoKite(KiteConnectValue.java:251)
    at AlgoTrade.main(AlgoTrade.java:1521)
    The connectoKite Step 7A
    The connectoKite Step 8
  • naveen278
    right now since Market is closed it is giving another error to place when market is open.
  • naveen278
    have to put the actual error only tommorow.
  • SRIJAN
    The error is self explanatory. You can't use LIMIT orders in post-market session.
  • sujith
    @naveen278,
    Don't post app or client specific tokens on the public threads.
  • naveen278
    The error is self explanatory. You can't use LIMIT orders in post-market session.This is now but earlier when the market is was open it was not the issue. will try when market is open.
  • naveen278
    It is giving this error for placing order

    INFO: {"status":"error","message":"TOTP is mandatory to place orders on third-party apps. Learn how to set up TOTP for your account [here](https://support.zerodha.com/category/your-zerodha-account/login-credentials/login-credentials-of-trading-platforms/articles/time-based-otp-setup-mobile-only).","data":null,"error_type":"InputException"}
    Jun 03, 2022 12:35:50 PM okhttp3.internal.platform.Platform log
  • SRIJAN
    SRIJAN edited June 3
    Seriously,do you even read anything provided to you?? I asked you about totp at the very start of the thread,and you said you have it enabled already.
  • naveen278
    I had enabled it already but later it started working fine. I think APi has issues and took some time to make it work
Sign In or Register to comment.