Depth Feed
Websocket Depth Feed will provide multiple instruments available actions and possible values at once.
"""Websockets"""
from thefirstock import thefirstock
listOfTradingSymbol = ["Nifty Bank", "Nifty 50"]
def depth_feed_data(data):
print(data)
thefirstock.websocket_connection(
"{{userId}}",
listOfTradingSymbol,
socket_connection=1,
activate_depth_feed=True,
callback_depth_feed=depth_feed_data
)
- In the above code you can send the trading symbol in the list to subscribe for the feed,
- 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_depth_feed then this will start
posting the feed to that method.
Acknowledgement Response
.Feed Response
.| Parameter | Description |
|---|---|
| t | type |
| tf | tick feed |
| tk | tick acknowledgement |
| e | exchange |
| tk | token |
| pc | percentage change |
| cv | change value |
| v | volume |
| o | open |
| h | high |
| l | low |
| c | close |
| ap | average price |
| ts | Symbol Name |
| bp1...bp5 | Depth buy price |
| sp1...sp5 | Depth sell price |
| bq1...bq5 | Depth buy quantity |
| sq1...sq5 | Depth sell quantity |
| bo1...bo5 | Depth buy order |
| so1...so5 | Depth sell order |
| oi | open interest |
| ltp | last traded qty |
| ltt | last traded time |
| tbq | total buy qty |
| tsq | total sell qty |
| uc | upper circuit |
| lc | lower circuit |