Websocket Market Data
The Websocket endpoint helps the user to retrieve the data for the instruments in almost realtime. It is the most efficient way to retrieve the data as it requires less amount of resources which in turn reduces the latency to a very large extent.
Connection
The endpoint for websocket connection is wss://wss.tiqs.trading
. To establish a new connection, the user needs to pass on the following query params
Sending Message
The websocket receives a JSON string in the following format for the quotes
{
"code": "SUBSCRIPTION MODE",
"mode": "QUOTE MODE",
"QUOTE MODE": "Array of Tokens"
}
{
"code": "sub",
"mode": "quote",
"quote": [26009, 26000]
}
Subscription Modes
These are the following subscription modes
Subscription Mode | Description |
---|---|
sub | For Subscribing the Tokens |
unsub | For Unsubscribing the Tokens |
Quotes Modes
These are the following quotes modes which can be subscribed
Quote Mode | Description | Packet Size |
---|---|---|
ltpc | The packet contains info about LTP data with closing Price | 17 bytes |
ltp | The packet contains info about LTP data without closing Price | 13 bytes |
quote | The packet contains info except market depth | 69 bytes |
full | The packet contains info including market depth | 197 bytes |
Market Data Structure for LTPC
Position | Field | Type |
---|---|---|
0 - 4 | Token | int32 |
4 - 8 | LTP | int32 |
8 - 9 | Net change indicator | int32 |
9 - 13 | Net change | int32 |
13 - 17 | Previous Trading Day Close Price | int32 |
Note
The extra LTPC Mode is there to have the Previous Day Closing Price as the net change is based on the previous day Settlement Price instead of the Closing Price
Market Data Structure for LTP, Quote and Full
Position | Field | Type |
---|---|---|
0 - 4 | Token | int32 |
4 - 8 | LTP | int32 |
8 - 9 | Net change indicator | int32 |
9 - 13 | Net change | int32 |
13 - 17 | LTQ | int32 |
17 - 21 | Avg Price | int32 |
21 - 25 | Total Buy Quantity | int32 |
25 - 29 | Total Sell Quantity | int32 |
29 - 33 | Open | int32 |
33 - 37 | High | int32 |
37 - 41 | Close | int32 |
41 - 45 | Low | int32 |
45 - 49 | Volume | int32 |
49 - 53 | LTT | int32 |
53 - 57 | Time | int32 |
57 - 61 | OI | int32 |
61 - 65 | OI day high | int32 |
65 - 69 | OI day low | int32 |
69 - 73 | Lower limit | int32 |
73 - 77 | Upper limit | int32 |
77 - 197 | Market Depth | byte[] |
Market Depth Structure
The Market Depth Structure consists of 5 Bids and 5 Offers. Each of the Bid and Offer is 12 byte packet. Each Packet of 12 bytes is a combination of quantity(int32), price (int32) and orders (int32)
Position | Field | Type |
---|---|---|
77 - 89 | Bid-1 | int32 , int32 , int32 |
89 - 101 | Bid-2 | int32 , int32 , int32 |
101 - 113 | Bid-3 | int32 , int32 , int32 |
113 - 125 | Bid-4 | int32 , int32 , int32 |
125 - 137 | Bid-5 | int32 , int32 , int32 |
137 - 149 | Offer-1 | int32 , int32 , int32 |
149 - 161 | Offer-2 | int32 , int32 , int32 |
161 - 173 | Offer-3 | int32 , int32 , int32 |
173 - 185 | Offer-4 | int32 , int32 , int32 |
185 - 197 | Offer-5 | int32 , int32 , int32 |