For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Dear Developers community,
I want to retrieve historical transaction data of coupon payments (amount + date) of a Fixed-rate Corporate Bonds.
So far, I manage to gather coupon data of the amount and frequency with "'TR.ADF_COUPON', and 'TR.FiCouponFrequency'. But these fields are the current (latest, not historical) ones, with no specific date of payment.
I am looking to create a a data frame with a panel structure of j bonds and t months.
Here's a quick example using RDP Library to access IPA Financial Contracts service on RDP
bond_ric = "34540TVB5=" start_date = "2020-01-01" end_date = "2022-01-01" df = pd.DataFrame(columns=['Coupon Date','Coupon Value']) while start_date<end_date: calc_params = rdp.ipa.bond.CalculationParams(valuation_date=start_date) tmp_df = rdp.get_bond_analytics(bond_ric, ["NextCouponDate","NextCouponValue"], calc_params) start_date=tmp_df.iloc[0,0] df = df.append({'Coupon Date':start_date, 'Coupon Value':tmp_df.iloc[0,1]}, ignore_index=True) df
Thank you @AlexPutkov, your code worked just fine! I am getting closer to what I need.
But sometimes, I get the error:
File "<ipython-input-165-ddf031214609>", line 10, in <module>
start_date=tmp_df.iloc[0,0]
AttributeError: 'NoneType' object has no attribute 'iloc'
I managed to do a request for a list of bonds constituents in the following way:
for i in consitutents.index: bond_isin = iboxx_isin['ISIN'][i] start_date = iboxx_isin['Issue Date'][i] end_date = "2021-01-01" while start_date<end_date: calc_params = rdp.ipa.bond.CalculationParams(valuation_date=start_date) tmp_df = rdp.get_bond_analytics(bond_isin,["NextCouponDate","NextCouponValue"], calc_params) start_date=tmp_df.iloc[0,0] df_coupon = df_coupon.append({"ISIN":bond_isin,'Coupon Date':start_date, 'Coupon Value':tmp_df.iloc[0,1]}, ignore_index=True) concate= pd.concat([df_coupon], ignore_index=True)
Here, a snapshot of the constituents list:
But I got the following errors:
File "/Users/mc/opt/anaconda3/lib/python3.8/site-packages/refinitiv/dataplatform/content/ipa/contracts/_financial_contracts.py", line 37, in _get_instrument_analytics
result = self.session._loop.run_until_complete(
event_list = self._selector.select(timeout)
kev_list = self._selector.control(None, max_ev, timeout)
Maybe I need to chunk the request in smaller sizes?
I haven't been able to reproduce the issue on my end using a sample of ISINs you provided.
"AttributeError: 'NoneType' object has no attribute 'iloc'" indicates that rdp.get_bond_analytics function returned None instead of a dataframe. Have you tried isolating the issue? Does it happen randomly or does it always happen with the same ISIN(s)?
When the exception is raised, try calling rdp.get_last_status() to see the status of the last request. Using Fiddler to capture HTTP requests and see if the request corresponding to rdp.get_bond_analytics function that returned None fails would be very helpful too.