Eikon Data API

API Family: Eikon APIs

Quick Start guide for Windows

Last update Mar 2019
Operating System Windows
Interpreter Python 2.x/3.x
Eikon version 4.0.36 or higher.

Mac OS users should refer to the Quick Start guide for MacOs (Beta version)

Start with the Eikon Data API for Python in 4 steps

  1. Run the Eikon application
  2. Create an App Key for your application
  3. Install the Python library for Eikon Data API
  4. Let's have some fun !

1. Run the Eikon application

The Eikon application integrates a Data API proxy that acts as an interface between the Eikon Data API Python library and the Eikon Data Platform. For this reason, the Eikon application must be running when you use the Eikon Data API Python library. When launched, the Eikon application starts listening for local websocket connections on port 9000 or the next available port if port 9000 is already occupied. You need to have a valid Eikon user account to be able to launch the Eikon application.

2. Create an App Key for your application

Every application using the Eikon Data API must identify itself thanks to a Key called Application Key or App Key for short. This Key, that is a unique identifier for your application, must be created using the App Key Generator Eikon app that you can find in the Eikon App Library or via the toolbar of Eikon. Here is how to run it and how to create an App Key for a new application:

  1. In the Eikon toolbar type "App Key" and run the App Key Generator app:

  1. In the App Key Generator app indicate the name of your new application, select the APIs it uses and click on the "Register New App" button:

  1. Read the "Terms & Conditions" and click on the "Accept" button

  1. Copy the App Key that you will use later in your new application:

3. Install the Python library for the Eikon Data API

The Eikon Data API Python library is an ease of use library, which conveniently wraps the raw message transcription between Eikon and Python and provides user friendly data retrieval calls. The data output from the Eikon Data API Python library is available as Pandas DataFrames or as JSON objects.

Note: if you do not have a Python environment, please refer to the Setting up a Python development environment tutorial to set one up before following the next steps.

Run the following command to install the Eikon package from the Python Package Index (PyPI):

pip install eikon

Note: This command must be run at the prompt of the command-line interpreter (CMD). If the "Script/" folder of your Python installation is not included in your PATH environment variable, you may even have to navigate to this folder before you run the pip command.

Below is an example of the expected output

C:\>
C:\>cd Python36-32\Scripts
C:\Python36-32\Scripts>pip install eikon
Collecting eikon
  Using cached eikon-0.1.11-py3-none-any.whl
Collecting websocket-client (from eikon)
  Using cached websocket_client-0.46.0-py2.py3-none-any.whl
...
Installing collected packages: six, websocket-client, zope.interface, pytz, date
time, appdirs, numpy, python-dateutil, pandas, certifi, chardet, idna, urllib3,
requests, eikon
Successfully installed appdirs-1.4.3 certifi-2018.1.18 chardet-3.0.4 datetime-4.2 eikon-0.1.11 idna-2.6 numpy-1.14.0 pandas-0.22.0 ython-dateutil-2.6.1 pytz-2017.3 requests-2.18.4 six-1.11.0 urllib3-1.22 websocket-client-0.46.0 zope.interface-4.4.3
C:\Python36-32\Scripts>

4. Let's have some fun !

Launch Python IDE and try the following commands.

Initialize the Eikon object. Replace '8e5a3xxxxxxxxxxxxxxxxxxxxxxxxxxxx21b031c' with the App Key generated in step 2.

import eikon as ek
ek.set_app_key('8e5a3xxxxxxxxxxxxxxxxxxxxxxxxxxxx21b031c')

Note: In earlier versions of the Python library for Eikon Data APIs, the set_app_key function was called set_app_id. The set_app_id function is now deprecated but still works. If you use an earlier version of the Python library you can call set_app_id to set the App Key of your application.

Great, you have imported the library and set the App Key of your application. You are now ready to send data retrieval requests.

The following instruction retrieves news headlines on Deutsche Lufthansa AG (equity RIC: LHAG.DE), between 09:00 and 18:00 GMT on the 5th of Apr 2017.

ek.get_news_headlines('R:LHAG.DE', date_from='2019-03-06T09:00:00', date_to='2019-03-06T18:00:00')

out:

  versionCreated text storyId sourceCode
