If i place multiple orders (say 10 to 20), at once (in a for loop), will they get rejected?
In other words, is there any limit on number of orders that can be placed in a second or so?
I want to do it only once or twice in a day.
If not allowed, can I put all the orders in a basket and place all at once?
If no way to do it.. final option with me is to fill delays while placing the orders. how much delay advisable between orders, so that there is no need to check the status of the order for any rejections due to rate limitations?
Hi @saha, Place order API limit is 5 requests per second which can buffer up to 10 requests per second.
Make sure, you don't cross the limit and if API fails order will not be placed. Hence there will be no rejection message. If API fails, you will get KiteException.
So, if i intend to place buy order for all Nifty 50 stocks at once. I have below options with me: 1) Place 5 orders per second. Pause for 1 sec. Then next 5 orders and so on. 2) Put sleep(0.2 second ) between each orders. 3) The buffering will take care of boundary case (say instead of 5, few more orders (one or two)gets placed in any particular second.) 4) Inside a try block, Place order. If KiteException, Catch it , wait 1 sec and place again. else place the next order. 5) Place all 50 orders in a single basket, so that it hits as a single order on kite connect API reducing the load of multiple orders, and rate limit is also not breached. (Not sure about the syntax and whether it is allowed via kite connect API).
Please suggest which of these will be a good practice, that is beneficial for zerodha as well as us.
Hi @Shaha, You can implement 1, 2 or 3 whichever you are comfortable with. 4 anyways you need to do, in order to handle fail case scenario but make sure not do it in the loop which might abuse our system also.
5 is not possible from API since we internally have to place orders individually to OMS and handling error scenario will be an issue.
Thanks. Well but now i realized that placing delays is no longer needed, as the avg execution time for kite.order_place from my machine is 0.15 seconds to 0.2 seconds, which would eventually handle the case. For others viewing this post, still a try catch may be used to avoid abrupt stopping of your code, (just to ensure that going forward if the kite.order_place execution time gets reduced, then rate limit exceptions are handled.)
Place order API limit is 5 requests per second which can buffer up to 10 requests per second.
Make sure, you don't cross the limit and if API fails order will not be placed. Hence there will be no rejection message.
If API fails, you will get KiteException.
So, if i intend to place buy order for all Nifty 50 stocks at once. I have below options with me:
1) Place 5 orders per second. Pause for 1 sec. Then next 5 orders and so on.
2) Put sleep(0.2 second ) between each orders.
3) The buffering will take care of boundary case (say instead of 5, few more orders (one or two)gets placed in any particular second.)
4) Inside a try block, Place order. If KiteException, Catch it , wait 1 sec and place again. else place the next order.
5) Place all 50 orders in a single basket, so that it hits as a single order on kite connect API reducing the load of multiple orders, and rate limit is also not breached. (Not sure about the syntax and whether it is allowed via kite connect API).
Please suggest which of these will be a good practice, that is beneficial for zerodha as well as us.
You can implement 1, 2 or 3 whichever you are comfortable with. 4 anyways you need to do, in order to handle fail case scenario but make sure not do it in the loop which might abuse our system also.
5 is not possible from API since we internally have to place orders individually to OMS and handling error scenario will be an issue.