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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
0 0 0 2

How to get historical bond data?

Dear RDev Community,

I am looking to get historical data for bonds as "Credit Ratings", "OAS", "Prices" going back ten years, or so. Ideally on a monthly basis, at the end-of-month.

df_iboxx, err = ek.get_date(instuments=isin_iboxx, fields = ['TR.ISIN', 'TR.FIMoodysRating', 'TR.FIFitchsRating', 'TR.OptionAdjustedSpread', 'TR.FiPrice', 'TR.BIDPRICE', 'TR.ASKPRICE','TR.FiPrice'], parameters={SDate':'2019-12-01',Frq':'M',EDate':'2020-12-01'})

So far, with this code I managed to get only the historical Ask-Bid prices for each month. But the other variables appear only on the latest date (eg. 2020-12-01). Is it possible to get the historical values of the other criteria?

Since it is a large request, I need to split manually the code year by year. Do you have any function to do the data request and append automatically?

Thank you so much,


eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonpricing
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.

1 Answer

Upvotes
Accepted
39.2k 75 11 27

CodeCreator app in Eikon is very helpful for exploring the metadata (field names and parameters) for use with Eikon Data APIs. Field description as well as Parameters tab would show you that TR.FIMoodysRating and TR.FIFitchsRating fields only provide current rating. To retrieve history of issue ratings you can use field TR.GR.Rating. To specify the source of the rating use BondRatingSrc parameter, e.g. for Moody's Long-term Issue Credit Rating use TR.GR.Rating(BondRatingSrc=MDY). E.g.

ek.get_data('US345370BR09',
            ['TR.GR.Rating(BondRatingSrc=MDY).date',
             'TR.GR.Rating(BondRatingSrc=MDY)'],
            {'SDate':'-2Y', 'EDate':'0'})

or

ek.get_data('US345370BR09',['TR.GR.Rating.date',
                            'TR.GR.Rating',
                            'TR.GR.Rating.RatingSourceDescription'],
            {'SDate':'-2Y', 'EDate':'0', 'BondRatingSrc':'MDY:FTC'})

Rating updates are an irregular event. Timeseries retrieved for TR.GR.Rating will not have a defined frequency. If you need to construct monthly timeseries from this data you need to do it in code. Eikon does not provide such capability. You can blend ratings with prices in the same request, which will get you close to what you're looking for, but you'd still need fill the gaps in ratings columns.


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