placeGTT throws InputException

fortunetrail
fortunetrail edited July 2022 in Java client
KiteConnect version: 3.2.1
Java version: 11.0.3

Context:
I've already bought 1 lot of NIFTY22AUGFUT (normal order).
Now I'm trying to place a GTT, stop loss order. Here's the code:

double ltp = this.getLtp();
triggerPrice = ltp - 4D;

GTTParams gttParams = new GTTParams();
gttParams.exchange = Constants.EXCHANGE_NFO;
gttParams.lastPrice = ltp;
gttParams.tradingsymbol = "NIFTY22AUGFUT";
gttParams.triggerPrices = new ArrayList(List.of(Double.valueOf(0D)));
gttParams.triggerType = Constants.SINGLE;

GTTParams.GTTOrderParams orderParams = gttParams.new GTTOrderParams();
orderParams.orderType = Constants.ORDER_TYPE_SLM;
orderParams.product = Constants.PRODUCT_NRML;
orderParams.quantity = ZerodhaTest.QUANTITY;
orderParams.transactionType = transactionType;

gttParams.orders = new ArrayList(List.of(orderParams));

gttParams.orders.get(0).price = triggerPrice;
gttParams.triggerPrices = new ArrayList(List.of(Double.valueOf(triggerPrice - 4D)));

GTT gtt = Misc.theInstance().placeGTT(gttParams);

When I execute, I get this exception:
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.placeGTT(KiteConnect.java:506)
  • SRIJAN
    You can catch and print the exception message or run javakiteconnect with debug logs on to know the root cause.
Sign In or Register to comment.