New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
2 0 0 1

Equity Option Chains Using Codebook

Trying to pull the full list of option contracts for a security such as Apple using the following:

chain = rd.get_data(

universe = ['0#/AAPL*.U'])

chain.T

This pulls approx 13 RICs under 'Instrument' LongLink. Is it possible to pull them all using just one chain in the query?

I note that the method that was used with eikon doesn't appear to work with rd.get_data. How can i achieve the same results? Thanks.

df, err = ek.get_data('0#/IBM*.U', ['CF_NAME', 'OPINT_1'])

codebookchain-ric
icon clock
10 |1500

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

1 Answer

· Write an Answer
Upvotes
Accepted
11.1k 22 6 9

@evanclark33 Thanks for your question - so I would use the Chain object - which is designed to decode all sorts of chains - to achieve this:

import refinitiv.data as rd
from refinitiv.data.discovery import Chain
rd.open_session()
aapl = Chain(name="0#AAPL*.U")
print(len(aapl.constituents))

1774

aapl.contituents

1690886692194.png

So this is how I would do this to get all the options and then use them - or more likely - chunk them with downstream get_data or get_history functions to stay within per call data limits. I hope this can help.


1690886692194.png (29.2 KiB)
icon clock
10 |1500

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

@jason.ramchandani01. This is exactly what i needed. Thank you. Very much appreciated.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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