I start with (say) 20 symbols subscription to websocket. At 9:30, few symbols are not required and at 9:45 further few symbols are not required. How can I do this?
My logic is as follows (in Python). 1. Execute kws.connect() before 9:15 2. Inside on_connect(), subscribe to all 20 symbols using ws.subscribe() 3. Inside on_ticks(), check if time is 9:30 or 9:45, if so then call ws.stop() and kws.connect()
My idea is, the moment kws.connect() is called at 9:30 and 9:45, on_connect() will be called again and the required symbols will be subscribed. This only works if all the symbols get unsubscribed the moment ws.stop() is called.
Please let me know if my understanding and logic is correct or not.