Last Updated: Jan 2026
About the example
This example is a C# console-based application, and it was created to demonstrates how to use Microsoft .NET 8.0 with LSEG Tick History REST API. The example also uses the REST API with direct HTTPS. It can use to retrieve Historical Tick data (Time and Sales data) and End of day data, with an On-Demand extraction request.
About the REST API
Tick History's REST API is a Representational State Transfer (REST)-compliant API that programmatically exposes Tick History functionality on the DataScope Select platform. Client applications can be written in most programming languages, such as C#, C++, Visual Basic, Java, Python, and Swift.
There are two options for a .NET developer to use the REST API. The first option is to use the .NET SDK REST API toolkit, and the second one is to communicating directly with the server using HTTPS. When we are writing this article, using the REST API toolkit has some limitations when the user wants to deploy the .NET application on other platforms such as macOS, Linux, and AWS Lambda Cloud environment. This is because the toolkit was created with .NET Framework 4.x, which supports the Windows platform only. Cloud environment such as AWS Lambda supports only function code in C# using the .NET 8.0. As a result, they cannot run the .NET application built with the REST API toolkit on other platforms. More information about a limitation of the Toolkit will be provided in the next topic. There is an option for the .NET developer to develop an application on the cross-platform environment; they can develop the application with .NET SDK. Developers can use .NET functionality to communicate directly over HTTPS, and it just like working with other programming languages such as Java or Python.
Limitation of REST API Toolkit
This section describing the issue when using the REST API Toolkit on macOS or Linux. At the time we write this article, we understand that the Toolkit has the following limitation.
- It supports only Windows Platform because the Toolkit is still building with .NET Framework 4.x.
- It's unable to run on macOS and Linux as it requires some of the dependency libraries available on Windows only.
- It’s not an Open Source SDK; therefore, we cannot modify the codes or change anything to upgrade the dependency libraries used by the Toolkit.
Typically you can create a new project target .NET 8.0 on Visual Studio 2022 and then add libraries from the REST API Toolkit to the project. You should be able to build the solution or project without any error, and you should be able to run it on a Windows platform. The following sample codes demonstrate an Extraction request, and it works very well on Windows with the .NET 8.0 Project type.
However, if you copy the same .NET project to macOS or Linux and rebuild it. You may receive errors about an unresolved reference like the following errors.
When we write this article, it looks like the OData Client version with related components used by the REST API toolkit is not compatible with the OData Client supported by .NET 8.0 and above. And it seems to be the main problem that prevents us from using the API Toolkit on macOS or Linux. The reason that it works on Windows because you have .NET Framework installed on the Windows. Therefore, the application can load underlying libraries provided by .NET Framework 4.x. If you copy the same project to a newly installed Windows and it has only .NET 8.0 installed, you should see the same error message generated by the dotnet command.
.NET Solution
As explained earlier, the .NET developer may choose an alternative approach by communicating directly over HTTPS like the other programming languages. So they can control everything, including the way to send HTTP requests and process the HTTP response. However, the developer has to understand the request messages they need to send and the HTTP Headers required by the server. There are REST API User Guide and the REST API Reference that provide more information about the API specification and the information about HTTP request and response along with the request condition and its parameters.
.NET SDK providing HTTPClient class, which can be used to send an HTTP request and process the response message, and it has a new version of NewtonSoft JSON.NET, which supports the .NET target platform and fully compatible with .NET 8.0. The developer can use both libraries or classes together to process the message and get the JSON data.
Technical Requirements
Based on the solution described above, this example requires the following SDK and library for implementing the .NET application.
- Visual Studio 2022 or Visual Studio Code.
- .NET 8.0. You can find installation instructions, including the document about .NET, from Microsoft website. This example uses HttpClient class to send a request and get a response from DSS Server.
- C# is the programming language used in the example application.
- Using NewtonSoft Json.Net to parse data from the HTTP response message.
You can use Visual Studio 2022 or using just Visual Studio code to open the example codes. We will provide sample codes in the next topic.
How to use HttpClient
It starts by explicitly create HttpClientHandler and then passes it to HttpClient. Next step application has to create HttpRequestMessage and select HttpMethod Post or Get and then set HTTP header according to REST API User Guide. To send HTTP Post message, the application needs to convert JSON request message according to the user guide to StringContent type and set it to Content of the HttpRequestMessage.
The following sample codes demonstrate how to use HttpClient class to send HTTP requests (Post/Get) and process HTTP response messages using Json.NET.
Send HTTP Post
Send Http Get
To get data from the response message, the application may use JObject.Parse from NewtonSoft Json.NET library to parse the data. The following sample codes demonstrate how to get JobID and Notes from the HTTP response message.
A sample of HTTP response message
Sample code to parse the JSON data
To download the result from the server, it can allow users to download data from Amazon S3 instead. The application has to add an X-Direct-Download custom header in the HTTP request message and set it to True to get HTTP Redirect to a new download location on Amazon S3. Below are sample codes from the example.
Demo
There are two console applications provide in the solution.
1. Authentication example
It's an example to demonstrate how to get Authentication Token from TickHistorical Server. We follow instructions from Tutorial 1 to create the request message.
This example sends an Authentication request to Tick History Server and prints Token to console output.
Running the example
1) Modify Credential.json in the Authentication folder. Set DSS User name and DSS Password and save.
2) Open Command line and change directory to folder Authentication
3) Run dotnet command with following options
You should see output like the following example. If there is no problem with the username and password, it will show the Token from the DSS server.
2. RawExtraction example
It's an example to demonstrate how to use the REST API to retrieve Time and Sales Tick History. The example will read the JSON file request query and then set it as a Content of HttpRequestMessage class. We will apply instructions and steps from REST API Tutorial 4: On-Demand tick data extraction to create the messages. Anyway, we will skip the steps to request a field list from the server and manually set required fields in the JSON file.
This example will retrieve data and write it to filename "output.csv.gz" by default. You have to unpack the .gz file and then open the output in CSV format. As the example read, the JSON file query could be applied with the End of Day Extraction request. The user can modify the request in the default JSON file and run the example.
Running the example
1) This example obtains a DSS username and password from the application user. It will read username and password from console input to don't need to use Credential.json like Authentication example.
2) Open Command line and change directory to RawExtraction
3) This example reads JSON request content from ExtractionRequest.json file so that you can modify ExtractionReqeust.json to request item and fields you want. The default value is for Time and Sales Tick Historical data.
4) Run command dotnet restore to restore required libraries and then build the example.
You should see the following console output.
Next step using dotnet run command to run the example
Below is sample console output from the example.
Unpack output.csv.gz and open output.csv you should see the output like this.
The RawExtraction example also provides file EODDataExtraction.json in the same project folder. It is a sample request for End of Day data. You can just replace ExtractionRequest.json with information from EODDataExtraction.json.
You can download examples from GitHub.
Get In Touch
Related Articles
Related APIs
SOURCE CODE
Request Free Trial
Call your local sales team
Americas
All countries (toll free): +1 800 427 7570
Brazil: +55 11 47009629
Argentina: +54 11 53546700
Chile: +56 2 24838932
Mexico: +52 55 80005740
Colombia: +57 1 4419404
Europe, Middle East, Africa
Europe: +442045302020
Africa: +27 11 775 3188
Middle East & North Africa: 800035704182
Asia Pacific (Sub-Regional)
Australia & Pacific Islands: +612 8066 2494
China mainland: +86 10 6627 1095
Hong Kong & Macau: +852 3077 5499
India, Bangladesh, Nepal, Maldives & Sri Lanka:
+91 22 6180 7525
Indonesia: +622150960350
Japan: +813 6743 6515
Korea: +822 3478 4303
Malaysia & Brunei: +603 7 724 0502
New Zealand: +64 9913 6203
Philippines: 180 089 094 050 (Globe) or
180 014 410 639 (PLDT)
Singapore and all non-listed ASEAN Countries:
+65 6415 5484
Taiwan: +886 2 7734 4677
Thailand & Laos: +662 844 9576