Error while placing braket order using API

Pooja
i got error while placing bracket order using API (placeBracketOrder)

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:85)
at com.zerodhatech.kiteconnect.KiteConnect.placeOrder(KiteConnect.java:290)
at kiteconnect.Examples.placeBracketOrder(Examples.java:87)
at kiteconnect.LiveTest.main(LiveTest.java:165)


I am using the same same example which is given in below link

https://github.com/zerodhatech/javakiteconnect/blob/master/sample/src/Examples.java#L62

Please let me know what is the issue
  • sujith
    Can you print the error message in the exception? An input exception means you are sending an invalid param.
  • Pooja
    Pooja edited July 2019
    Thanks for response

    but i got only that much error.

    and i am using below code for placing bracket order
     /** Place bracket order.*/
    public void placeBracketOrder(KiteConnect kiteConnect) {
    /** Bracket order:- following is example param for bracket order*
    * trailing_stoploss and stoploss_value are points and not tick or price
    */
    try {
    System.out.println("Inside Method");
    OrderParams orderParams = new OrderParams();
    orderParams.quantity = 1;
    orderParams.orderType = Constants.ORDER_TYPE_LIMIT;
    orderParams.price = 30.5;
    orderParams.transactionType = Constants.TRANSACTION_TYPE_BUY;
    orderParams.tradingsymbol = "ASHOKLEY";
    orderParams.trailingStoploss = 1.0;
    orderParams.stoploss = 2.0;
    orderParams.exchange = Constants.EXCHANGE_NSE;
    orderParams.validity = Constants.VALIDITY_DAY;
    orderParams.squareoff = 3.0;
    orderParams.product = Constants.PRODUCT_MIS;
    Order order10;
    try {
    order10 = kiteConnect.placeOrder(orderParams, Constants.VARIETY_BO);
    System.out.println(order10.orderId);
    } catch (KiteException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    }
    catch(Exception e) {
    e.printStackTrace();
    }

    Please let me know whats the issue .
    i am not able to do trading for that
  • sujith
    Can you run with debug logs on and check, you can enable debug logs as shown here?
Sign In or Register to comment.