Skip to main content

Multi Websocket

Using Multi Websocket will provide multiple instruments available actions and possible values at once.

from typing import Any
from thefirstock.firstockModules import firstockWebSockets
from thefirstock.pyClient.websocket import WsClient
from thefirstock.pyClient.websocket.enums import MessageTopic

# Pass 1 or 2 for Activating Websocket 1 or Websocket 2 in webSocketLogin()
client = firstockWebSockets.webSocketLogin()
ws =

def connected(client, message):
if message.get('s') == 'OK':

def msg_handler(client: WsClient, message: Any):

ws.connect(uid="<userId>", actid="<userId>")