how to retrieve the list of live option contracts for a given equity or equity index.
Hello,
I'm looking for a code sample, using Refinitiv Data Platform APIs, preferably in python, that would show how to retrieve the list of live option contracts for a given equity or equity index.
I have seen the great article on search (https://developers.refinitiv.com/en/article-catalog/article/building-search-into-your-application-workflow) but wondering if a code snippet illustrating the above question exists.
Many thanks.
Samuel
Best Answer
-
Hi @leszek.lubecki,
Yes, the more we look at the results, the more we will filter - search will always be iterative :-).
Good point about the date check - when applying the expiryDate filter, this resulted in ~100 fewer hits for the '.VIX' symbol. Regarding the inability of the UnderlyingQuoteRIC not being able to support the exact match capability, you can always apply a little trickery to force exact matching, i.e.
ric = "'.VIX'"rdp.search( view = rdp.SearchViews.EquityDerivativeQuotes, filter = "AssetState eq 'AC' and \ startswith(UnderlyingQuoteRIC, " + ric + ") and \ endswith(UnderlyingQuoteRIC," + ric + ") and \ RCSAssetClass eq 'OPT' and IsChain eq false and \ ExpiryDate ge " + dt.datetime.today().strftime('%Y-%m-%d'), select = "DocumentTitle, RIC, ExpiryDate, CallPutOption, StrikePrice", top = 10000)
It may not be as clean but should help avoid getting hits for things like 'AAPL.OQ'
0
Answers
-
I see that field UnderlyingNDAQuoteRICcontains information about underlying instrument but is not "searchable". Here is what I was able to get using PermID of an instrument
permid = rdp.convert_symbols(
symbols = ['IBM'],
to_symbol_types = [rdp.SymbolTypes.OAPermID] )
rdp.search(view = rdp.SearchViews.EquityDerivativeQuotes,
filter = "AssetState eq 'AC' and UnderlyingIssuerOAPermID eq '" + permid['IssuerOAPermID'][0] + "' and DerivedCategory eq 'OPTION'",
select = 'RIC',
top=10000
)0 -
Thanks a lot @marcin.bunkowski, Can you share the samples as may not have the right rdp lib instantiated.
cheers
Samuel
0 -
Hi @samuel.schwalm,
Try this:
rdp.search(
view = rdp.SearchViews.EquityDerivativeQuotes,
filter = "AssetState eq 'AC' and UnderlyingQuoteRIC eq 'IBM' and \
RCSAssetClass eq 'OPT' and IsChain eq false",
select = "DocumentTitle, RIC, ExpiryDate, CallPutOption, StrikePrice",
top = 10000
)I don't know what you were expecting back in terms of rows, but we could possibly narrow down the result set if you see some items in the list that shouldn't be there. For example, the last one in the screenshot below may be something that you want to ignore.
0 -
@nick.zincone.1 I think that your solution is more convenient. When I did try UnderlyingQuoteRIC as well but without an additional filter on RCSAssetClass you get plenty not relevant RIC codes. I did try on "VOD.L".
0 -
@nick.zincone.1 @samuel.schwalm
Hey,
Given how the search is structure I think using the expiry date for filtering might be a good way to go to exclude non-viable RICs (or drop anything from the dataframe that doesn't have one)
rdp.search(
view = rdp.SearchViews.EquityDerivativeQuotes,
filter = "AssetState eq 'AC' and UnderlyingQuoteRIC eq 'IBM' and \
RCSAssetClass eq 'OPT' and IsChain eq false and \
ExpiryDate ge " + date.today().strftime('%Y-%m-%d'),
select = "DocumentTitle, RIC, ExpiryDate, CallPutOption, StrikePrice",
top = 10000
)
On the "live" part; in my experience it's best to use the ExpiryDate to filter for live options, I've seen on occasion a delay between an option contract expiring and being removed from the real time feeds, and actually being tagged as inactive and being removed from search like here for the first couple here (expired yesterday, no longer retrievable but still in search):Something to be aware of re UnderlyingQuoteRIC as criterion. It uses an exact match to produce results. I.e. you need the specific listing that the options are listed for. Especially for US options this might prove a problem from a user perspective, as they may be looking at specific exchange listing like NYSE (IBM.N), or Nasdaq (AAPL.OQ) whereas the options themselves have the consolidated listings as underlyings (IBM, AAPL.O). So possibly the approach @marcin.bunkowski suggested might be valid.
0 -
Hi @leszek.lubecki,
Yes, the more we look at the results, the more we will filter - search will always be iterative :-).
Good point about the date check - when applying the expiryDate filter, this resulted in ~100 less hits for the .VIX symbol. Regarding the inability of the UnderlyingQuoteRIC not supporting an exact match, this may introduce extraneous hits. However, you can always apply a little trickery to force exact matching, i.e.
ric = "'.VIX'"
rdp.search(
view = rdp.SearchViews.EquityDerivativeQuotes,
filter = "AssetState eq 'AC' and \
startswith(UnderlyingQuoteRIC, " + ric + ") and \
endswith(UnderlyingQuoteRIC," + ric + ") and \
RCSAssetClass eq 'OPT' and IsChain eq false and \
ExpiryDate ge " + dt.datetime.today().strftime('%Y-%m-%d'),
select = "DocumentTitle, RIC, ExpiryDate, CallPutOption, StrikePrice",
top = 10000
)It may not be as clean, but should help avoid getting hits for things like 'AAPL.OQ'
0 -
Many thanks. work fine for me.
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 中文论坛