question

Upvotes
Accepted
21 0 0 2

Understanding why certain bonds return no data from RDP "get_bond_analytics" python function

I am using the RDP python package's `get_bond_analytics` function to get bond cashflow data like so:

```

import refinitiv.dataplatform as rdp

from refinitiv.dataplatform.content.ipa import bond


df = rdp.get_bond_analytics(

universe=[<List of RICS codes>],

fields=[

'Isin',

'RIC',

'Cusip',

'Sedol',

'Ticker',

'CashFlowDatesArray',

'CashFlowInterestPercentsArray',

'CashFlowCapitalAmountsInDealCcyArray',

'CashFlowAnnualRatesPercentArray',

'CashFlowTotalPercentsArray',

],

calculation_params=bond.CalculationParams(market_data_date="2000-01-01"),

)

```


However, I cannot get data for about 700 bonds in our universe. Please can you help me understand why there is no data?



Example RIC codes with missing data:


'AU9YT=RR'

'225401BB3=2M'

'61772BAC7=1M'

'GR15YT=RR'

'AT7YT=RR'

'225401AY4=2M'

'55608JBF4=2M'

'06406RBR7=2M'

'XS007437161=2M'

'FR001400I3N=2M'

python#contentrefinitiv-data-platformipa
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 @ed.jeffery ,

Please note that the answer below was marked as accepted.
Please let us know if that's incorrect.

@ed.jeffery

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS


Upvotes
Accepted
21 0 0 2

Hi @jonathan.legrand, thanks for your response. Is there a way of using the new RD library for getting data for multiple bonds at the same time? I have a large universe of ~20,000 bonds I want to get data for. It looks like it doesn't have a "get_bond_analytics" function anymore. I can see the `rd.get_data()` function, but unsure how to define the parameters. For example, something like the below:


rd.get_data(
    universe=['AU9YT=RR', '225401BB3=2M', ...],
    fields=['Isin', 'RIC', 'CashFlowDatesArray', ...],
    parameters={"MarketDataDate": "2000-01-01"},  # not sure about this part
)
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 @ed.jeffery ,


Is this it? I believe the limit is 100 per call; above that you will need a loop as shown here (search for `batch_of: int = 100` in the article).


import refinitiv.data as rd
from refinitiv.data.content.ipa.financial_contracts import bond
rd.open_session()
definitions = [
    bond.Definition(
        instrument_code=i)
    for i in ['AU9YT=RR', '225401BB3=2M', '61772BAC7=1M',
              'GR15YT=RR', 'AT7YT=RR',
              '225401AY4=2M', '55608JBF4=2M',
              '06406RBR7=2M', 'XS007437161=2M','FR001400I3N=2M']]
response = rd.content.ipa.financial_contracts.Definitions(
    universe=definitions,
    fields=[
        'Isin',
        'RIC',
        'Cusip',
        'Sedol',
        'Ticker',
        'CashFlowDatesArray',
        'CashFlowInterestPercentsArray',
        'CashFlowCapitalAmountsInDealCcyArray',
        'CashFlowAnnualRatesPercentArray',
        'CashFlowTotalPercentsArray']).get_data()
response.data.df

1708615117253.png

1708615117253.png (113.6 KiB)

Thanks @jonathan.legrand, I've got that working locally. My last bit of confusion is over the parameters. I want to get cashflows since the issue date for all bonds and had to use `bond.CalculationParams(market_data_date="2000-01-01")` in my initial example as proxy for this. I see with the new RD package that I can use `bond.PricingParameters(compute_cash_flow_from_issue_date=True)` but this sometimes doesn't return data for a bond (whereas using market_data_date does). Do you know why this might be happening?


See RIC code '21688AAQ5=BCLQ' as an example of this.

Hi @ed.jeffery

You can use the parameter compute_cash_flow_from_issue_day = True

response = bond.Definition(
    instrument_code="AU9YT=RR",
    fields=[ 
        'CashFlowDatesArray',
        'CashFlowInterestPercentsArray',
        'CashFlowCapitalAmountsInDealCcyArray',
        'CashFlowAnnualRatesPercentArray',
        'CashFlowTotalPercentsArray'],
    pricing_parameters = bond.PricingParameters(
        compute_cash_flow_from_issue_date = True )
    ).get_data()
response.data.raw
Show more comments
Upvotes
5.8k 21 2 6

Hi @ed.jeffery ,


I would advise upgrading to the new RD library for Python. Looking into it, I was able to collect data with it, e.g.:


import refinitiv.data as rd
from refinitiv.data.content.ipa.financial_contracts import bond
rd.open_session()
response = bond.Definition(
    instrument_code="AU9YT=RR",
    fields=[
        'Isin',
        'RIC',
        'Cusip',
        'Sedol',
        'Ticker',
        'CashFlowDatesArray',
        'CashFlowInterestPercentsArray',
        'CashFlowCapitalAmountsInDealCcyArray',
        'CashFlowAnnualRatesPercentArray',
        'CashFlowTotalPercentsArray']).get_data()
response.data.df


1708597221211.png


1708597221211.png (15.9 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.

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.