whats wrong in this order

shailu
i m firing limit order, what is wrong in this:
OrderParams orderParams = new OrderParams();
orderParams.quantity = 1;
orderParams.orderType = Constants.ORDER_TYPE_LIMIT;
orderParams.tradingsymbol = "PNB";
orderParams.product = Constants.PRODUCT_CNC;
orderParams.exchange = Constants.EXCHANGE_NSE;
orderParams.transactionType = Constants.TRANSACTION_TYPE_BUY;
orderParams.validity = Constants.VALIDITY_DAY;
orderParams.triggerPrice = 0.0;
orderParams.price= 41.25;
Order order = kite.placeOrder(orderParams, Constants.VARIETY_REGULAR);
Tagged:
  • shailu
    Getting this exception.

    Eror code:::com.zerodhatech.kiteconnect.kitehttp.exceptions.InputException::::::::null::::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:353)
  • sujith
    Can you paste the error response here? You can either do e.message or run with debug flag on and paste the json here.
  • shailu
    how to set debug flag
  • sujith
    You can refer to the example here.
  • shailu
    2021-11-22 10:34:46.562 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient :
    2021-11-22 10:34:46.562 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : product=CNC&quantity=1&trigger_price=0.0&price=40.9&tradingsymbol=PNB&exchange=NSE&validity=DAY&transaction_type=BUY&order_type=LIMIT
    2021-11-22 10:34:46.562 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : --> END POST (133-byte body)
    2021-11-22 10:34:46.587 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : <-- 400 https://api.kite.trade/orders/regular (24ms)
    2021-11-22 10:34:46.587 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : date: Mon, 22 Nov 2021 05:04:46 GMT
    2021-11-22 10:34:46.587 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : content-type: application/json
    2021-11-22 10:34:46.587 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : content-length: 335
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : cf-cache-status: DYNAMIC
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : strict-transport-security: max-age=15552000; includeSubDomains
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : server: cloudflare
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : cf-ray: 6b1f9e735e2f31f9-BOM
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient :
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : {"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"}
    2021-11-22 10:34:46.588 INFO 26909 --- [boundChannel-10] okhttp3.OkHttpClient : <-- END HTTP (335-byte body)
    Eror code:::com.zerodhatech.kiteconnect.kitehttp.exceptions.InputException::::::::null::::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:353)
  • shailu
    when i m doing get PNL and getting kite quotes the same way its returning,,,correct..
  • shailu
    pls
    can anyone let me kno,
  • rakeshr
    {"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"}
    You can go through the error message as shown in the above exception.
  • shailu
    i dont want 2FA eith thru GA or TOPTP..i have not enabled also, Why i m getting this. I am just running my webapp in auto mode, why i have to go to this route.
  • SRIJAN
    SRIJAN edited November 22
    @shailu totp is mandatory to place orders.
  • shailu
    where in developer portal it is specified, pls provide me the link.
  • sujith
    You can check out this thread.
  • shailu
    Update- 2 things.
    1. I did this TOTP set now, will again test tomm.
    2. orderParams.product changed to Constants.PRODUCT_MIS in place of CNC.
  • shailu
    Update:
    TOTP set/configured and logged in with TOTP and this is what i used and its working now.
    You can close this thread now. Thanks.

    OrderParams orderParams = new OrderParams();
    orderParams.quantity = 100;
    orderParams.orderType = Constants.ORDER_TYPE_LIMIT;
    orderParams.tradingsymbol = "PNB";
    orderParams.product = Constants.PRODUCT_MIS;
    orderParams.exchange = Constants.EXCHANGE_NSE;
    orderParams.validity = Constants.VALIDITY_DAY;
    orderParams.triggerPrice = 0.0;
    orderParams.price = 40.45;
    Order order = kite.placeOrder(orderParams, Constants.VARIETY_REGULAR);
This discussion has been closed.