How to translate adfin formula for previous coupon date in API?

How to translate adfin formula for previous coupon date in API?

=CpnPrev(TODAY(),TR($B3,"TR.ADF_MATDATE"),TR($B3,"TR.ADF_BONDSTRUCTURE"))

B3 is the Bond e.g. XS1970549561

Best Answer

  • Hi @Tim.Diego

    Try the following:

    import refinitiv.data as rd
    from refinitiv.data.content.ipa.financial_contracts import bond

    # Open a session
    rd.open_session()

    # Using the Fundamental and Reference service
    rd.get_data(['XS1970549561'], ['TR.ADF_MATDATE', 'TR.ADF_BONDSTRUCTURE'])

    ##############
    # Alternatively
    ##############

    # Using Instrument Pricing Analytics
    response = bond.Definition(
    instrument_code = 'XS1970549561',
    fields = [
    "InstrumentCode",
    "BondType",
    "Structure",
    "RateStructure"
    ]
    ).get_data()
    response.data.df

Answers

  • Hi @nick.zincone , thank you for this, it works however the output are the Bond Type, Structure and Rate Structure. The formula above displays the previous coupon date. Is it possible to add this function to the syntax above =CpnPrev(TODAY() ?

  • Hi @Tim.Diego

    Does it help?

    import refinitiv.data as rd
    from refinitiv.data.content.ipa.financial_contracts import bond
    rd.open_session()

    response = bond.Definition(
    instrument_code = 'XS1970549561',
    fields = [
    'PreviousCouponDate'
    ],
    pricing_parameters = bond.PricingParameters(
    valuation_date="2023-03-31",
    )
    ).get_data()
    response.data.df