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.

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @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.


Answers