2019-03-15 16:35:55.731 2019-03-15 16:35:55.731 Tagesvorschau 18.03.2019 urn:newsml:reuters.com:20190315:nAWP3vd2n8:1 NS:AWP
2019-03-15 14:40:56.000 2019-03-15 15:19:15.000 SunExpress Boeing 737 MAX siparişlerinde karar... urn:newsml:reuters.com:20190315:nL8N2124TT:1 NS:RTRS
2019-03-15 14:53:31.000 2019-03-15 14:53:31.000 SunExpress sticks to Boeing 737 MAX orders des... urn:newsml:reuters.com:20190315:nFWN2120AN:1 NS:RTRS
2019-03-15 14:53:04.000 2019-03-15 14:53:04.000 FIRMEN-BLICK-Ferienflieger SunExpress hält an ... urn:newsml:reuters.com:20190315:nL8N2124UW:1 NS:RTRS
2019-03-15 12:28:02.876 2019-03-15 12:28:02.876 Austrian Airlines: Annual results 2018: Passen... urn:newsml:reuters.com:20190315:nNRA880x8g:1 NS:ENPNWS
2019-03-15 12:28:02.318 2019-03-15 12:28:02.318 Traffic results for February 2019: More Than 8... urn:newsml:reuters.com:20190315:nNRA880x8j:1 NS:ENPNWS
2019-03-15 12:28:02.299 2019-03-15 12:28:02.299 Lufthansa Group to Buy 20 Boeing 787 Dreamline... urn:newsml:reuters.com:20190315:nNRA880x7p:1 NS:ENPNWS
2019-03-15 12:05:06.205 2019-03-15 12:05:06.205 Lufthansa to buy 40 long-haul aircraft to redu... urn:newsml:reuters.com:20190315:nNRA880mz3:1 NS:DATMTR
2019-03-15 10:38:43.685 2019-03-15 10:38:43.685 DJ Why Flag Carriers Struggle to Create Low-Co... urn:newsml:reuters.com:20190315:nDJR15tblb:2 NS:DJN
2019-03-15 09:03:35.394 2019-03-15 09:03:35.394 Lufthansa und Wirecard-Aktie knicken ein urn:newsml:reuters.com:20190315:nNRA87z2u9:1 NS:DERSPI

Now, let's display the latest news story satisfying the news search expression "EU AND POL", which represents news on the European Union politics.

First, retrieve the news headlines using the search expression, then get the story ID from the response and finally request the story.

headlines = ek.get_news_headlines('EU AND POL',1)
story_id = headlines.iat[0,2]
ek.get_news_story(story_id)

The output is the HTML of the news story.

 

The following commands return time series of daily price history for Microsoft Corp ordinary share between 1st of Jan and 10th of Jan 2016.

df = ek.get_timeseries(["MSFT.O"], 
                       start_date="2016-01-01",  
                       end_date="2016-01-10")
df

out:

MSFT.O HIGH CLOSE LOW OPEN COUNT VOLUME
Date            
2016-01-04 54.8000 54.80 53.39 54.32 272781.0 53777963.0
2016-01-05 55.3900 55.05 54.54 54.93 180637.0 34079674.0
2016-01-06 54.4001 54.05 53.64 54.32 225856.0 39518863.0
2016-01-07 53.4850 52.17 52.07 52.70 303271.0 56564852.0
2016-01-08 53.2800 52.33 52.15 52.37 261949.0 48753969.0

The following commands retrieve fundamental data - Revenue and Gross Profit - for Google, Microsoft abd Facebook

df, err = ek.get_data(['GOOG.O','MSFT.O', 'FB.O'], 
                      [ 'TR.Revenue','TR.GrossProfit'])
df

out:

  Instrument Revenue Gross Profit
0 GOOG.O 90272000000 55134000000
1 MSFT.O 85320000000 52540000000
2 FB.O 27638000000 23849000000

You can specify additional parameters and request full year revenue and gross profit for the last two years scaled to millions and converted to Euros. E.g.

df, err = ek.get_data(['GOOG.O', 'MSFT.O', 'FB.O', 'AMZN.O', 'TWTR.K'], 
                      ['TR.Revenue.date','TR.Revenue','TR.GrossProfit'],
                      {'Scale': 6, 'SDate': 0, 'EDate': -2, 'FRQ': 'FY', 'Curn': 'EUR'})
df

out:

  Instrument Date Revenue Gross Profit
0 GOOG.O 2016-12-31T00:00:00Z 85866.726400 52443.460800
1 GOOG.O 2015-12-31T00:00:00Z 69050.621090 43116.928250
2 GOOG.O 2014-12-31T00:00:00Z 54559.726650 33634.735200
3 MSFT.O 2016-06-30T00:00:00Z 76837.485600 47316.473200
4 MSFT.O 2015-06-30T00:00:00Z 84041.390600 54370.953940
5 MSFT.O 2014-06-30T00:00:00Z 63423.691530 43645.649550
6 FB.O 2016-12-31T00:00:00Z 26289.265600 22685.168800
7 FB.O 2015-12-31T00:00:00Z 16508.281680 13868.319410
8 FB.O 2014-12-31T00:00:00Z 10305.018900 8525.241450
9 AMZN.O 2016-12-31T00:00:00Z 129350.834400 45393.166400
10 AMZN.O 2015-12-31T00:00:00Z 98532.194860 32555.237550
11 AMZN.O 2014-12-31T00:00:00Z 73561.930200 21687.989400
12 TWTR.K 2016-12-31T00:00:00Z 2406.173593 1519.426905
13 TWTR.K 2015-12-31T00:00:00Z 2042.386046 1370.879829
14 TWTR.K 2014-12-31T00:00:00Z 1159.791603 790.850268

You can also mix fundamental data with a snapshot of market data.

df, err = ek.get_data(['VOD.L', 'FB.O'], 
                      [ 'TR.Revenue', 'TR.GrossProfit', 'CF_LAST'])
df

Out:

  Instrument Revenue Gross Profit CF_LAST
0 VOD.L 55945230741 14388764346 203.1992
1 FB.O 27638000000 23849000000 140.78

For further information visit the Tutorials section.