Subscribe Feed
This document details how to subscribe to the feed on the Firstock Websockets.
Overview
The Subscribe Feed API enables you to initiate a persistent WebSocket connection to Firstock’s real-time market data stream. Through this connection, you can subscribe to price feeds (LTP, and more) for multiple instruments simultaneously, receiving bundled updates in a single message
Body
Field | Type | Mandatory | Description | Example |
---|---|---|---|---|
t | string |
Yes |
Type of request; use |
"t" |
k | string |
Yes |
Subscription parameter |
"NFO|54957#NSE|26000" |
Request
{"k":"NFO|54957#NSE|26000","t":"t"}
t = Type of request, t for tick data
k = Params for subscription with pipe ‘|’ delimited tokens and exchange. Token and exchange should be separated with #
Response Structure
- Acknowledgement Response
Body
Number of Acknowledgements for a single subscription will be the same as the number of scrips mentioned in the key (k) field.
Parameter | Description |
---|---|
t |
‘tk’ represents touchline acknowledgement |
e |
Exchange name |
tk |
Scrip Token |
pp |
Price precision |
ts |
Trading Symbol |
ti |
Tick size |
ls |
Lot size |
lp |
LTP |
pc |
Percentage change |
v |
Volume |
o |
Open price |
h |
High price |
l |
Low price |
c |
Close price |
ap |
Average trade price |
oi |
Open interest |
poi |
Previous day closing Open Interest |
toi |
Total open interest for underlying |
bq1 |
Best Buy Quantity 1 |
bp1 |
Best Buy Price 1 |
sq1 |
Best Sell Quantity 1 |
sp1 |
Best Sell Price 1 |
ft |
Feed time |
ord_msg |
Order message |
Response:
{
"t": "tk",
"e": "NSE",
"tk": "26000",
"ts": "Nifty 50",
"pp": "2",
"ls": "1",
"ti": "0.05",
"lp": "24868.45",
"pc": "-0.97",
"c": "25112.40",
"ft": "1750652109",
"o": "24939.75",
"h": "24988.10",
"l": "24858.75",
"toi": "62170200"
}
- Updates Response
Body
Except for t, e, and tk other fields may / may not be present.
Parameter | Description |
---|---|
t | ‘tf’ represents touchline feed |
e | Exchange name |
tk | Scrip Token |
lp | LTP |
pc | Percentage change |
v | volume |
o | Open price |
h | High price |
l | Low price |
c | Close price |
ap | Average trade price |
oi | Open interest |
poi | Previous day closing Open Interest |
toi | Total open interest for underlying |
bq1 | Best Buy Quantity 1 |
bp1 | Best Buy Price 1 |
sq1 | Best Sell Quantity 1 |
sp1 | Best Sell Price 1 |
ft | Feed time |
Response:
{
"t": "tf",
"e": "NSE",
"tk": "26000",
"lp": "24858.70",
"pc": "-1.01",
"ft": "1750652111",
"l": "24858.45"
}
Unsubscribe Feed
Body
Below is the general JSON body for the Unsubscribe Feed API request. All fields marked as Mandatory must be included.
Field | Type | Mandatory | Description | Example |
---|---|---|---|---|
t |
string |
Yes |
‘u’ represents Unsubscribe Touchline |
u |
k |
string |
No |
One or more scriplist for unsubscription. |
NSE|22#BSE|508123 |
Request
{"k":"NFO|54957#NSE|26000","t":"u"}