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
Best Answer
-
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
OffTRx21
Answers
-
Thanks a lot!!
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