Doc Fundamentals
Funds Management
Order Management
Portfolio Management
User Authentication
Web Socket
Daily API Calls
Success Rate
Avg. Response Time
Whether it is fetching market data or trade confirmations, live streaming support can make the life of traders and investors easy. Web socket helps the clients to integrate live streaming functionality of the market data as well as order and trade confirmations. It can be easily integrated on any kind of application and works in an authenticated environment.
The consumption of web socket requires client to first connect it to the server and then subscribe to the type of data he or she wants to fetch. The connection request requires access token and client code as a query parameters, which is received in the response of the get access token API. After successful connection, users can subscribe or unsubscribe to different types of live streaming by sending respective requests.
wss://openfeed.5paisa.com/feeds/api/chat?Value1={{access_token}}|{{clientcode}}
URL Query Parametrs
PARAMETER NAME | MANDATORY | DESCRIPTION |
---|---|---|
access_tokenSTRING | Yes | Access token received in the response of login API |
clientcodeSTRING | Yes | Demat account client code of the client in plain text |
https://openfeed.5paisa.com/feeds/api/chat?Value1=eyJhbGciOiJIUzI1NiIsInR5cCI6IkXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjwMDUyNzcwIiwicm9sSI6IjEwMzQ1IiwiU3RhdGiOiIiLCJSZWRpcmVjdFNlcnZlciI6IkEiLCJuYmYiOjE3MDY5Og2NTUsImV4cCI6MTcwNzA3MTM5OSwiaWF0IjoxNz2OTk4NjU1fQ.TNCMKL4Vd09D3Z0X77zc6PTe7RRBWDD367v_ZHco0|50011110
Subscription Requests
PARAMETER NAME | MANDATORY | DESCRIPTION |
---|---|---|
MethodSTRING | Yes | It represents code for the type of data client wants to fetch.MarketFeedV3 |
OperationSTRING | Yes | It specifies if the request is for subscribing or unsubscribing the data feed.Subscribe |
ClientCodeSTRING | Yes | Demat account client code of the client in plain text |
MarketFeedDataARRAY | Only for methods: MarketFeedV3 MarketDepthService GetScripInfoForFuture(OI) Indices
| It contains an array of details of instruments for which live data streaming needs to be subscribed or unsubscribed |
MarketFeedData
FIELD NAME | MANDATORY | DESCRIPTION |
---|---|---|
ExchSTRING | Yes | This is the exchange of the instrumentN :- NSEB :- BSEM :- MCX |
ExchTypeSTRING | Yes | This is the exchange segment of the instrumentC :- CashD :- DerivativesU :- Currency |
ScripCodeINTEGER | Yes | This is the unique code for the instrument |
NOTE
The details of exchange, exchange type and scrip code for any instrument can be found from the Scrip master.
Method
{"Method":"MarketFeedV3","Operation":"Subscribe", "ClientCode":"{clientcode}","MarketFeedData":[ {"Exch":"N","ExchType":"C","ScripCode":1660} ]}
{"Method":"MarketFeedV3","Operation":"Unsubscribe", "ClientCode":"50052770","MarketFeedData":[ {"Exch":"N","ExchType":"C","ScripCode":1660} ]}
Response body
PARAMETER NAME | LIST OF VALUES | DESCRIPTION |
---|---|---|
Exch STRING | N B M | This is the exchange of the instrument |
ExchType STRING | C D U | This is the exchange segment of the instrument |
Token INTEGER | - | This is the unique scrip code for the instrument |
LastRate DOUBLE | - | This is the last traded rate for the instrument |
LastQty INTEGER
| - | This is the last traded quantity for the instrument |
TotalQty INTEGER | - | This is the total traded quantity for the instrument |
High DOUBLE | - | This is the highest price of the day for the instrument |
Low DOUBLE | - | This is the lowest price of the day for the instrument |
OpenRate DOUBLE | - | This is the open price rate of the instrument |
PClose DOUBLE | - | This is the close price rate of the instrument |
AvgRate DOUBLE | - | This is the average traded price of the day for the instrument |
Time INTEGER | - | - |
BidQty INTEGER | - | This is the last bid quantity for the instrument |
BidRate DOUBLE | - | This is the last bid rate for the instrument |
OffQty INTEGER | - | This is the last ask quantity for the instrument |
OffRate DOUBLE | - | This is the last bid rate for the instrument |
TBidQ INTEGER | - | This is the total bid quantity of the day for the instrument |
TOffQ INTEGER | - | This is the total ask quantity of the day for the instrument |
TickDt DATETIME | - | This is the timestamp in epoch format at which feed is fetched |
[
{
"Exch": "N",
"ExchType": "C",
"Token": 1660,
"LastRate": 440.1,
"LastQty": 0,
"TotalQty": 0,
"High": 447.2,
"Low": 439.5,
"OpenRate": 445,
"PClose": 442.9,
"AvgRate": 0,
"Time": 35950,
"BidQty": 0,
"BidRate": 0,
"OffQty": 0,
"OffRate": 0,
"TBidQ": 0,
"TOffQ": 0,
"TickDt": "\/Date(-62135596800000)\/",
"ChgPcnt": -0.6321969
}
]
{"Method":"MarketDepthService","Operation":"Subscribe","ClientCode":
"{clientcode}","MarketFeedData":[
{ "Exch":"N","ExchType":"C","ScripCode":2885}]}
{"Method":"MarketDepthService","Operation":"Unsubscribe","ClientCode":
"{clientcode}","MarketFeedData":[
{ "Exch":"N","ExchType":"C","ScripCode":2885}]}
Response body
PARAMETER NAME | LIST OF VALUES | DESCRIPTION |
---|---|---|
Exch STRING | N B M | This is the exchange of the instrument |
ExchType STRING | C D U | This is the exchange segment of the instrument |
Token INTEGER | - | This is the unique scrip code for the instrument |
TBidQ INTEGER | - | This is the total bid quantity of the day for the instrument |
TOffQ INTEGER | - | This is the total ask quantity of the day for the instrument |
Details ARRAY | - | This is the array containing details of the market depth of the instrument |
Time DATETIME | - | This is the timestamp in epoch format at which feed is fetched |
Details
PARAMETER NAME | LIST OF VALUES | DESCRIPTION |
---|---|---|
Quantity INTEGER | - | This is the quantity traded |
Price DOUBLE | - | This is the price at which orders are placed |
NumberOfOrders INTEGER | - | This is the number of orders placed |
BbBuySellFlag INTEGER | - | - |
{"Exch":"N","ExchType":"D","Token":71319,"TBidQ":86225,"TOffQ":135100,
"Details":[
{"Quantity":50,"Price":34925.65,"NumberOfOrders":2,"BbBuySellFlag":66},
{"Quantity":75,"Price":34925.6,"NumberOfOrders":2,"BbBuySellFlag":66},
{"Quantity":25,"Price":34925.55,"NumberOfOrders":1,"BbBuySellFlag":66},
{"Quantity":50,"Price":34925.5,"NumberOfOrders":2,"BbBuySellFlag":66},
{"Quantity":25,"Price":34925.4,"NumberOfOrders":1,"BbBuySellFlag":66},
{"Quantity":25,"Price":34932.1,"NumberOfOrders":1,"BbBuySellFlag":83},
{"Quantity":25,"Price":34932.15,"NumberOfOrders":1,"BbBuySellFlag":83},
{"Quantity":75,"Price":34932.95,"NumberOfOrders":1,"BbBuySellFlag":83},
{"Quantity":50,"Price":34933,"NumberOfOrders":1,"BbBuySellFlag":83},
{"Quantity":25,"Price":34933.15,"NumberOfOrders":1,"BbBuySellFlag":83}],
"TimeStamp":0,"Time":"\/Date(1640148238196)\/"}
{"Method":"GetScripInfoForFuture","Operation":"Subscribe","ClientCode": " {clientcode} ","MarketFeedData":[
{ "Exch":"N","ExchType":"D","ScripCode":48508}]}
{"Method":"GetScripInfoForFuture","Operation":"Unsubscribe","ClientCode": " clientcode ","MarketFeedData":[
{ "Exch":"N","ExchType":"D","ScripCode":48508}]}
Response body
PARAMETER NAME | LIST OF VALUES | DESCRIPTION |
---|---|---|
Exch STRING | N B M | This is the exchange of the instrument |
ExchType STRING | C D U | This is the exchange segment of the instrument |
Token INTEGER | - | This is the unique scrip code for the instrument |
OpenInterest INTEGER
| - | This is the open interest for the instrument. |
DayHiOI INTEGER | - | This is the highest open interest of the day for the instrument |
DayLoOI INTEGER | - | This is the lowest open interest of the day for the instrument |
{"Exch":"N","ExchType":"D","Token":71319,"OpenInterest":2388700,"DayHiOI":2388700,"DayLoOI":2345100}
{"Method":"OrderTradeConfirmations","Operation":"Subscribe","ClientCode":"CLIENT_CODE"}
{"Method":"OrderTradeConfirmations","Operation":"Unsubscribe","ClientCode":" CLIENT_CODE "}
Response body
PARAMETER NAME | LIST OF VALUES | DESCRIPTION |
---|---|---|
ClientCode STRING | - | IIFL Securities demat account client code of the client in plain text |
Exch STRING | N:NSE B:NSE | This is the exchange of the instrument |
ExchType STRING | C:Cash D:Derivatives | This is the exchange segment of the instrument |
BrokerOrderID INTEGER | - | This is the order ID generated by 5paisa. |
ExchangeOrderID STRING | - | This is the order ID generated by the exchange |
ScripCode INTEGER | - | This is the unique scrip code for the instrument |
Price DOUBLE | - | This is the price at which order is placed |
Qty INTEGER | - | This is the quantity for which order is placed |
BuySell STRING | B: Buy S: Sell | This specifies if the order is of buy or sell type. |
ReqType STRING | P: Place M: Modify C: Cancel T: Trade S: Stop Loss Trigeer | This specifies if the request is for placing, cancelling or modifying the order |
ReqStatus INTEGER | 0: Success 1: Failure | This is the status code for the order |
{"ReqType":"P","ClientCode":"CLIENT_CODE","Exch":"N","ExchType":"C","ScripCode":1660,"Symbol":"ITC","Series":"EQ","BrokerOrderID":132038757,"ExchOrderID":"1200010221327930","ExchOrderTime":"2024-05-09 11:28:22","BuySell":"B","Qty":1,"Price":425,"ReqStatus":0,"Status":"Placed","OrderRequestorCode":"CLIENT_CODE","AtMarket":"N","Product":"D","WithSL":"N","SLTriggerRate":0,"DisclosedQty":0,"PendingQty":1,"TradedQty":0,"RemoteOrderId":"202405091128221","Remark":""}
{"ReqType":"M","ClientCode":"CLIENT_CODE","Exch":"N","ExchType":"C","ScripCode":1660,"Symbol":"ITC","Series":"EQ","BrokerOrderID":132029886,"ExchOrderID":"1100030061127930","ExchOrderTime":"2024-05-09 11:32:34","BuySell":"B","Qty":1,"Price":0,"ReqStatus":0,"Status":"Modified","OrderRequestorCode":"CLIENT_CODE","AtMarket":"Y","Product":"D","WithSL":"N","SLTriggerRate":0,"DisclosedQty":0,"PendingQty":1,"TradedQty":0,"RemoteOrderId":"2324057911323","Remark":""}
{"ReqType":"C","ClientCode":"CLIENT_CODE","Exch":"N","ExchType":"C","ScripCode":1660,"Symbol":"ITC","Series":"EQ","BrokerOrderID":222072376,"ExchOrderID":"11000028100","ExchOrderTime":"2024-05-09 11:45:18","BuySell":"B","Qty":1,"Price":430,"ReqStatus":0,"Status":"Cancelled","OrderRequestorCode":"CLIENT_CODE","AtMarket":"N","Product":"D","WithSL":"N","SLTriggerRate":0,"DisclosedQty":0,"PendingQty":1,"TradedQty":0,"RemoteOrderId":"1235319136","Remark":""}
{"ReqType":"T","ClientCode":"CLIENT_CODE","Exch":"N","ExchType":"C","ScripCode":1660,"Symbol":"ITC","Series":"EQ","ExchOrderID":"120210200213230","ExchTradeId":"234495","ExchTradeTime":"2024-05-09 11:32:34","BuySell":"B","Qty":1,"Price":434.2,"PendingQty":0,"TotalTradedQty":1,"OrderQty":1,"OrderPrice":434.15,"RemoteOrderId":"204059112343","Product":"D","ReqStatus":0,"Status":"Fully Executed","Remark":""}
{"ReqType":"S","ClientCode":"CLIENT_CODE","Exch":"N","ExchType":"C","ScripCode":1660,"Symbol":"ITC","Series":"EQ","ExchOrderID":"1100000043224370","BuySell":"B","Qty":1,"OrderPrice":433.9,"AtMarket":"N","Product":"D","RemoteOrderId":"17152356907","ReqStatus":0,"SLTriggerRate":433.85,"SLTriggerTime":"2024-05-09 11:50:46","Status":"SL Triggered","Remark":""}