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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
5 0 2 1

Hi, I want to download time series data for government and corporate bond yields. I found the screens with current data but I could not retrieve any historical (time series) data. Thank you!

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonbonds
icon clock
10 |1500

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

Upvote
Accepted
18k 21 12 20

Hi @evan.salachas

The get_historical_price_summaries does not support multiple instruments.

You can make a loop in your code:


ahs.png (18.6 KiB)
icon clock
10 |1500

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

Thank you for the response! It works!

Hi,

In relation to a previous comment, how can I download the output data into an excel? For example the first column dates, the second column the MID_YLD_1 for the first RIC, the third column the MID_YLD_1 for the second RIC, and so on.


Thank you in advance,

Hi @evan.salachas

If you have a new question, it is advised to start a new question.


To export dataframe to excel file, you can refer to the sample on this page.

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_excel.html

ahs.png (16.3 KiB)

@evan.salachas

If you'd like to save the data you retrieved in Python as a file you can open in Excel, use to_excel or to_csv method of pandas library, as @chavalit.jintamalit said. And if you'd like to retrieve the data directly into Excel, use RHistory worksheet function provided by Eikon Excel add-in, e.g.

=RHistory("345370BR0=","MID_YLD_1.Timestamp;MID_YLD_1.Close","INTERVAL:1D",,"CH:Fd")
Upvotes
39.2k 75 11 27

Here's a quick example

import refinitiv.dataplatform as rdp
rdp.open_desktop_session('USE_YOUR_APP_KEY_HERE')
rdp.get_historical_price_summaries(
        universe = '345370BR0=',
        start = '2020-12-10',
        end = '2020-12-26',
        fields=['MID_YLD_1'])

For more examples see Jupyter notebooks demonstrating Historical Pricing under RDP Library examples in Refinitiv API Samples repository on Github.

icon clock
10 |1500

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

Hi Alex, thank you for the answer

Just want to comment that I run the code and it seems that it is executed however I do not see any output.

I also run the code in Jupiter and the output was presented

Should I run any other command?

Thank you in advance


1609577675934.png (72.2 KiB)
1609577788435.png (26.1 KiB)

Jupyter (or rather IPython) by default displays the results of the execution of the last line of code in the cell. Other Python interpreters, like the one used by Spyder, don't do that. With regular Python interpreter, to display any output on the screen, you need to explicitly include this action in your code. E.g.

df = rdp.get_historical_price_summaries(
         universe = '345370BR0=',
         start = '2020-12-10',
         end = '2020-12-26',
         fields=['MID_YLD_1'])
print(df)

Thank you for your answer. The code works well. How can I obtain data for multiple series in universe e.g.

universe = '345370BR0= 'GR176298006= and so on. Thank you

Upvotes
5 0 2 1

Thank you for your answer. The code works well. How can I obtain data for multiple series in universe e.g.

universe = '345370BR0= 'GR176298006= and so on. Thank you

icon clock
10 |1500

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

Upvotes
39.2k 75 11 27

get_historical_price_summaries method of RDP library can only retrieve one instrument at a time. To retrieve timeseries for multiple instruments you need to do it sequentially, one instrument at a time.

icon clock
10 |1500

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

Click below to post an Idea Post Idea