Introduction
To connect using WebSockets API, you will need following information :
– “endpoint” to connect to
– “port number” to connect to
– “API Key” received from our team to access data
The flow of operations should be as follows :
1. Make a connection to the ws://endpoint:port
2. Send Authentication Request using API Key
3. Once authentication is successful, send all other data requests
4. If connection is lost for any reasons, follow same steps from 1 to 3 as above.
List of WebSockets API Functions
WebSockets API Functions | Description |
Authenticate | Authenticates the user via API Key |
SubscribeRealtime | Subscribe to market data, pushes market data every second (Bid/Ask/Trade) |
SubscribeSnapshot | Subscribe to market data, pushes market data every minute (and other “Period” values as chosen by user) |
GetLastQuote | Returns LastTradePrice of Single Symbol (detailed) |
GetLastQuoteShort | Returns LastTradePrice of Single Symbol (short) |
GetLastQuoteShortWithClose | Returns LastTradePrice of Single Symbol (short with Close of Previous Day) |
GetLastQuoteArray | Returns LastTradePrice of multiple Symbols – max 25 in single call (detailed) |
GetLastQuoteArrayShort | Returns LastTradePrice of multiple Symbols – max 25 in single call (short) |
GetLastQuoteArrayShortWithClose | Returns LastTradePrice of multiple Symbols – max 25 in single call (short with Close of Previous Day) |
GetSnapshot | Returns latest Snapshot Data of multiple Symbols – max 25 in single call |
GetHistory | Returns historical data (Tick / Minute / EOD) |
GetHistoryAfterMarket | Returns historical data (Tick / Minute / EOD) till previous working day. |
GetExchanges | Returns array of available exchanges |
GetInstrumentsOnSearch | Returns array of max. 20 instruments by selected exchange and ‘search string’ |
GetInstruments | Returns array of instruments by selected exchange |
GetInstrumentTypes | Returns list of Instrument Types (e.g. FUTIDX, FUTSTK, etc.) |
GetProducts | Returns list of Products (e.g. NIFTY, BANKNIFTY, GAIL, etc.) |
GetExpiryDates | Returns array of Expiry Dates (e.g. 25JUN2020, 30JUL2020, etc.) |
GetOptionTypes | Returns list of Option Types (e.g. CE, PE, etc.) |
GetStrikePrices | Returns list of Strike Prices (e.g. 10000, 11000, 75.5, etc.) |
GetServerInfo | Returns information about server where connection is made |
GetLimitation | Returns user account information (e.g. which functions are allowed, Exchanges allowed, symbol limit, etc.) |
GetMarketMessages | Returns array of last messages (Market Messages) related to selected exchange |
GetExchangeMessages | Returns array of last messages (Exchange Messages) related to selected exchange |
GetLastQuoteOptionChain | Returns LastTradePrice of entire OptionChain of requested underlying |
GetExchangeSnapshot | Returns entire Exchange Snapshot as per Period & Periodicity |
GetLastQuoteOptionGreeks | Returns Last Traded Option Greek values of Single Symbol (detailed) |
GetLastQuoteArrayOptionGreeks | Returns Last Traded Option Greek values of multiple Symbols – max 25 in single call (detailed) |
GetLastQuoteOptionGreeksChain | Returns Last Traded Option Greek values of entire OptionChain of requested underlying |
SubscribeRealtimeOptionGreeks | Subscribe to Realtime Greek values of single Token, returns market data every second (detailed) |
Important Notes
-
- – WebSockets API allows only 1 active session with the server with 1 API Key. If you create another session with same key, previous session will be invalidated with response “Access Denied. Key already in use by other session.”
-
- – WebSockets API Sends data only in JSON format
-
- – Sometimes, API sends diagnostic messages in plain/text – instead of actual data requested. For example, when API Key is expired / invalid, etc.. Your application should be able to handle these messages in non-JSON format.