question

Upvotes
Accepted
1 0 1 2

How to get list of active government bonds for specific country?

I tried to get a list of government bonds for a given country using Eikon and Python.

For example, in the case of Denmark, Eikon returns the following list of bonds.

1688388553556.png

But I get a longer list when I use Python code.

1688388666866.png

Bonds with IDs 0,4,5,6,9 from the Python list do not appear in the previous list...

Why is this difference between lists?

python#contentbonds
1688388553556.png (96.2 KiB)
1688388666866.png (81.5 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.

Hi @student0111 ,

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

@student0111

Hi,

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

Thanks,

AHS

Upvotes
Accepted
4.8k 13 2 7

Hi @student0111 ,


Thank you for your question. Are you using the same filtering criteria in the Eikon app as the ones used in API call? If not the same then the results can be different.


Additionally, I would advise using the GOVSRCH app from Workspace, where you can specify your filters and then export python query for API search. That would guarantee the same results:

screenshot-2023-07-04-at-103013.png

screenshot-2023-07-04-at-103029.png

Hope this helps.

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.

Hi h.aramyan01,

thank you for your help. This is actually very useful.

Best regards


Upvotes
78.6k 248 52 74

@student0111

To get the same list as Eikon, you need to use this query.

df = rd.discovery.search(
    view=rd.discovery.Views.FIXED_INCOME_QUOTES,
    select="BusinessEntity, DocumentTitle, RIC, IssuerCountryName,AssetStatus,PriceSource", 
    filter="IssuerCountryName eq 'Denmark' and AssetStatus eq 'RPN' and PriceSource xeq 'REFINITIV'",
    top=10000
)
df

The output is:

1688453258425.png



1688453258425.png (57.5 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 2

Hi Jirapongse,

thank you for your help as well.

The first difference between your query and mine is that I used Views.FIXED_INCOME_INSTRUMENTS while you used Views.FIXED_INCOME_QUOTES, so please let me know if there is any documentation of various views categories because I could not find any of it.

Also, with get_history function it is possible to get historical data for following bond properties:

['YLDTOMAT', 'HIGH_1', 'OPEN_PRC', 'LOW_1', 'HIGH_YLD', 'LOW_YLD',

'MID_PRICE', 'A_YLD_1', 'ACCR_INT', 'ISMA_A_YLD', 'MID_YLD_1',

'CONVEXITY', 'MOD_DURTN', 'ASK_HIGH_1', 'ASK_LOW_1', 'OPEN_ASK',

'OPEN_YLD', 'ISMA_B_YLD', 'AST_SWPSPD', 'BPV', 'BMK_SPD', 'B_YLD_1',

'SWAP_SPRDB', 'BID', 'ASK', 'OAS_BID', 'ZSPREAD', 'INT_BASIS',

'INT_CDS', 'TRTN_PRICE', 'OIS_SPREAD', 'TED_SPREAD', 'INT_GV_SPD',

'REDEM_DATE', 'ASP6M', 'ASP3M', 'ASP1M', 'DIRTY_PRC', 'CLEAN_PRC']

Do you know maybe if there is any documentation for those properties?

Additionally, I tried to implement your filters within GOVSRCH but I could not find RPN value for Asset status. I'm actually not shure what RPN means in sense of asset status?

Sorry if my questions are basic, but I'm quite new in this area.

Once again, thank you for your help.

Best regards

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.

Upvote
78.6k 248 52 74

@student0111

You can run the help(search.Views) Python command to get the list of available views. Then, you can call search.metadata.Definition method to get the list of available fields in each view. For example:

response = search.metadata.Definition(
    view = search.Views.GOV_CORP_INSTRUMENTS
).get_data() 


response.data.df

I checked the daily historical fields of DK10YT=RR and the historical-pricing endpoint can provide the following fields.

  "headers": [
      {
        "name": "DATE",
        "type": "string"
      },
      {
        "name": "B_YLD_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ASP6M",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "HIGH_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "OPEN_PRC",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "LOW_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "HIGH_YLD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "LOW_YLD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "A_YLD_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "BID",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "MID_PRICE",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "MID_YLD_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "CONVEXITY",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "MOD_DURTN",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ASK_HIGH_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ASK_LOW_1",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "OPEN_ASK",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "OPEN_YLD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "AST_SWPSPD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "BPV",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "BMK_SPD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ISMA_A_YLD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ISMA_B_YLD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "SWAP_SPRDB",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ASK",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ASP3M",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "OAS_BID",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ZSPREAD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "INT_BASIS",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "INT_CDS",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "TRTN_PRICE",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "OIS_SPREAD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "TED_SPREAD",
        "type": "number",
        "decimalChar": "."
      },
      {
        "name": "ASP1M",
        "type": "number",
        "decimalChar": "."
      }
    ]

You can find more information regarding the /discovery/search/v1/ and /data/historical-pricing/v1/ endpoints from the Reference page in the API Document.

Regarding RPN, it should mean Re-Opening. It can use AssetStateName or AssetState instead.

 {
      "RIC": "DK10YT=RR",
      "AssetStateName": "Active",
      "AssetStatus": "RPN",
      "AssetState": "AC"
    }
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.