Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
21 0 1 3

Need to Get Historical Tick Level data Having Bid , ASK and LTP prices

Please let know a particular function through which we can get tick level historical data having ask , bid and ltp prices for any asset ....so far we have tried get_timeseries , get_data and get_history functions but not getting historical data for basic apple stock ( AAPL.O ) , Below I got error when I tried to find data for a NIFTY options strike NIF1W19350W3.NS of last week ...it says :

C:\Users\User\Desktop\Reuters\HistoricalData>color f0


C:\Users\User\Desktop\Reuters\HistoricalData>python Data.py

Traceback (most recent call last):

File "C:\Users\User\Desktop\Reuters\HistoricalData\Data.py", line 21, in <module>

df = rd.get_history(

File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\refinitiv\data\_access_layer\get_history_func.py", line 166, in get_history

raise RDError(-1, except_msg)

refinitiv.data._errors.RDError: Error code -1 | No data to return, please check errors: ERROR: No successful response.

(TS.Intraday.UserRequestError.90001, NIF1W19350W3)


C:\Users\User\Desktop\Reuters\HistoricalData>pause

Press any key to continue . . .

We need the data for NIFTY Options historical tick level having ask , bid and ltp prices ..kindly let know what we are doing wrong here . kindly let us know the exact function to get data with complete syntax.

eikon-data-api#product#content
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.

NIF19300V3.NS

NIF19550J3.NS

NIF19800J3.NS

NIF19800J3.NS


getting issues for all these contracts

Request I am trying is :

df = rd.get_history(

universe='NIF19550J3.NS=',

fields=['ASK', 'BID', 'TRDPRC_1'],

start='2023-10-30',

end='2023-11-02',

interval='tick')

df

Upvotes
Accepted
21 0 1 3

Hi All ,

Kindly let know if we have to change the RIC's for the Options Expired contracts to fetch their historical data ..I need for NIFTY options

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.

Hi @peeush,

This Developer Q&A Forum is for questions pertainig to LSEG's Tech Stack (mostly its APIs). For content questions such as this one, we ask that you please reach out to my.refinitiv.

I answered earlier, but it was a sub comment to one of your comments, so you may not have seen:

Yes, you have to change the RIC's for the Options Expired contracts to fetch their historical data; the RICs of options change when they expire and they are not available in Search (be in on the front end - in workspace - or via the Search API) (we say that they are not 'indexed'; I personally say that they are not 'technologically indexed' to diferentiate from an instrument taht may be added to a financial index). It is LSEG's aim to technologically index all expired options in the future.

You will have to reconstruct expired option RICs to find them , similarly to the aformentioned article 'Reconstructing RICs for expired futures contracts'. Reading this article, I saw that the rules to reconstruct 'options on equities' can be found in 'RULES7'.

Looking at the article Python Type Hint Finance Use Case: Implied Volatility and Greeks of Index 'At The Money' Options: Part 2 and its GitHub Repo, you can find `class OptionRIC`.

This Python class was created to do exactly what you are after, but only for `supported_exchanges: list[str] = ['OPQ', 'IEU', 'EUX', 'HKG', 'HFE', 'OSA']`

Which does not include your usecase. I would advise looking into it to add your exchange of interest.

Each expired RIC is different and depend on the Strike Price, Exchange, Maturity, ..., as per the RULES7.

Upvotes
5.3k 21 2 4

Hi @peeush,


I looked up some examples and made the following code:


import pandas as pd
import refinitiv.data as rd
rd.open_session()
df: pd.DataFrame = rd.get_history(
    universe = "VOD.L",
    fields = ['ASK'],
    interval='tick',
    start='2023-11-03T10:00:00Z',
    end='2023-11-04T18:00:00Z'
    # parameters = {'SDate': '2021-10-01'}, # , 'EDate': 1
    )
df

1699262975286.png


What company/instrument did you expect returned for RIC 'NIF19550J3.NS='? I'm asking because I can't find anything under that RIC (which would explain the error you got).

I would suggest using the Options Watch app in Workspace to find the Options you may be after. I tried it myself and got the following:

1699263790432.png


df: pd.DataFrame = rd.get_history(
    universe = "NIF2W19150W3.NS",
    fields = ['ASK', 'BID', 'TRDPRC_1'],
    interval='tick',
    start='2023-10-30T10:00:00Z',
    end='2023-11-01T18:00:00Z'
    # parameters = {'SDate': '2021-10-01'}, # , 'EDate': 1
    )
df




1699262975286.png (37.8 KiB)
1699263790432.png (309.7 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.

Upvotes
21 0 1 3

Hi ,

I just tried the request given by you and i am getting below error :


C:\Users\User\Desktop\Reuters\HistoricalData>color f0


C:\Users\User\Desktop\Reuters\HistoricalData>python Data.py

Traceback (most recent call last):

File "C:\Users\User\Desktop\Reuters\HistoricalData\Data.py", line 24, in <module>

df: pd.DataFrame = rd.get_history(

File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\refinitiv\data\_access_layer\get_history_func.py", line 166, in get_history

raise RDError(-1, except_msg)

refinitiv.data._errors.RDError: Error code -1 | No data to return, please check errors: ERROR: No successful response.

(TS.Intraday.UserRequestError.90001, VOD)


C:\Users\User\Desktop\Reuters\HistoricalData>pause

Press any key to continue .


-------------------------------------------------------------------


Used below request :

df: pd.DataFrame = rd.get_history(

universe = "VOD.L=",

fields = ['ASK'],

interval='tick',

start='2023-11-03T10:00:00Z',

end='2023-11-04T18:00:00Z'

# parameters = {'SDate': '2021-10-01'}, # , 'EDate': 1

)

df


Without Using "=" here ( universe = "VOD.L=", ) ..it is not giving any reponse

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.

Hi @peeush,

"VOD.L=" is not a valid RIC (Refinitiv Identifier Code). An incorrect RIC would result you are getting using the RD Library. If you are getting no data back for your request for "VOD.L", it may be due to your permissions; you may not have a license permitting for programatic retreival of historical tick data.

To investigate this issue, please reach out to my.refinitiv and open a ticket inquiring about the limit of your permissions.

Upvotes
21 0 1 3

MoreOver i'm trying to get historical data for expired contracts as that is what historical data is meant to be :

NIF19300V3.NS

NIF19550J3.NS

NIF19800J3.NS

NIF19800J3.NS

e.g. for these expired contracts i need the historical data ...if these are not in reuters since these are expired how'll i get their data

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.

Hi @peeush,

This Developer Q&A Forum is for questions pertainig to LSEG's Tech Stack (mostly its APIs). For content questions such as this one, we ask that you please reach out to my.refinitiv.


With that said, may I ask where these numonics come from? They do not aprear in Workspace:
1699264636804.png


Also: I had a quick look for such expired options questions and these article seem relevent, please do let me know if they are helpful or not:
Reconstructing RICs for expired futures contracts
Finding Expired Options and Backtesting a Short Iron Condor Strategy

Implied Volatility and Greeks of Index 'At The Money' Options: Part 1

1699264636804.png (39.9 KiB)
Upvotes
21 0 1 3

NIF19300V3.NS -> this we were using last week and it didn't had any mention of week in it since it was october last week .

NIF2W19450W3.NS -> this we are using current week and we are getting data .

are you saying that once contract expires for options and if we want to get the historical data for that contract ...then we have to re-contruct its RIC with new rules and re-request the historical data with new RIC as per the request :


df: pd.DataFrame = rd.get_history(

universe = "NIF2W19450W3.NS",

fields = ['ASK', 'BID', 'TRDPRC_1'],

interval='tick',

start='2023-10-30T10:00:00Z',

end='2023-11-01T18:00:00Z'

# parameters = {'SDate': '2021-10-01'}, # , 'EDate': 1

)

df

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.

I need historical data for options not futures

Hi @peeush,


Yes, it is as you said here, the RICs of options change when they expire and they are not available in Search (be in on the front end - in workspace - or via the Search API) (we say that they are not 'indexed'; I personally say that they are not 'technologically indexed' to diferentiate from an instrument taht may be added to a financial index). It is LSEG's aim to technologically index all expired options in the future.


You will have to reconstruct expired option RICs to find them , similarly to the aformentioned article 'Reconstructing RICs for expired futures contracts'. Reading this article, I saw that the rules to reconstruct 'options on equities' can be found in 'RULES7':

1699277965519.png

1699277965519.png (69.9 KiB)

Hi @peeush, Looking at the article "Python Type Hint Finance Use Case: Implied Volatility and Greeks of Index 'At The Money' Options: Part 2" and its GitHub Repo, you can find

class OptionRIC

This Python class was created to do exactly what you are after, but only for

supported_exchanges: list[str] = ['OPQ', 'IEU', 'EUX', 'HKG', 'HFE', 'OSA']

Which does not include your usecase. However, I would advise looking into it to add your exchange of interest (the exchange where the underlying index is traded).

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.