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'

Best Answer

  • ed.jeffery
    Answer ✓

    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
    )

Answers

  • 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

  • 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

  • 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,


    Is this what you're after? I tried it after reading documentation:

    definitions = [
    rdf.bond.Definition(
    instrument_code=i,
    pricing_parameters=rdf.bond._bond_pricing_parameters.PricingParameters(
    market_data_date="2000-01-01T00:00:00Z"))
    for i in ['AU9YT=RR', '225401BB3=2M', '61772BAC7=1M',
    'GR15YT=RR', 'AT7YT=RR',
    '225401AY4=2M', '55608JBF4=2M',
    '06406RBR7=2M', 'XS007437161=2M','FR001400I3N=2M']]

    response = rdf.Definitions(
    universe=definitions,
    fields=[
    'Isin',
    'RIC',
    'Cusip',
    'Sedol',
    'Ticker',
    'CashFlowDatesArray',
    'CashFlowInterestPercentsArray',
    'CashFlowCapitalAmountsInDealCcyArray',
    'CashFlowAnnualRatesPercentArray',
    'CashFlowTotalPercentsArray']).get_data()

    response.data.df


    1709031665291.png



  • Sorry if I wasn't clear. I am wondering why using the following parameter doesn't work?

    compute_cash_flow_from_issue_date=True

    i.e. setting a market data date of 2000-01-01 seems a hack to get it to work. I would expect setting the above parameter would return me cashflows from the issue date, but instead it returns nothing.

  • I also have about 800 active bonds that I can't get data for via the RD package and the API doesn't provide any information on why they are missing. How can I send a list of the bonds so that Refinitiv can investigate?
  • Hi @ed.jeffery,

    Would you have a RIC example of an instument issued on 2000-01-01?
    I'm asking becasue it looks like "21688AAQ5=BCLQ" was issued in 2021:

    1709052090917.png

  • 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
  • 21688AAQ5=BCLQ has already expired which you can check:

    try:
    response = bond.Definition(
    instrument_code="21688AAQ5=BCLQ",
    fields=[],
    pricing_parameters = bond.PricingParameters(
    compute_cash_flow_from_issue_date = True )
    ).get_data()
    print(response.data.raw)

    except rd.errors.RDError as e:
    print("RDError code :", e.message)

    Therefore, you can set up a market date before the maturity to get all the cashflows

    response = bond.Definition(
    instrument_code="21688AAQ5=BCLQ",
    fields=[ 'Isin',
    'RIC',
    'Cusip',
    'Sedol',
    'Ticker',
    'CashFlowDatesArray',
    'CashFlowInterestPercentsArray',
    'CashFlowCapitalAmountsInDealCcyArray',
    'CashFlowAnnualRatesPercentArray',
    'CashFlowTotalPercentsArray'],
    pricing_parameters = bond.PricingParameters(
    compute_cash_flow_from_issue_date = True,
    market_data_date="2024-01-09" )
    ).get_data()
    response.data.raw