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
1 0 1 1

Is it possible to retrieve government bond discount factors using Eikon APIs?

This seems to be possible using the RHistory function in Excel, but not using one of the Eikon APIs in Python. The get_timeseries does not provide discount factors.

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.

Hello @mark.snijder

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


Upvotes
Accepted
18.2k 21 13 21

Hi @mark.snijder

You can install RDP Library by using this command:

pip install refinitiv.dataplatform


Then in your code, you can add this code, the RDP Library will connect to your Eikon Desktop(similar to Eikon Data API):

import refinitiv.dataplatform as rdp
rdp.open_desktop_session('<valid app key>')

df= rdp.get_historical_price_summaries('PLGOV1YZ=R', start='20210201', end='20210215')
display(df)

ahs1.png (204.7 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.

I should add to the answer by @chavalit.jintamalit that RDP Library for Python includes Eikon Data APIs as a module. Hence you can use both Eikon Data APIs and RDP Libraries methods from the same library. The following example uses Eikon Data APIs to retrieve the constituents of the Polish Treasuries zero curve, and then uses get_historical_price_summaries method of RDP Libraries to retrieve timeseries for the 1Y maturity point on the curve.

import refinitiv.dataplatform as rdp
import refinitiv.dataplatform.eikon as ek
rdp.open_desktop_session('MY_APP_KEY')

tmp_df, err = ek.get_data('0#PLXZ=R',['TENOR'])
df= rdp.get_historical_price_summaries(
    tmp_df.loc[tmp_df['TENOR']=='1Y','Instrument'].iloc[0], 
    start = '20210201', 
    end = '20210215')
display(df)
Upvotes
39.4k 77 11 27

@mark.snijder

I suppose what you would like to retrieve is timeseries of discount factors for various points on the zero curve derived from Treasuries, right? If this is the case, you can do this using RDP Libraries. Here's a the call using 10Y maturity point on US Treasuries zero curve.

rdp.get_historical_price_summaries('USGOV10YZ=R')

If you would like to retrieve something else, could you provide an example of RHistory function that retrieves the data you're interested in?

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
1 0 1 1

@Alex Putkov.

I have made a comparison in Excel for the 1Y Polish Government Bond rate (PLGOV1YZ=R). Retrieving both the discount factors and zero yields would result in the following:


Discount factor

image.png

Zero yield

image.png


When using the ek.get_timeseries() function in Python I am only able to retrieve the zero yields, which I can't transform to the discount factors (probably there is some smoothing involved). Are the discount factors available from the RDP library? What is the difference between the RDP.get_historical_price_summaries() function and the ek.get_timeseries() function?

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
18.2k 21 13 21

Hi @mark.snijder

The discount factor is available from the RDP Library.

The difference between EK vs RDP is:

  • Eikon.get_timeseries can only retrieve "default" view data.
  • RDP.get_historical_price_summaries can cover more views.


ahs.png (63.8 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
1 0 1 1

That is the solution I was looking for! Thanks for your help!

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.