Skip to main content

Subscribe order update

Websocket Order Status API will function in providing order status updates through websocket server connection and provide Order responses similar to the one received in Postback/Webhook.

Request details

ParameterDescription
t'o' represents order update subscription task
actidAccount id based on which order updated to be sent.
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_order('userId')


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


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

Subscription Acknowledgement

ParameterDescription
t'ok' represents order update subscription acknowledgement

Order Update subscription Updates

ParameterDescription
t'om' represents touchline feed
norenordnoNoren Order Number
uidUser Id
actidAccount ID
exchExchange Segment
tsymTrading symbol
qtyOrder Quantity
prcOrder Price
prdC / M / I Product name
statusOrder status (New, Replaced, Complete, Rejected etc)
reporttypeOrder event for which this message is sent out. (Fill, Rejected, Canceled)
trantypeOrder transaction type, B -> Buy , S -> Sell
prctypOrder price type (LMT, MKT, SL-LMT, SL-MKT)
retOrder retention type (DAY, EOS, IOC)
fillsharesTotal Filled shares for this order
avgprcAverage fill price
fltmFill Time(present only when reporttype is Fill)
flidFill ID(present only when reporttype is Fill)
flqtyFill Qty(present only when reporttype is Fill)
flprcFill Price(present only when reporttype is Fill)
rejOrder rejection reason, if rejected
exchordidExchange Order ID
cancelqtyCanceled quantity, in case of canceled order
remarksUser added tag, while placing order
dscqtyDisclosed quantity
trgprcTrigger price for SL orders
exch_tmThis will have the exchange update time

Sample Response

{'t': 'om', 'norenordno': '', 'uid': '', 'actid': '', 'exch': 'NSE', 'tsym': 'TCS-EQ', 'trantype': 'B', 'qty': '1', 'prc': '3101.10', 'pcode': 'I', 'remarks': '', 'status': 'PENDING', 'reporttype': 'NewAck', 'prctyp': 'LMT', 'ret': 'DAY', 'exchordid': '', 'dscqty': '0'}
{'t': 'om', 'norenordno': '', 'uid': '', 'actid': '', 'exch': 'NSE', 'tsym': 'TCS-EQ', 'trantype': 'B', 'qty': '1', 'prc': '3101.10', 'pcode': 'I', 'remarks': '', 'status': 'PENDING', 'reporttype': 'PendingNew', 'prctyp': 'LMT', 'ret': 'DAY', 'exchordid': '', 'dscqty': '0'}
{'t': 'om', 'norenordno': '', 'uid': '', 'actid': '', 'exch': 'NSE', 'tsym': 'TCS-EQ', 'trantype': 'B', 'qty': '1', 'prc': '3101.10', 'pcode': 'I', 'remarks': '', 'status': 'OPEN', 'reporttype': 'New', 'prctyp': 'LMT', 'ret': 'DAY', 'exchordid': '', 'dscqty': '0', 'exch_tm': ''}