get_data for all RIC based on an option roots
Hello! Last week you helped me build out the open interest for a range of options for a particular root. But i actually need to go back a step further. (and achieve the same output). so the first try was great, and was as follows:
r, e = ek.get_data(instruments=['0#MCUZ8+'], fields=['X_RIC_NAME'])
instruments = r['Instrument'].tolist()
instruments.pop(0)
r, e = ek.get_data(instruments=instruments, fields=['TR.OPENINTEREST(SDate=0,EDate=-7,Frq=D).date;TR.OPENINTEREST(SDate=0,EDate=-7,Frq=D)','DSPLY_NAME','EXPIR_DATE','CONTR_MNTH','STRIKE_PRC','TR.IMPLIEDVOLATILITY'])
r.dropna()
All good. But the problem is that the option root i really need to examine is 0#MCU+
So as you can see on the screen shot below - the option root calls ALL of the open options - not just the month "Z" as i called in the code above. However, when I plug in the root - i just get blanks.
Is there a way of running teh script for the root and getting the same output - open interest, expir_date, strike_PRC ect ect ??
Best Answer
-
Try something along the lines of:
Get underlying instruments from 0#MCU+ chain
request = tr.get_data(instruments=['0#MCU+'], fields=['X_RIC_NAME'])[0]
Get all underlying instruments in a list of pandas data frames:
dfs = [tr.get_data(instruments=[x], fields=['X_RIC_NAME','DSPLY_NAME'])[0] for x in request['Instrument'].tolist()]
Parse out the list of options (every RIC longer than 6 chars):
all_instruments = [x for df in dfs for x in df['Instrument'].tolist() if len(x) > 6]
Please note that for simplicity I am not checking the error object, so such code can not be used in production.
1
Answers
-
excellent. So i can see the full options list now - with basic display data (i understand code to the line dfs=) - but the last line..hmm not so sure - so can I now parse each RIC and extract the open interest ? 'TR.OPENINTEREST'
0 -
thanks. I got it working now. appreciate your help
0 -
yep, you can now create a separate request with all those RICs for the TR.OPENINTEREST field
0
Categories
- All Categories
- 6 AHS
- 37 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 中文论坛