I just want to know that can I open multiple instance of Websocket(kiteTicker) for each token. For example, I have 3 token and as per that token can I open 3 Websocket Connections(3 instance of KiteTicker) class?
Hi @Prem, There is a soft limit of 3 connections per api_key. We will make it as hard limit soon. It is a very bad practice to open one connection for one token. It is always doing IO operations and calculations that are expensive not the data receiving task. An ideal way to implement would be open a websocket connection and listen to ticks in one thread and spin off new threads everytime you receive ticks with size > 0 so that your process can do calculations and do IO operations like writing to DB or disk. In this way, you will never block the thread that receives ticks. Hence you won't miss any ticks.
I would like to know that how Kite web platform work? If I open for example 15 tabs for 15 scrips. I just want to create new thread for each token and that thread independently handle ((Ticks) + Calculations(Strategy) + (Order Management) + (Disk related Task)).
You said that this is very bad practice. Suppose, I have register for 500 Tokens and single websocket connection returns data in an array. So, as per your approach first I need to iterate response to get data for desired data for desired token then create thread for above described operations such as ((Ticks) + Calculations(Strategy) + (Order Management) + (Disk related Task)).
But KiteTicker gives response suppose too frequently i.e 100 times in a Minute than how optimised is that?
Hi @Prem, All our platforms use only one websocket connection for all the scrips and one connection is maintained across the app. If you are tracking too many scrips then spinning off a new thread for each tick will not be a feasible solution. May be you can maintain 2 to 3 threads and keep sending data to worker threads whenever there is a tick.
Don't iterate in the main thread, if ticks array size > 0 then pass it to a worker thread. Let worker thread do all the job. The idea is to not block the main thread.
I am not going to block main thread but I think it takes much time to do all operations because I need to iterate all response for doing all operations and all operations also take time to complete. I mean to say that I want to make thread light weight means if all my complicated task done by single thread then its takes time and time is very critical factor to execute my strategy on time.
For Example can you think about one to one video call and Video Conferencing. Can you please give me your contact number so I can describe this to you more easily.
There is a soft limit of 3 connections per api_key. We will make it as hard limit soon. It is a very bad practice to open one connection for one token. It is always doing IO operations and calculations that are expensive not the data receiving task.
An ideal way to implement would be open a websocket connection and listen to ticks in one thread and spin off new threads everytime you receive ticks with size > 0 so that your process can do calculations and do IO operations like writing to DB or disk. In this way, you will never block the thread that receives ticks. Hence you won't miss any ticks.
I would like to know that how Kite web platform work? If I open for example 15 tabs for 15 scrips. I just want to create new thread for each token and that thread independently handle ((Ticks) + Calculations(Strategy) + (Order Management) + (Disk related Task)).
You said that this is very bad practice. Suppose, I have register for 500 Tokens and single websocket connection returns data in an array. So, as per your approach first I need to iterate response to get data for desired data for desired token then create thread for above described operations such as ((Ticks) + Calculations(Strategy) + (Order Management) + (Disk related Task)).
But KiteTicker gives response suppose too frequently i.e 100 times in a Minute than how optimised is that?
Kindly clarify it ASAP.
Many thanks
kindly reply. I am waiting. Please
Many Thanks
All our platforms use only one websocket connection for all the scrips and one connection is maintained across the app. If you are tracking too many scrips then spinning off a new thread for each tick will not be a feasible solution. May be you can maintain 2 to 3 threads and keep sending data to worker threads whenever there is a tick.
I am not going to block main thread but I think it takes much time to do all operations because I need to iterate all response for doing all operations and all operations also take time to complete. I mean to say that I want to make thread light weight means if all my complicated task done by single thread then its takes time and time is very critical factor to execute my strategy on time.
For Example can you think about one to one video call and Video Conferencing. Can you please give me your contact number so I can describe this to you more easily.
Kindly reply ASAP.
Many thanks