Getting Started with Eikon Data API .NET in Jupyter Notebook

The Eikon Data API provides simple access to users who require programmatic access to Refinitiv data on the desktop. These APIs are intended for Eikon users.

The APIs provide access to the following content sets:

  • Fundamental and reference data
  • Price time series
  • News
  • Symbology conversion

This article will explain how to install and use the .NET library for Eikon Data API in Jupyter Notebook.

Note: This library is open-source, community-owned, and not officially supported by Refinitiv.

Prerequisite

  1. To run examples in this article, please refer to this Using .NET Core in Jupyter Notebook article for setting up Jupyter Notebook to support the .NET programming languages
  2. The Refinitiv Eikon or Workspace must be run properly on the machine
  3. The application key is required to connect to Eikon or Workspace. To generate the application, please refer to the Eikon Data API Quick Start Guide.

Install the packages

The Eikon Data API package is available in Nuget so the dotnet-interactive #r magic command can be used to install the package from NuGet.

Run the below commands to install Eikon Data API and Microsoft.Data.Analysis (0.4.0) packages.

Refer the namespaces

This article uses classes from the following four packages. Therefore, it uses the using statement to refer to those packages.

  • EikonDataAPI: .NET library for Eikon Data API
  • XPlot.Plotly: A cross-platform data visualization package for the F# and .NET programming languages
  • Microsoft.Data.Analysis: An easy-to-use and high-performance libraries for data analysis and transformation
  • Microsoft.AspNetCore.Html: Types for manipulating HTML content

Render a DataFrame as an HTML table

By default, a DataFrame is rendered as an HTML table with one row and two columns (Columns and Rows).

This can be overridden by registering the custom formatter for the DataFrame. The below code registers custom formatters for the Dataframe and DataFrameRow to render the data in an HTML table.

It only displays the first 100 rows. This can be changed by modifying the value of the take variable.

Create Eikon Interface

After installing EikonDataAPI, the application can use the API by calling the Eikon.CreateDataAPI() static method to create an Eikon interface. This interface is an access point to all functionalities in Eikon Data APIs.

Then, the first method that must be called with the Eikon interface is Eikon.SetAppKey(). This method accepts one string argument that represents the application ID. The application ID identifies your application on the Refinitiv Platform. You can get an application ID using the Application ID generator. For more information, please refer to the QuickStart guide.

Fundamental and reference data

The GetData() methods can be used to retrieve fundamental and reference data. These methods have three parameters.

The following code retrieves fundamental data — Revenue and Gross Profit — for Google, Microsoft, and Facebook.

The additional parameters can be specified to request full year revenue and gross profit for the last 2 years scaled to millions and converted to Euros.

Time Series Data

The GetTimeSeries() methods can be used to retrieve historical data on one or several RICs. These methods have eight parameters.

The following code returns time series of daily price history for Microsoft Corp ordinary share between 1st of Jan and 10th of April 2021.

News Headlines and Stories

The GetNewsHeadlines() methods can be used to get a list of news headlines. These methods have four parameters.

The following code retrieves news headlines of International Business Machines Corp (an equity RIC: IBM.N), between 00:00 and 23:59 GMT on the 7th of Apr 2020.

Then, the GetNewsStory() method can be used to retrieve a single news story corresponding to the identifier provided in StoryId. This method has one parameter.

This method returns a string of story text.

The following code retrieves the news story of the first retrieved news headline.

Symbology conversion

The GetSymbology() methods can be used to get a list of instrument names converted into another instrument code, such as converting SEDOL instrument names to RIC names. These methods have four parameters.

The following code converts RICs to ISINs and tickers and returns only best match.

Plot charts by using XPlot.Ploty

XPlot.Ploty is a cross-platform data visualization package for the F# and .NET programming languages. It is based on Plotly which is the popular JavaScript charting library.

The following examples demonstrate how to use XPlot.Ploty to plot charts from historical data retrieved by Eikon Data API.

Line chart

The following code plots a line chart from the CLOSE column in the DataFrame retrieved from the GetTimeSeries() method.

Bar Chart

The following code plots a bar chart from the VOLUME column in the DataFrame retrieved from the GetTimeSeries() method.

Candlestick Chart

The following code plots a candlestick chart from the OPEN, HIGH, LOW, CLOSE columns in the DataFrame retrieved from the GetTimeSeries() method.

Summary

Eikon Data API .NET library is available in Nuget which supports .NET Framework, and .NET core. It provides access to the following content sets through Refinitv desktop products:

  • Fundamental and reference data
  • Price time series
  • News
  • Symbology conversion

This article demonstrates how to install and use this library in Jupyter Notebook. It also uses the XPlot.Plotly package which is F# data visualization package to plot charts for the data in the Dataframe.

References

  1. Fslab.org. n.d. XPlot — F# Data Visualization Package. [online] Available at: https://fslab.org/XPlot/index.html [Accessed 6 May 2021].
  2. Phuriphanvichai, J., 2018. .NET Libraries for Eikon Data APIs Quick Start | Refinitiv Developers. [online] Developers.refinitiv.com. Available at: https://developers.refinitiv.com/en/article-catalog/article/net-libraries-eikon-data-apis-quick-start [Accessed 10 May 2021].
  3. Sequeira, J., 2020. dotnet/interactive: Magic Commands. [online] GitHub. Available at: https://github.com/dotnet/interactive/blob/main/docs/magic-commands.md [Accessed 6 May 2021].
  4. Phuriphanvichai, J., 2021. Using .NET Core in Jupyter Notebook | Refinitiv Developers. [online] Developers.refinitiv.com. Available at: https://developers.refinitiv.com/en/article-catalog/article/using--net-core-in-jupyter-notebook.html [Accessed 10 May 2021].
  5. Phuriphanvichai, J., 2021. Getting started with C# DataFrame and XPlot.Ploty | Refinitiv Developers. [online] Developers.refinitiv.com. Available at: https://developers.refinitiv.com/en/article-catalog/article/getting-started-with-c--dataframe-and-xplot-ploty.html [Accessed 10 May 2021].

Developer Advocate, Refinitiv