question

Upvotes
Accepted
1 0 0 1

How do I get historical data on a option chain

Hi,

I have the below code


```

import refinitiv.data as rd

from refinitiv.data.discovery import Chain

import pandas as pd

import os



commodity_chain = "0#/NG+"


ric_chain = Chain(name = commodity_chain)

ric_list = ric_chain.constituents

print(ric_list)


target_chain = "0#/NGF24+"


options_contract = Chain(target_chain).constituents


clean_contracts = [s[1:] for s in options_contract]



df1 = rd.get_data(universe= clean_contracts,

fields= ["TR.SETTLEMENTPRICE","TR.IMPLIEDVOLATILITY"],

parameters={"SDate":"2023-10-25"})





df1 = rd.get_history(universe= clean_contracts,

fields= ["TR.SETTLEMENTPRICE","TR.IMPLIEDVOLATILITY"],

interval='1d',

start="2023-10-25",

end="2023-10-31")


rd.close_session()

```


However I am getting the below error when I run the code, I am not sure why.



RDError: Error code -1 | Insufficient scope for key=/data/datagrid/beta1/, method=POST failed.

Required scope: {'trapi.data.get.data.read'}

Missing scopes: {'trapi.data.get.data.read'}

#productapicodebook
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 @Jack.Davis1, may I ask: In which line, exactly, are you getting the error?

Hi @Jack.Davis1 ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

@Jack.Davis1

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
5.8k 21 2 6

Hi @Jack.Davis1,

`RDError: Error code -1 | Insufficient scope` errors stem from insuficient permissions.

Please reach out to your Account Manager, or on my.refinitiv.com, to ask for the nessesary permissions.

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.

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.