Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
11 1 1 6

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?

#productbondsprice-history
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
Accepted
80k 257 52 75

@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



1687840943276.png (38.1 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
11 1 1 6

@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

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
80k 257 52 75

@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


1688112879076.png (33.2 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.