KiteException error [error code 400]

kvv
this is my modification order code
public String modifySL(String orderId,String symbol,double price,int qty) throws InputException{
orderId=orderId.trim();
OrderParams orderParams = new OrderParams();
orderParams.orderType = Constants.ORDER_TYPE_SL;
orderParams.validity=Constants.VALIDITY_DAY;
orderParams.price = price;
orderParams.triggerPrice = price;
orderParams.quantity = qty;

try {
Order modifiedOrder=null;
List orders = kiteConnect.getOrders();
for (Order order : orders) {
if(order.orderId.equals(orderId)){
if(order.status.equals("COMPLETE")){
return "Error:"+orderId+" Executed already.";
}
modifiedOrder = kiteConnect.modifyOrder(orderId, orderParams, Constants.VARIETY_REGULAR);
break;
}
}
if(modifiedOrder==null){return "Error: order null";}
return ""+modifiedOrder.orderId;
} catch (IOException e) {
return "Error:"+e.getMessage()+"[ Network issue ]";
}
catch (KiteException e) {
return "Error:"+e.getMessage()+","+e.code+"["+orderId+"]";
}
}

///////////////////////////////////// and it is my own created log [ 2025-06-18_09-19-07_771 , it is current date time and milliseconds ]
CALL
RETRADE
NIFTY2561924900CE,75
2025-06-18_09-19-07_771
BUY:250618120089647
2025-06-18_09-19-07_845
BUY-PRICE:61.35
BUY-QTY:75
-
2025-06-18_09-19-09_124 <- stop loss order start time
2025-06-18_09-19-09_187 <- stop loss order complete time
BUY-SL:250618120089857,59.2
CALL
MODIFY
NIFTY2561924900CE,75
2025-06-18_09-19-10_523
SL-MODIFY:Error:null,400[250618120089857]
2025-06-18_09-19-10_637
ERROR-MODIFY-SL:null,400[250618120089857]
-
CALL
MODIFY
NIFTY2561924900CE,75
2025-06-18_09-19-13_164
SL-MODIFY:Error:null,400[250618120089857]
2025-06-18_09-19-13_282
ERROR-MODIFY-SL:null,400[250618120089857]
-
CALL
MODIFY
NIFTY2561924900CE,75
2025-06-18_09-19-16_821
SL-MODIFY:Error:null,400[250618120089857]
2025-06-18_09-19-16_920
ERROR-MODIFY-SL:null,400[250618120089857]
-
Sold: 59.2,75
-
///////////////////////////////////////// before modifying error , always placed a stop loss order ,
my question is , why I am getting 400 error code ,
where is wrong in my code and timing distance for each modifyingorder is approx 2 seconds .
Tagged:
  • sujith
    You can run javakiteconnect with debug logs enabled and see the exact error message. You may refer to the code here.
Sign In or Register to comment.