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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

Pull federal Canadian bonds that are active as of a specific date using Python API

I am trying to pull the list of federal Canadian bonds that are active as of a specific date using Python API. I can do this in Eikon by using GOVSRCH and filtering by asset status effective date however, I am not able to add the duration and yield to maturity based on that historical date. I was wondering if there is an option that will allow me to do this using Python API instead?

#contentpython 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
1.3k 4 2 7

Hi @MarkJayson.Lima , thank you for getting back to me. To pull the historical RICs you can use either the GOVSRCH or the code I have provided above (by adding filter criteria you used in GOVSRCH(eg AssetStatusEffDate)). In terms of the values for yield and duration you will get the latest values as an output.

And if you want the historical time series, you can use rd.get_history function.

Here is the code to get historical data with RD Libraries:

rd.get_history(universe=['CA135087VH4=', 'CA135087UT9='], start = '2010-01-01', end='2010-01-10',
               fields=['B_YLD_1','A_YLD_1','ISMA_A_YLD','ISMA_B_YLD','MOD_DURTN'])

Through this code I was able to get ISMA yields and Duration for the specified bonds:

screenshot-2023-02-06-at-115256.png

Hope this was helpful.


Best regards,

Haykaz


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.3k 4 2 7

HI @MarkJayson.Lima ,


thank you for your question. You can use search capabilities of RD Library for Python. Here you can find examples of using Search functionality.


I have tried to build your query here with as much information I had

rd.discovery.search(
    view = rd.discovery.Views.GOV_CORP_INSTRUMENTS,
    top = 10000,
    filter = "RCSAssetCategoryLeaf eq 'bond' and IsActive eq true and IssuerCountry eq 'CA' and DbType eq 'GOVT'",
    select = "RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,DBSTicker,CouponRate,MaturityDate,IssueDate,ISIN,RCSCurrencyLeaf,RCSCountryLeaf,DbTypeDescription,InstrumentTypeDescription,FaceIssuedUSD,RCSGovtBondTypeLeaf"
)

screenshot-2023-02-02-at-161610.png

If you let me know some more details on the type of data you would want to get and the type of filters, I will be happy to help to build the query.


Hope this helped, let me know should you have any further questions.


Best regards,

Haykaz


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

Hi @haykaz.aramyan,


Thanks for the response. I am actually hoping to pull the historical federal bonds of Canada that were active on the particular historical date and also allow me to view data like yield and duration at that particular date for those bonds (ex. 10/01/2010).

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

Thanks for the help @haykaz.aramyan

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.