I executed this code with the Desktop session, not on Codebook, but on a local Jupyter Notebook.
response = ld.content.pricing.Definition(
['EUR=', 'GBP=', 'JPY=', 'CAD='],
fields=['BID', 'ASK']
).get_data()
display(response.data.df)
result was like bellow
access denied. Scopes required to access the resource: [trapi.data.pricing.read]. Missing scopes: [trapi.data.pricing.read]. Contact LSEG to check your permissions.
On the other hand the code(Open a stream in snapshot mode) bellow was fine on Codebook.
# Define our Streaming Price object
non_streaming = ld.content.pricing.Definition(
['EUR=', 'GBP=', 'JPY=', 'CAD='],
fields=['BID', 'ASK']
).get_stream()
# We want to just snap the current prices, don't need updates
# Open the instrument in non-streaming mode
non_streaming.open(with_updates=False)
# Snapshot the prices at the time of the open() call
non_streaming.get_snapshot()
by setting with_updates=False, it would get not the stream but the snapshot data without using RDP Snapshot API with no license problem,
But the result of the above code on a local Jupyter Notebook was error like bellow;
ConnectionError Traceback (most recent call last)
Cell In[6], line 9
2 non_streaming = ld.content.pricing.Definition(
3 ['EUR=', 'GBP=', 'JPY=', 'CAD='],
4 fields=['BID', 'ASK']
5 ).get_stream()
7 # We want to just snap the current prices, don't need updates
8 # Open the instrument in non-streaming mode
----> 9 non_streaming.open(with_updates=False)
10 # Snapshot the prices at the time of the open() call
11 non_streaming.get_snapshot()
File xxxlib\site-packages\lseg\data\content\pricing\_stream_facade.py:115, in Stream.open(self, with_updates)
89 def open(self, with_updates: bool = True) -> "OpenState":
90 """
91 Opens the streaming connection to the Pricing data, and sends corresponding requests for all requested
92 instruments.
(...)
113 >>> stream.open()
114 """
--> 115 return super().open(with_updates=with_updates)
File xxxlib\site-packages\lseg\data\delivery\_stream\_basestream.py:71, in StreamOpenWithUpdatesMixin.open(self, with_updates)
69 def open(self, with_updates: bool = True) -> OpenState:
...
state : StreamCxnState.Disposed
subprotocol : tr_json2
is_auto_reconnect: True
can_reconnect : False
num_attempt : 0
As a result, both of them failed to run on the local Jupyter Notebook code. However, the second one (non-stream code) was successful on Codebook.
I have confirmed with the account manager that our license has sufficient privileges to run both the stream and snapshot code above, since my Workspace ID has the scope for "trapi.data.pricing.read".
I asked a similar question to Workspace's help and support, but the issue still remains unresolved.