Data Services - NSE F&O

This path is about the data services of NSE F&O Equity : TPILWebAPI/Api/V1/Data/NseFutOpt

URL

Example POST API Request

http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt

Request Data Information

The data based on Segment ID( sid ), Instrument Type(instId), Request Type(rType), Other Info(oInfo)

  • Http Method: must be a POST Request
  • Http Scheme: http
  • Hostname: http://uat.tickermarket.com
  • Path: TPILWebAPI/ Api/V1/DATA/NseFutOpt (Data Services Endpoint path)
  • POST parameters:

Request

Key Required Value Discription
Segments TPIL_NSE 4 NSE Segment
Instrument TPIL_NSE Future 2 NSE Future and Options Instruments
Request Type NSE Future Data 1 - 19 NSE F&O Data Feed Services
Otherinfo Optional 0 Timestamp-Seconds
                            
                              {
                              "sid":"4",
                              "instId":"2",
                              "rType":"1"
                            }
                          
                        
                                                      
                            Authorization: Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-
                            Content-Type: application/json
                            Accept: application/json
                          
                        
                          [
    {
                            "Segment": "NSE",
                              "Instrument": "F&O",
                              "TPILCode": 1805,
                              "Symbol": "IOC",
                              "InstrumentName": "FUTSTK",
                              "ExpiryDate": "28OCT2021",
                              "StrikePrice": 0,
                              "OptionType": "XX",
                              "CompanyName": "Indian Oil Corporation",
                              "DateTime": "25-September-2021 13:46:30",
                              "BestBuyQty": 0,
                              "BestBuyPrice": 0.00,
                              "BestSellQty": 0,
                              "BestSellPrice": 0.00,
                              "LastTradedPrice": 119.15,
                              "Volume": 26000,
                              "NetChange": 14.30,
                              "PercentChange": 13.64,
                              "OpenPrice": 119.10,
                              "HighPrice": 119.15,
                              "LowPrice": 119.10,
                              "ClosePrice": 104.85,
                              "OpenInterest": 11063000,
                              "PercentOIChange": 0.00,
                              "ContractTraded": 4,
                              "nLotSize": 6500,
                              "nTradedValue": 0.31,
                              "nMsgTimeStamp": 1317044790,
                              "52WeekHighPrice": 0.00,
                              "52WeekLowPrice": 0.00
                         }
    ]
                        
                      
                                                      
                            {
                              "sid":"4",
                              "instId":"2",
                              "rType":"1"
                                                                               }
                                                                              
                                                      
                            Authorization: Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-
                            Content-Type: application/json
                            Accept: application/xml
                          
                        
                          <NSEFOList>
                      <item>
                        <Segment>NSE</Segment>
                        <Instrument>F&O</Instrument>
                        <TPILCode>1030</TPILCode>
                        <Symbol>DIVISLAB</Symbol>
                        <InstrumentName>FUTSTK</InstrumentName>
                        <ExpiryDate>28OCT2021</ExpiryDate>
                        <StrikePrice>0</StrikePrice>
                        <OptionType>XX</OptionType>
                        <CompanyName>Divis Laboratories</CompanyName>
                        <DateTime>25-September-2021 13:46:25</DateTime>
                        <BestBuyQty>0</BestBuyQty>
                        <BestBuyPrice>0.00</BestBuyPrice>
                        <BestSellQty>0</BestSellQty>
                        <BestSellPrice>0.00</BestSellPrice>
                        <LastTradedPrice>5243.50</LastTradedPrice>
                        <Volume>11400</Volume>
                        <NetChange>281.00</NetChange>
                        <PercentChange>5.66</PercentChange>
                        <OpenPrice>5250.55</OpenPrice>
                        <HighPrice>5250.55</HighPrice>
                        <LowPrice>5237.85</LowPrice>
                        <ClosePrice>4962.50</ClosePrice>
                        <OpenInterest>316600</OpenInterest>
                        <PercentOIChange>0.00</PercentOIChange>
                        <ContractTraded>57</ContractTraded>
                        <nLotSize>200</nLotSize>
                        <nTradedValue>5.98</nTradedValue>
                        <nMsgTimeStamp>1317044785</nMsgTimeStamp>
                        <52WeekHighPrice>0.00</52WeekHighPrice>
                        <52WeekLowPrice>0.00</52WeekLowPrice>
                        </item>
                          </NSEFOList>
                        
                      
                        
                        // Java Data Services - NSE
                      URL url = new
                      URL("http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt");

                        //Open URL connection
                      HttpURLConnection http = (HttpURLConnection)url.openConnection();

                        //POST Request
                      http.setRequestMethod("POST");
                      http.setDoOutput(true);
                      http.setRequestProperty("Accept", "application/json");
                      http.setRequestProperty("Content-Type", "application/json");
                      http.setRequestProperty("Authorization", "Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-");

                        //Create the Request Body
                      String data = "{\n  \"sid\": 4,\n  \"instId\": 1,\n  \"rType\": 1,\n  }";
                      byte[] out = data.getBytes(StandardCharsets.UTF_8);

                        // Response Data
                      OutputStream stream = http.getOutputStream();
                      stream.write(out);

                      System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
                      http.disconnect();
                    
                  
                        
                        // C# Data Services - NSE
                                var  url = "http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt");
                                var httpRequest= (HttpWebRequest) WebRequest.Create(url);

                        //POST Request
                                http.setRequestMethod("POST");
                                
                                httpRequest.Accept("application/json");
                                
                                http.Headers("Authorization", "Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-");
                                httpRequest.ContentType("application/json");

                        //Create the Request Body
                                var data = "{\n  \"sid\":4,\n  \"instId\": 1,\n  \"rType\": 1,\n  }";
                                Using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
                                {
                                streamWriter.Write(data);
                                }


                        // Response Data

                                var httpResponse = (HttpWebResponse) httpRequest.GetResponse();
                                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                                {
                                Var result= streamReader.ReadToEnd();
                                }
                                Console.WriteLine(httpResponse.StatusCode);


                            
                  
                        
                        //PHP Data Services - NSE

                               ?php

                                $url = ("http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt ");
                                $curl = (curl_init($url));
                                curl_seropt($curl, CURLOPT_URL, $url);
                                curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);



                                

                        //POST Request



                                $headers = array("Authorization :":"GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-" , Content-Type : application/json);
                                Curl_setopt($curl ,, CURLOPT_HTTPHEADER, , $headers);


                        //Create the Request Body
                                $data= DATA{ {
                                "sid" : 4,
                                "instId" : 1,
                                "rType": 1
                                };




                        // Response Data

                                Curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
                                $resp=curl_exec($curl);
                                curl_close($curl);
                                var_dump($resp);
                                ?>

                            
                        
                        //Python Data Services - NSE
                                Import requests
                                From requests.structure import CaseInsensitiveDict

                                url = ("http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt ");
                                headers = CaseInsensitiveDict()



                                

                        //POST Request


                                headers [ "Accept"] = "application/json"
                                headers["Authorization"] = " Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-  "
                                headers["Content-Type"] = "application/json"


                        //Create the Request Body
                                data= """
                                {
                                "sid" : "4",
                                "instId": "1",
                                "rType": "1"
                                }
                                """




                        // Response Data

                                resp = request.post(url, headers=headers, data=data)
                                print(resp.status_code)


                            
                        
                        //Javascript Data Services - NSE


                                Var url=("http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt" )
                                Var xhr = new XMLHttpRequest();




                                

                        //POST Request


                                xhr.open("POST", url);
                                xhr.setRequestHeader("Accept","application/json" );
                                xhr.setRequestHeader("Authorization","Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe- " );
                                xhr.setRequestHeader(Content-Type, "application/json" );

                                xhr.onreadystatechange= function() {
                                if(xhr.readyState = = = 4)
                                {
                                Console.log(xhr.status);
                                Console.log(xhr.responseText);
                                }};



                        //Create the Request Body
                                Var data = '{
                                "sid" : 3,
                                "instId" : 1,
                                "rType": 1
                                }';





                        // Response Data

                                Xhr.send(data);
                                Console.log(xhr.status);



                            
                        
                        //CURL Data Services - NSE


                                #! /bin/bash
                                #Login:


                        //POST Request


                                curl -d  "{ \ username\" :  \ "ABB \" , \"password\" : \"password\"}" "-H content-type: application/json" " http://uat.tickermarket.com TPILWebAPI/Api/V1/Users/Login"

                                Curl -X POST http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/NseFutOpt   -H "Authorization: Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-"  -H
                        "Content-Type: application/json"


                        //Create the Request Body
                                - - data-binary @- << DATA
                                {
                                "sid" : "3",
                                "instId": "1",
                                " rType": "1""
                                }
                                DATA