Skip to main content

Websocket

Order Feed

Websocket Order Feed will provide order details available actions and possible values at once.

Tabbed Interface
"""Websockets"""
from thefirstock import thefirstock

listOfTradingSymbol = ["Nifty Bank", "Nifty 50"]

def order_feed_data(data):
	print(data)

thefirstock.websocket_connection(
                            "{{userId}}", 
                            listOfTradingSymbol,
                            socket_connection=1,
                            activate_order_feed=True,
							callback_order_feed=depth_feed_data
					)
  • In the above code you can get the order feed of the user.
  • You can choose the socket_connection either to 1 or 2 and can maintain two connection simultaneously.
  • Once the above steps are done, you can create a method and provide it as a callback to the callback_order_feed then this will start
    posting the feed to that method.

Acknowledgement Response

.

Feed Response

{'t': 'om', 'norenordno': '', 'uid': '', 'actid': '', 'exch': 'NSE', 'tsym': 'TCS-EQ', 'trantype': 'B', 'qty': '1
{'t': 'om', 'norenordno': '', 'uid': '', 'actid': '', 'exch': 'NSE', 'tsym': 'TCS-EQ', 'trantype': 'B', 'qty': '1
{'t': 'om', 'norenordno': '', 'uid': '', 'actid': '', 'exch': 'NSE', 'tsym': 'TCS-EQ', 'trantype': 'B', 'qty': '1
Parameter Description
t 'om' represents touchline feed
norenordno Noren Order Number
uid User Id
actid Account ID
exch Exchange Segment
tsym Trading symbol
qty Order Quantity
prc Order Price
prd C / M / I Product name
status Order status (New, Replaced, Complete, Rejected, etc)
reporttype Order event for which this message is sent out. (Fill, Rejected, Canceled)
trantype Order transaction type, B -> Buy , S -> Sell
prctyp Order price type (LMT, MKT, SL-LMT, SL-MKT)
ret Order retention type (DAY, EOS, IOC)
fillshares Total Filled shares for this order
avgprc Average fill price
fltm Fill Time (present only when reporttype is Fill)
flid Fill ID (present only when reporttype is Fill)
flqty Fill Qty (present only when reporttype is Fill)
flprc Fill Price (present only when reporttype is Fill)
rej Order rejection reason, if rejected
exchordid Exchange Order ID
cancelqty Canceled quantity, in case of canceled order
remarks User-added tag, while placing order
dscqty Disclosed quantity
trgprc Trigger price for SL orders
exch_tm Exchange update time