How to get the historical dirty price of bond in bulk

As I known, I can get one bond historical dirty price via the following way.

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

response = bond.Definition(
instrument_code=code,
fields=['DirtyPrice'],
pricing_parameters=bond.PricingParameters(
market_data_date=startDate)).get_data()
print(response.data.df)


Is there any way to get dirty prices on many bonds all at once through the Eikon API?

Best Answer

  • Jirapongse
    Answer ✓

    @anchu

    Thank you for reaching out to us.

    Please try the following code.

    from refinitiv.data.content.ipa.financial_contracts import Definitions
    from refinitiv.data.content.ipa.financial_contracts import bond

    bond_1 = bond.Definition(instrument_code="US10YT=RR")
    bond_2 = bond.Definition(instrument_code="US5YT=RR")
    parameters = bond.PricingParameters(market_data_date="2023-06-01")
    def_var = Definitions(universe=[bond_1,bond_2],fields=["RIC","DirtyPrice"],pricing_parameters=parameters)
    def_var.get_data().data.df

    The output is:

    1687840943276.png


Answers

  • @Jirapongse Thanks for your answer, it's helpful. One more question, can I get the dirty price of many bonds over a period of time at once? for example, date from 2023-06-01 to 2023-06-30

  • @anchu

    You can try the get_history method.

    history = rd.get_history(universe=['US10YT=RR', 'US5YT=RR'], 
                             fields=["DIRTY_PRC"],
                             interval='daily', 
                             start="2023-05-01", 
                             end="2023-06-30")
    history

    1688112879076.png