Place Order using API during off hours

chintanvhparmar
Hi,
I am trying to test some code during off hours when markets are closed 6:20 AM IST and the order status shown in my Zerodha Account shows Order is rejected with message "adapter is down" but i am able to place the same limit order using UI. Is there any reason for difference in behavior and how can i test api logic during off hours?

put("quantity", "1");
put("order_type", "LIMIT");
put("tradingsymbol", "HINDALCO");
put("product", "CNC");
put("exchange", "NSE");
put("transaction_type", "BUY");
put("validity", "DAY");
put("price", "158.0");
put("variety", "amo");
put("tag", "myTag"); //tag is optional and it cannot be more than 8 characters

Thanks,
Chintan Parmar
  • chintanvhparmar
    Another canceled order status i see is "adapter is connected to tap" when using API to place order.
  • sujith
    Hi @chintanvhparmar,
    Placing order before market hours will be successful, but order will be rejected with an error message.
    You can only place after market orders(AMO) before market opens. This error message is from OMS. Hence this behaviour exists across Kite ecosystem.
  • chintanvhparmar
    Hi Sujeeth,
    Thanks for reply. I could not fully understand the reply. As you can see the params shared above(pasted again below) that i had placed AMO as order variety type using code. Why was this order rejected. Also, at the same time when this order was rejected , i tried placing AMO using Zerodha Kite UI and it was not rejected, it shows AMO Order Received status message. Is there anything wrong with the params below or is there any specific time frame before market opens during which only API order works?

    put("quantity", "1");
    put("order_type", "LIMIT");
    put("tradingsymbol", "HINDALCO");
    put("product", "CNC");
    put("exchange", "NSE");
    put("transaction_type", "BUY");
    put("validity", "DAY");
    put("price", "158.0");
    put("variety", "amo");
    put("tag", "myTag"); //tag is optional and it cannot be more than 8 characters

    Thanks,
    Chintan Parmar
  • sujith
    Hi @chintanvhparmar,
    Your params look correct.
    Are you setting variety as "amo" while calling place order method?
  • chintanvhparmar
    yes the order rejection i saw was with amo hard coded as order variety.
  • sujith
    Hi @chintanvhparmar,
    Can do the same tomorrow morning and check if this is consistent?
    If it is happening then, I think we have to speak to OMS team.

    Order id for all these amo orders (which gets rejected saying adapter is down/ adapter is connected to tap) on same day would be helpful to forward this issue.
  • chintanvhparmar
    Sure i can get the order id information and retry this scenario. Does it have to be executed in morning only or can i execute script to place amo order anytime after market closes (after 3:30 pm/ 4pm IST) ?
  • sujith
    Hi @chintanvhparmar,
    It is manually triggered, So I would suggest you to try after 16:30 or 17:00 hrs.
  • chintanvhparmar
    Hi Sujeeth,
    I am able to place AMO orders now. I think i found the issue with code. Although the params passed to placeOrder API method had variety set as "amo" but i noticed that the actual call to placeOrder API method also has order variety type as a parameter which was set to regular which may have been causing the error previously.

    Order order = kiteconnect.placeOrder(param, "regular");
    above call was changed to the one below which seems to have fixed the issue.
    Order order = kiteconnect.placeOrder(param, "amo");

    Thanks for help.
    Chintan Parmar
This discussion has been closed.