Rate Limits

ZI4453
ZI4453 edited July 2019 in Python client
Al these below request are for "EQ" Secutiries only under CNC.
Websocket subscription-3000 instruments(Per API)
Order postback subcription-?
Number of orders/Sec-?
Number of ordes/Day-?
Http request/sec apart from orders-?
Balance check/order status -? is this same Post back or usual Http call ?

please mention if i am missing out any limits on API usage.
  • sujith
    You can check out this thread for API rate limits.

    One Zerodha account can place up to 2000 orders per day. Check out the support article here.
  • ZI4453
    ZI4453 edited July 2019
    Redirected article states as "as risk management " and does not impose restriction.

    Since i am newbie i am considering all strategies which might require more than 2000 Order executions/day.
    From API standpoint i understand that you have fixed this as Hard Limit not as Stock Exchange limit !
    Incase if trades go good and we utilize API properly(Not Abusing API with poll requests) -[using it only for order firing(ON-OFF) and reading other data through websocket :smiley: Good samaritan)are we still in 2000 orders/day or can this be increased based on my API usage...

    Reason - my strategy is based totally on momentum and someday might need more than your limits(Not /Sec/minute but on CNC /Day) ..

    I am trying to build model on number of profitable trades and not interested in BO/CO orders. Every order placed will be CNC only....I am ok if you disable every order type other than CNC for my API.

    please clarify more on this.....
  • sujith
    I am afraid it is not possible to increase the limit. This is not something that is decided by us. It is the RMS team that has come up with the number after a lot of fact checks.
    Kite Connect API is not a feasible solution to do HFT. If you are intending to go for a premium setup then you can get a colo setup at the exchange, we can help you with that. The setup costs around 18 lakhs per annum and you can email talk(at)rainmatter.com if you intend to get one.
  • ZI4453
    :smile: just 18Lakhs :smile:let me get API first .
    Is that 30 days include trading 30 days or calendar 30 days ?
  • ZI4453
    Considering my trade is going good and i need one more API is is possible ?
    I am writing concurrent execution codes and i dont want to start coding once again form scratch.

    Note:- This is not HFT and trying to use momentum of multiple scrips.... I would appreciate if some reach to me .. I can explain my requirement..
  • krtrader
    Hi @sujith

    The support article says rate limit 200 orders/minute and 5 orders/second.

    Last time when I checked you told that only limitation is 200 order/minute (https://kite.trade/forum/discussion/5611/whats-rate-limit-for-kiteconnect-modifyorder-end-point#latest)

    Could you please confirm again that rate limit is 200 order/minute. there is no restriction per second?
  • MAG
    MAG edited July 2019
    Dude, there is a restriction for per second too.
    Let me explain it like this:
    If you start at 9:15:00 and start sending 5 orders every second, at the 39th second (count starts at 00) you will end up sending orders 196-200. You won't be able to place any new orders for the next 20 seconds from the 40th second (9:15:40) to the 59th second(9:15:59) because you have exceeded 200 orders in that minute. You have exceeded the per minute limit though you have been maintaining the per second limit.
    You will be able to place the next order only at 9:16:00.
    Similarly; starting at 9:15:00 if you start sending 200 orders per minute, then in 10 minutes i.e at 9:24:59 you will have crossed 2000 orders which is the daily limit. Thus you wont be able to place any new orders for the rest of the day.
    Hope this clears up the confusion.

    2000 orders are way too many for retail customers. For a moment the other day, I felt that this was too low. Then I went and looked at my logics and backtests and I realised that I could do a whole load of trades within the 2000 order limit.
    Or to put it in a different context - If one crosses 2000 orders per day, one should be in a position to afford the colocation services because one is no longer an ordinary retail trader.

    I think the issue would arise where folks place mass orders the bulk of which do not execute and are cancelled later. Say you have a 20:1 successful order ratio wherein only one of out every 20 orders are executed, the rest are cancelled because price has moved by then or not reached the set limit, then its a waste of order limit. If this happens, it's an issue with your logic. As an example, I place orders only when I need them to be definitely executed and thus hardly ever cross 100-200 orders a day that too is a max which I hardly ever reach.

    @sujith Would like you to correct me if anything I have said above is incorrect. Also can you clarify how orders are counted? Are all orders placed counted against the daily limit (which I think is the case) or is it that only successfully executed orders are counted?
  • krtrader
    @MAG
    Did you tried to place more than 5 orders per second? If not then please don't put your own logic to prove your thinking.
    Earlier someone from kite team confirmed that instead of having per second based rate limit, they switched to per minute for write calls (POST, PUT and DELETE). Refer https://kite.trade/forum/discussion/5496/api-call-limit-any-change-recently

    Here I needed confirmation from Kite team, Not You. Thanks
  • ZI4453
    @MAG ..Thanks for your detailed explanation, you calculated same way i did:i had similar thoughts on all accounts of what you said,
    my logic is simple make many profitable trade instead of waiting for a 1%(ex) movement. i feel like to flow through transaction instead of waiting for one transaction in whole day which is going to give me a profit. For that i dont need any API . Our trading platform should do good . As you mentioned it might logically correct , but 2000 orders means actually you can do only 1000 transactions! means if you place a buy order u might need to sell it today .....(we are talking about order CAP)

    Moreover - i see none of the programmer have mentioned used "futures in python" to post a Http call and i could hardly locate a discussion which talks about firing concurrent orders under Rate limit, Considering "Retail" 'hardware/ISP '(performance) i am sure we will still be under RMS defined API calls..
    I am interested to know more about increasing order limits.

    Zerodha on TOS has mentioned a "Clause" that it has right to restict API calls but at the same time it can Approve/Decline -increase/decrease API calls based on written consent from Retail traders.

    Even the limit mentioned in Support link provided states" as a risk management" and it has never mentioned it as "No".

    writing "futures Http calls " is different from sequential calls to API and thats why i am trying to get a clarity before i start building my strategy ...

    @sujith Please take time to go through your TOS . https://kite.trade/terms, Clause:2 and sub clause:b ,
    i am still in coding stage, i am not expecting to Z to give me 10000 trades/day from day1 of trading.. I would like to know if it will increased based on my API usage, if not what are my other options ?
  • sujith
    @MAG, @krtrader,
    It was 5 POST, PUT, DELETE requests per second but recently we increased it to 10 requests per second. If someone crosses this continuously then the system will dynamically throttle the requests. The 200 per minute limit still holds true.
    We have seen people keep banging server with the order placement or modify requests even when the status message clearly says margin requirements are not met. As you all know that there is a certain number of orders which our OMS can punch every second via lease lines to the exchange. In order to bring in a fair opportunity for all the users. We have to do this kind of limitations.

    As @MAG mentioned 2000 orders per day is fairly a very high number for a retail trader. The RMS team has done some background work and fact checks before coming up with the number.

    @ZI4453, I don't think you will need an increase in the limit. We have not seen anybody coming back to us asking to increase limits. And again this is not a limit on the API this is an account level limit on Zerodha clients by Zerodha RMS.
  • sujith
    Even though not related, just for the reference you can take a look at this AMA on Reddit.
  • MAG
    MAG edited July 2019
    Thanks @krtrader for your kind comments. I was only trying to help.
    Btw, I have done a lot more than sending 5 orders per second :-)

    And this is why I avoid commenting even when I know stuff because of the incessant bullying attitude that folks have when things don't match their narrative or view.
    Peace out.
  • ZI4453
    Thank you @sujith .

    i presume that untested strategies or nature of data transaction can always trigger thousands of orders in seconds and that what RMS would have come to an conclusion....if trader/developer does not have clear understanding of nature of data transaction/latency(Websocket data) there are more chances that they could start firing orders like HFT !

    May be traders might not have tried more trades or their strategies might be totally dependent on "price movement" not "momentum"
    Upstox has agreed for unlimited number of trades with cheaper costs/I need API only and i totally agree for Req/sec or min but i dont like the CAP of orders/Day.There are millions of trades happening and why should i contain myself for 2k trades(actually 1k trades(to profit i need to buy or sell which is 1+1) or 600 trades if its BO!)

    I also mentioned clearly that i need only CNC buy/Sell txn not to keep poking server for modify or BO/CO orders.

    Let me check how it goes wit upstox, if it doesnt go good i will sure come back to this forum.

    Note:- their doc is pretty neat and aligned well for any beginner!
  • sujith
    sujith edited July 2019
    @ZI4453,
    i presume that untested strategies or nature of data transaction can always trigger thousands of orders in seconds and that what RMS would have come to an conclusion....if trader/developer does not have clear understanding of nature of data transaction/latency(Websocket data) there are more chances that they could start firing orders like HFT !
    Exactly! that is the point. Just because one guy didn't test his code, he can potentially affect the trading activity of other 2 lakh+ concurrent users which is a very huge risk as a business for us. We want to provide everyone a level platform for trading as a business.
    Thank you for your time.
  • ZI4453
    As a trader/developer i felt(going through our forum) that giving access to any X , Y without knowing their technical background (whomever wishes to trade )is what the reason for this order flooding!

    -> Except one reply i could not actually get any reply for my post on hardware/ISP and also i was talking about firing concurrent Http request using futures.sessions() instead of get.. I had not seen a single thread discussing about parrallel or concurrent processing

    i am pretty sure if there are 100 API traders only 4-6 of them would be developers and rest 90% of traders depend on newbie or freelance dev for their strategies.. Dev might know Language but in order to work with live financial market data i think as a dev they should have very good knowledge of "Market" and "Order Cycle" first .

    If we could see post of traders still pulling live data from Http Calls instead of web socket thats like worst abuse any one could do justice for getting access to API.

    Not to be sarcastic ( i am trying to know how trades are using API , for firing 100-200 orders why do we need to invest in API?) -if some one has not intended to firing more than1k orders /day why do we need an API ?

  • themohammedfaisal
    As a trader/developer i felt(going through our forum) that giving access to any X , Y without knowing their technical background (whomever wishes to trade )is what the reason for this order flooding!
    @ZI4453, The APIs are intended to democratize trading using algorithms and backtesting with the vast amount of historical data available. But that said, even ace programmers can make mistakes that can lead to increased order requests and these rate limits are put in place to restrict abuse.
    if someone has not intended to firing more than1k orders /day why do we need an API ?
    4000 orders per day(2000 BO/CO and 2000 MIS/CNC/NRML) is a reasonable limit for any retail trader in the markets. You will be able to deploy all kinds of strategies except for latency-sensitive ones. If you have an extremely latency-sensitive strategy, it is best you look at an HFT setup with co-location(TBT data) with the exchange.
  • ZI4453
    @themohammedfaisal - i think everyone gets confused why i need more than 2k orders , my hardware or ISP can never support HFT tradings in any level..

    there are 1.4k scrips approximately traded under 'NSE_EQ', since this is automated trading i am trying to increase number of scrip's trades which can be profitable.More than this i think i have to share my strategy in public forum...
  • ZI4453
    @themohammedfaisal - you have mentioned 4k orders ( incase lets say we dont go with Bo/Co orders ) the overall trades for the day is 4k isnt it ?
  • themohammedfaisal
    you have mentioned 4k orders ( incase lets say we dont go with Bo/Co orders ) the overall trades for the day is 4k isnt it ?
    That's right, it would be 2K orders then
This discussion has been closed.