Multiple MIS orders 5 secs apart fails, only the order is accepted

KKannan
Hi everyone

I use the following java client code to place multiple orders at different price in 5 secs interval, now only 3qty. The first one is accepted, but other fail with return message as null.

int qty = Integer.parseInt(qtyFld.getText());
double halfPerc = (stock.ltp/100) * 0.5;
for(int i = 1;i <= qty;i++) {
OrderParams orderParams = new OrderParams();
orderParams.quantity = 1;
orderParams.orderType = Constants.ORDER_TYPE_LIMIT;
orderParams.tradingsymbol = stock.name;
orderParams.product = Constants.PRODUCT_MIS;
orderParams.exchange = Constants.EXCHANGE_NSE;
orderParams.transactionType = Constants.TRANSACTION_TYPE_BUY;
orderParams.validity = Constants.VALIDITY_DAY;
/**
* First order starts at next support, and minus half perc multiles of that downwards
*/
double nextLevel = (i == 1)?stock.getNextSupport():stock.getNextSupport() - halfPerc * i;

orderParams.price = nextLevel;//stock.getNextSupport();//Double.parseDouble(limitPriceFld.getText());
orderParams.tag = "myTag"; //tag is optional and it cannot be more than 8 characters and only alphanumeric is allowed
try {
Order order = ZerodhaAlgo.kiteConnect.placeOrder(orderParams, Constants.VARIETY_REGULAR);
System.out.println(order.orderId);
}catch (KiteException ke){
System.out.println(ke.getMessage());
}
try{
Thread.sleep(5000);
}catch (InterruptedException ie){
ie.getMessage();
}
}

Apreciate any help as to why this is so.

Thanks
Kannan
  • Sravanthi_bh
    We suggest enabling debug mode and share the complete stack trace in a private message. Also, please take a look at this support article.
  • KKannan
    Thanks, let me try to enable debug and see if that show anything meaningful.
  • KKannan
    Debug showed me it is the problem with tick size, so i changed it according to the nse guidelines and it is working alright now.

    Thanks for the debug idea to find out the issue.
    Anyway if it helps here is the tick size as per nse, price is 250 to 5000, then 0.1, 5000 to 10000 it should be 0.5 and above 10000 it is 5.

    Cheers/-
  • sujith
    You can get tick size from the instruments master API.
  • KKannan
    Thanks, that will be lot cleaner.
This discussion has been closed.