Article

Retrieve Cross Economic Data using Eikon Data API (Python) | Refinitiv

Chavalit Jintamalit
Developer Advocate Developer Advocate
Raksina Samasiri
Developer Advocate Developer Advocate

Last update: February 23, 2022

The article demonstrates steps to retrieve cross economic data from different countries

  1. Using Economic Monitor app in Eikon Desktop/ Refinitiv Workspace to get Country's Economic Indicator RIC codes
  2. Then retrieving their economic data using Eikon Data API (Python)

 

Introduction to Economic Monitor app

Due to this DA (Data Notification) DN092084-Decommission of ECON chains from Eikon effective on 30 September 2017, we are moving away from the previous Country Economic Indicator chains to apps that are fully customizable and leverage on the depth of content that is available. For example, these chains have a fixed view and users cannot change which columns they want to see or don’t want to see. Whereas the Economic Monitor app on Eikon allows full customization to view the calendar of releases. For example, users can customize the following:

  • List of countries
  • Range of dates for events
  • View only a customized set of indicators
  • Alter the position of column
  • Add and remove the columns

To access Economic Monitor app, Type EM in the Eikon Search box and hit Enter, to launch the app.

The Economic Monitor provides distinct advantages over the old ECON pages. These are listed below:

a) You can select the events that you'd like to see, which are

Economic Events

Central Bank and Political Events - in year calendar format.

Holidays - year calendar - Includes FX specific holidays

Government debt auctions - listed by recent auction results / upcoming auctions

b) Hands-free auto-scrolling. Whilst you can scroll up and down to look at past / future events, you can always quickly return to what’s happening now by hitting ‘Go to now’

c) Search Items

d) Select how much data you want to see (how far back / forwards in time)

e) Market Relevance indicators. You can filter on these

f) Shockwaves are pictured immediately on release of a number which comes out outside of expectation

g) Reuters Poll provides expected value of the upcoming release. Drill down to see the detail of the poll

h) Export to Excel

i) View the detail of an indicator by clicking on its description. See the historical chart, the press release etc.

j) Fully customizable. Create your own country set-ups (eg ASEAN week ahead, US Today, BRIC month ahead etc.)

k) Real-time news stories as announcements are made

Plus, it's a resizable app. One of the most compact apps on Eikon! Set it up once, shrink it down and just leave it running for ever. It auto-scrolls as events pass.

Now, what about using this app to extract a list of Economic Indicator RIC to be used to retrieve economic data.

Here are steps to get started

This article uses "Hong Kong" to demonstrate the process to retrieve the cross economic data.

to get the Economic event RICs in Hong Kong, you can follow the step below

  1. Click the j) button, select the country Hong Kong
  2. You can also save the current profile as a list of country you would like to monitor
  3. Select how much data you want to see (how far back / forwards in time)
  4. Click 'Update' to retrieve the data based on the country selected
  5. Click 'Export to Excel' button > Download all events you have selected

The 'Economic Events' Excel file will be downloaded, Economic Indicator RICs of Hong Kong are included in this file (in RIC column)

The Coding part

Step 1) From the downloaded Excel file, a list of Economic Indicator RICs can be extracted using the Python code below. (in this article, the Excel file is placed in the same directory as Jupyter notebook file)

    	
            import pandas as pd
indicator_df = pd.read_excel('Economic Events.xlsx')
indicator_df

Step 2) Then let's extract RIC codes from RIC column and make it a list of RICs

    	
            hk_indicators = indicator_df['RIC'].tolist()
hk_indicators

This is output for Hong Kong Economic Indicator Identifiers:

    	
            ['HKIMPY=ECI',
'HKTRD=ECI',
'HKM3MS=ECI',
'HKRSL=ECI',
'HKRSY=ECI',
'HKPMI=ECI',
'HKFXR=ECI',
'HKIPY=ECI',
'HKPPIY=ECI',
'HKUNR=ECI',
'HKCPIY=ECI',
'HKCPIM=ECI',
'HKCPIT=ECI',
'HKOBOP=ECI',
'HKIMPY=ECI',
'HKTRD=ECI',
'HKM3MS=ECI',
'HKRSL=ECI',
'HKRSY=ECI',
'HKPMI=ECI',
'HKFXR=ECI',
'HKUNR=ECI',
'HKCPIY=ECI',
'HKCPIM=ECI',
'HKCPIT=ECI',
'HKIMPY=ECI',
'HKTRD=ECI',
'HKGDPA=ECI',
'HKGDYA=ECI',
'HKCEYA=ECI',
'HKPCYA=ECI',
'HKEGYA=ECI',
'HKESYA=ECI',
'HKFCYA=ECI',
'HKIGYA=ECI',
'HKISYA=ECI',
'HKM3MS=ECI',
'HKRSL=ECI',
'HKRSY=ECI',
'HKPMI=ECI',
'HKFXR=ECI',
'HKUNR=ECI']

Step 3) Retrieve the cross economic data from Eikon Data API

We are using the realtime quote model for economic indicators here and you can see its field name by typing a realtime RIC, such as 'HKIMPY=ECI' and access its in Quote app. Then hover the mouse over a particular value, the field name will be shown.

As an example below, the field name of Release Time is 'ACT_VAL_NS'

Here is the sample code to retrieve the values for each Economic Indicator RIC code:

Note that the rename() function is used to demonstrate the real meaning of the some fields used here.

    	
            # [Step 3] Retrieve the cross economic data from Eikon Data API
import eikon as ek

ek.set_app_key('#### YOUR VALID APP KEY ####')

# Retrieve data point on each Economic Indicator
fields = ['TR.IndicatorName','TR.IndicatorType','TR.IndicatorSource'
          ,'ECI_ACT_DT' # GMT Date
          ,'ACT_VAL_NS' # Time
          ,'FCAST_PRD' # Period
          ,'ECON_ACT' # Actual
          ,'RTR_POLL' # Reuters Poll
          ,'ECON_PRIOR' # Prior
          ,'ECON_REV' # Revised
         ]

df, e = ek.get_data(hk_indicators, fields)
# Rename dataframe columns
df.rename(columns={'ECI_ACT_DT':'GMT Date'
                   ,'ACT_VAL_NS':'Time'
                   ,'FCAST_PRD':'Period'
                   ,'ECON_ACT':'Actual'
                   ,'RTR_POLL':'Reuters Survey'
                   ,'ECON_PRIOR':'Prior'
                   ,'ECON_REV':'Revised'
                  },inplace=True)
df

 

Here is the result in the df dataframe which contains the cross economic data:

  • Register or Log in to applaud this article
  • Let the author know how much this article helped you
If you require assistance, please contact us here