Skip to main content

Subscribe feed

Websocket Subscribe Feed API will provide multiple instruments available actions and possible values at once.

Request details

ParameterDescription
t't' represents touchline task
kOne or more scriplist for subscription. Example NSE 22#BSE
from typing import Any
from thefirstock.firstockModules import firstockWebSockets
from thefirstock.pyClient.websocket import WsClient
from thefirstock.pyClient.websocket.enums import MessageTopic

client = firstockWebSockets.webSocketLogin()
ws = client.ws

@ws.on_connect
def connected(client, message):
if message.get('s') == 'OK':
client.subscribe_feed('NSE|26000#NSE|26009#NSE|22')

@ws.on_message(MessageTopic.SUBSCRIBE_FEED)
def msg_handler(client: WsClient, message: Any):
print(message)

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

TouchLine subscription Updates

ParameterDescription
trepresents feed acknowledgement
eNSE, BSE, NFO ..Exchane name
lpLTP
tk22 Script token
ppPrice precision
tsTrading Symbol
tiTick size
lsLot size
lpLTP
pcPercentage change
vvolume
oOpen price
hHigh price
lLow price
cClose price
apAverage trade Price
oiOpen interest
poiPrevious day closing Open Interest
toiTotal open interest for underlying
bq1Best Buy Quantity 1
bp1Best Buy Price 1
sq1Best Sell Quantity 1
sp1Best Sell Price 1
ftFeed time

Sample response

{
't': 'tf',
'e': 'NSE',
'tk': '22',
'ft': '1664340733',
'v': '2371.20',
'bp1': '2371.20',
'sp1': '2371',
'bq1': '49',
'sq1': '10'
}