Best way to subscribe to 200 scripts and autotrade?

hpahel
Hi,
Suppose I have subscribed to 100 scripts, with mode=MODE_FULL.

Ques: By making mode=MODE_FULL, will we receive a tick whenever there is any change in ltp or market depth?

Moving on, so we are receiving many ticks/second (Is there any threshold?), now suppose we are doing some calculations or lets say just sleep(10), now for those 10 seconds, what will happen to ticks? Will we receive them or just wait for 10seconds and then again open the gates for ticks?
What would be the best way to subscribe to lets say 200 scripts (which is the limit), and do some calculation on individuals data and eventually place orders and manage them? Should we make like 200 objects of the class and run them separately?
How many WebSockets connections can we have, what is the optimum limit?


Thanks
  • hpahel
    @sujith
    @Kailash
    What are your thoughts?
  • sujith
    Hi @hpahel,
    Ques: By making mode=MODE_FULL, will we receive a tick whenever there is any change in LTP or market depth?
    Yes, you will get ticks whenever there is a change in market depth or LTP. Please note that you will only get maximum of 1 tick per second.

    Websockets tick data are not queued, Ticker server broadcasts ticks if someone has subscribed to it then they will get ticks. AFAIK, if you make thread sleep then websocket connection will be terminated and this is standard websocket protocol's property.

    I think you should separate your strategy module and ticks receiving module. Your ticker module should keep on receiving ticks and there must be no interruption. Maybe you will have to store ticks to perform the analysis.

    As of now, we haven't restricted the number of websocket connections an app can open, but soon we will be restricting it to 3.
  • rahulchitale
    @Sujith Are there any specific terms/licensing restrictions regarding temporary persistence of the tick data from Zerodha side ?
  • sujith
    Hi @rahulchitale,
    Can you elaborate? I didn't understand.
    If this is something about compliance please send a mail to talk(at)rainmatter.com, because we don't have adequate knowledge to answer queries related to compliance. Someone from our team will get in touch with you to resolve the query.
  • sumant
    @sujith can we run websocket in 2 different machines with same Api key smoothly, subscribing to different tokens?
  • sujith
    Hi @sumant,
    You can do it, but soon we will be limiting the number of websocket connection to 3 per api_key. Just make sure you don't exceed that limit.
Sign In or Register to comment.