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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
29 2 1 5

How can I get OTR/ OfTR/ OfTR x3 information for a historical date

Hi,

I would like to get the static flag: OTR or OfTR or OfTRx3 etc. given a CUSIP & Date (historical). 912828ZP8 - This is a example cusip which would probably give me back OTR if I put in the date: 1st June, 2020. But probably OfTR x2 if I put in the date: 1st Aug, 2020 (or something like that).

Is there a python api like:

 ek.get_data(
    list(isin_list.values),
    'TR.DV01Analytics',
    parameters={'SDate': dt, 'EDate': dt}
)[0]

to get this information?

Thanks

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonstatic-data
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvote
Accepted
39.2k 75 11 27

To the best of my knowledge there's nothing in the data model that would directly provide this indicator. But you could retrieve the history of ISINs corresponding to OTR and then write a function that looks up an ISIN in the OTR history table and returns its relative position to OTR on the input date.

This code retrieves the table of ISINs corresponding to OTR for the last year and the dates ISIN became OTR.

otr_df, err = ek.get_data('0#USBMK=','DSPLY_NAME')
otr_list = otr_df['Instrument'].tolist()
otr_hist_df, err = ek.get_data(otr_list,['TR.BH.ISIN','TR.BH.EffDate'],
                              {'SDate':'0D', 'EDate':'-1Y'})

The function below returns the indicator you're looking for given ISIN, date and OTR history table

def otr_ref(isin, ref_date, otr_hist_df):
    isin_row_df = otr_hist_df.loc[otr_hist_df[
        'Government Benchmark Bond ISIN']==isin]
    if len(isin_row_df.index) == 0:
        return 'Error: ISIN not found in the OTR history table'
    match_row = isin_row_df.index[0]
    otr_ric = otr_hist_df.loc[match_row,'Instrument']
    otr_ric_df = otr_hist_df.loc[
        otr_hist_df['Instrument']==otr_ric]
    #the table retrieved from Eikon is already sorted by OTR effective date
    #but just to make absolutely sure, we can sort it here
    otr_ric_df = otr_ric_df.sort_values('Benchmark Effective Date', 
                                        ascending=False)
    otr_at_refdate_row = otr_ric_df.loc[
        otr_ric_df['Benchmark Effective Date']<=ref_date].index[0]
    x = (otr_ric_df.index.get_loc(match_row) - 
         otr_ric_df.index.get_loc(otr_at_refdate_row))
    if x == 0:
        return 'OTR'
    elif x > 0:
        return f'OffTRx{x}'
    else:
        return (f'Error: date {ref_date} is earlier than ' + 
                f'the date {isin} became OTR ' +
                f'({otr_ric_df.loc[match_row,"Benchmark Effective Date"]})')

For ISIN 'US912828ZP81' it indeed returns 'OTR' on 2020-06-01 and 'OffTRx2' on 2020-08-01.

In:

print(otr_ref('US912828ZP81', '2020-06-01', otr_hist_df))
print(otr_ref('US912828ZP81', '2020-08-01', otr_hist_df))

Out:

OTR
OffTRx2
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Thanks a lot!!

Click below to post an Idea Post Idea