Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
7 4 4 7

How to get historical times series for Central Bank of Russia key rate with Eikon API in Python?

Good afternoon!

I need to download historical values of Central Bank of Russia key rate from 2014 till today with Eikon Data API in Python. How can I do this?

I have found three rics for this key rate:

  1. RUKEYRATE=CBRF
  2. RUCBIR=ECI
  3. RUCBIR=ECIX

I decided to use the first, because I can not find any fields for the other two in Data Item Browser.

My code in Python:

today_str = datetime.strftime(datetime.today(), format="%Y-%m-%d")

keyRate, err = ek.get_data(instruments=['RUKEYRATE=CBRF'],
                           fields={'CF_CLOSE':{'SDate':'2014-01-01', 
                                               'EDate':today_str}})
keyRate

When I use 'CF_CLOSE' in fields parameter, NaN is returned; 'CF_LAST' returns only last value of the key rate, and I need historical time series.

Any help is appreciated.

@Alex Putkov. would be great if you could give some advice.

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
78.8k 250 52 74

@lozovoy.hse

The CF_LAST and CF_CLOSE fields are real-time fields that don't provide time-series data with the get_data method.

You need to use fields that support time-series such as TR.ClosePrice. From my checking, the TR.ClosePrice field is not available for those RICs. You can re-verify it by using the Data Item Browser. Otherwise, you can directly contact the content support team via MyRefinitiv to verify it.

However, I can retrieve time-series data of those RICs via the get_timeseries method.

df = ek.get_timeseries(['RUKEYRATE=CBRF'],                        
                       start_date = "2014-01-01", 
                       end_date=today_str, 
                       interval="daily")

RUCBIR=ECI and RUCBIR=ECIX don't support the daily interval so I change the interval to monthly.

df = ek.get_timeseries(['RUCBIR=ECI','RUCBIR=ECIX'],                        
                       start_date = "2014-01-01", 
                       end_date=today_str, 
                       interval="monthly")

The get_timeseries method has data limitations, as mentioned in the Eikon Data API Usage and Limits Guideline.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5.7k 21 2 6

Hi @lozovoy.hse ,


I would advise searching for fields on the DIB that do not have blank values by ticking the 'Blank Values' box in the settings on the top right:

1626079005805.png


You can also filter through time series fields only. Doing this, I found that this instrument does not lend itself well to the Python EDAPI, it is more meant for real time analysis; I'm guessing that this is not the kind of analysis you have in mind.

May I advise using Datastream? Or is that not an option?
On Datastream, you can have such historical data-sets




1626079005805.png (104.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
7 4 4 7

@jonathan.legrand Thank you for immediate response, but I have no access to Datastream.

@jirapongse.phuriphanvichai Thank you very much! The code works fine, I can download what I needed.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.