You will need to run three threads using the threading or multiprocessing modules. However using a single python client to make multiple connections to websocket is a bad idea. This approach just increases the code complexity and the chances of things going wrong.
There is no harm in running three separate instances of the same marketdata script with each one subscribing to a separate list of instruments which can be specified as a command line parameter.
python3 ./getmarketdata.py list1 # subscribes to one instrument list. python3 ./getmarketdata.py list2 # subscribes to second instrument list. python3 ./getmarketdata.py list3 # subscribes to third instrument list.
Multithreading introduces unnnecessary code complexity which will make maintenance and debugging all the more difficult.
However using a single python client to make multiple connections to websocket is a bad idea. This approach just increases the code complexity and the chances of things going wrong.
There is no harm in running three separate instances of the same marketdata script with each one subscribing to a separate list of instruments which can be specified as a command line parameter. Multithreading introduces unnnecessary code complexity which will make maintenance and debugging all the more difficult.