Data Services - LmeData

This path is about the data services of LmeData : TPILWebAPI/Api/V1/Data/LmeData

URL

Example POST API Request

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

Request Data Information

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

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

Request

Key Required Value Discription
Segments TPIL_LmeData 7 LmeData
Instrument TPIL_LmeData_SEGMENT 1 Segment
Request Type Services 1-3 LmeData Request Data
Otherinfo Optional 0 Timestamp-Seconds
                                                      
                            {
                              "sid":"7",
                              "instId":"1",
                              "rType":"1"
                                                                               }
                                                                              
                                                      
                            Authorization: Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-
                            Content-Type: application/json
                            Accept: application/json
                          
                                                      
    [
    {
                        "Segment": "LmeData",

                        "Instrument": "METAL",
                        "TPILCode": 4900,
                        "CommodityName": "COPPER",
                        "Symbol": "S:CA\\3M\\F22",
                        "ExpiryDate": "01JAN1980",
                        "StrikePrice": 0.0000,
                        "OptionType": "XX",
                        "DateTime": "14-October-2021 17:55:7",
                         "BestBuyQty": 21,
                         "BestBuyPrice": 7.7500,
                        "BestSellQty": 10,
                        "BestSellPrice": 8.5000,
                        "LastTradedPrice": 7.7500,
                        "Volume": 121,
                        "OpenInterest": 0,
                        "NetChange": 0.7500,
                        "PercentChange": 10.7100,
                        "OpenPrice": 5.5100,
                        "HighPrice": 7.7500,
                        "LowPrice": 5.5100,
                        "ClosePrice": 7.0000,
                        "Value": 937.7500,
                        "nMsgTimeStamp": 1318701307,
                        "SessionIndicator": 4




   }
    ]

                                                      
                            {
                              "sid":"7",
                              "instId":"1",
                              "rType":"1"
                                                                               }
                                                                              
                                                      
                            Authorization: Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-
                            Content-Type: application/json
                            Accept: application/xml
                          
                                                      
    <LmeData>
    <item>
    <Segment>LmeData</Segment>
    <Instrument>METAL</Instrument>
    <TPILCode>4900</TPILCode>
    <CommodityName>COPPER</CommodityName>
    <Symbol>S:CA\3M\F22</Symbol>
    <ExpiryDate>01JAN1980</ExpiryDate>
    <StrikePrice>0.0000</StrikePrice>
    <OptionType>XX</OptionType>
    <DateTime>14-October-2021 17:55:7</DateTime>
    <BestBuyQty>21</BestBuyQty>
    <BestBuyPrice>7.7500</BestBuyPrice>
    <BestSellQty>10</BestSellQty>
    <BestSellPrice>8.5000</BestSellPrice>
    <LastTradedPrice>7.7500</LastTradedPrice>
    <Volume>121</Volume>
    <OpenInterest>0</OpenInterest>
    <NetChange>0.7500</NetChange>
    <PercentChange>10.7100</PercentChange>
    <OpenPrice>5.5100</OpenPrice>
    <HighPrice>7.7500</HighPrice>
    <LowPrice>5.5100</LowPrice>
    <ClosePrice>7.0000</ClosePrice>
    <Value>937.7500</Value>
    <nMsgTimeStamp>1318701307</nMsgTimeStamp>
    <SessionIndicator>4</SessionIndicator>
    </item>
    </LmeData>
                        
                        // Java Data Services - LmeData
URL url = new
URL("http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/LmeData");

//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\": 7,\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 - LmeData
                                var  url = "http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/LmeData");
                                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\": 7,\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 - LmeData

                              ?php

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





                        //POST Request



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


                        //Create the Request Body
                                $data= DATA{ {
                                "sid" : 7,
                                "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 - LmeData
                                Import requests
                                From requests.structure import CaseInsensitiveDict

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





                        //POST Request


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


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




                        // Response Data

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


                            
                        
                        //Javascript Data Services - LmeData


                                Var url=("http://uat.tickermarket.com/TPILWebAPI/Api/V1/Data/LmeData" )
                                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" : 7,
                                "instId" : 1,
                                "rType": 1
                                }';





                        // Response Data

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



                            
                            
                                //CURL Data Services - LmeData


                                #! /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/LmeData   -H "Authorization: Bearer GciOiJIUzUxMiJ9.eyJzdWIiOiJERkRFTU8wMDAxICAgICAiLCJleHAiOjE2MjkyMTEyNDMsImlhdCI6MTYyOTE5MzI0M30.7GQJ_UxBecVe-"  -H
                                "Content-Type: application/json"


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