question

Upvotes
Accepted
1 0 0 2

getting option chain for given stock datastream mnemonic using pydatastream API

Hi,


I am using the pydatastream package to query some data. I have a list of datastream mnemonics for stocks, such as @AAPL. How can I get the mnemonic of the chain of options that trades on AAPL? In this specific case I can find it through the DFO navigator, where for example the chain for live AAPL calls is LOPTAAQ$LC, but I am looking for a way to do this programmatically for many stocks.

pythondatastream-apidatastream
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

Upvotes
Accepted
52.7k 135 44 63

@abdiat

You can contact the Refinitiv Datastream Web Service support team directly via MyRefinitiv to verify if there is a data type (field) that can provide this options list code. If the data type is available, you can retrieve it via the get_data method.

However, I found the Datastream Options User Companion guide that explains the format of the options list code.

1660793831667.png

Moroever, you can use the search functionality in the API to search for this code.

For example:

df1 = ds.get_data(tickers="Apple Live", fields=["DS.SYMBOLLOOKUP(Count=50)"],  kind=0)

The output is:

1660794213127.png

Then, look for the Instruments that start with LOPT. However, this method may not work for all cases.

The best method to contact the Refinitiv Datastream Web Service support team to verify if there is a way to retrieve the Opions List via the API.



1660793831667.png (52.8 KiB)
1660794213127.png (24.5 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.