question

Upvotes
Accepted
37 6 10 13

Use equivalent to DSGRID in Python DSWS

Hi all,


I have to call the equivalent of the following EXCEL function (that I got from a Refinitiv customer service rep) in Python:

=@DSGRID("LFRUSS3L0610"," ","Latest Value","","","RowHeader=true;ColHeader=true;DispSeriesDescription=true;DispDatatypeDescription=true","")

It should return the constituents of the Russel3000 in June 2010.


Could you please help me out with building the correct query with PyDSWS for this?

So far I tried (using my credentials for UID and PASS)

ds = PyDSWS.Datastream('UID', 'PASS')

ds.get_data('LFRUSS3L0610', date=dt.date.today())


but I get just an NA


eikonpythondsws-api
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
Accepted
76.9k 240 52 72

@Tulkkas

You can test the request with the Datastream Test Rest Service website.

First, use the Get Token service method to get a token. Then, use the Data (HTTP GET) to retrieve the data.

1637811266243.png

You should see the following output.

1637811328083.png

You may enable debug logging in Python with the following code to verify the request and response messages.

import logging
import http.client 
http.client.HTTPConnection.debuglevel = 1 
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True



1637811266243.png (45.7 KiB)
1637811328083.png (21.1 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.

Upvote
76.9k 240 52 72

@Tulkkas

I ran the code and it returns the data.

1637750518848.png

The following is an output from Excel.

1637750581518.png


They look the same.


1637750518848.png (12.3 KiB)
1637750581518.png (9.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.

Upvotes
37 6 10 13

Thank you @Jirapongse for the quick reply. I do not get data for this particular query, but I generally get data when I run other examples with PyDSWS (e.g. I ran the query here and it worked: https://community.developers.refinitiv.com/questions/87203/how-do-i-convert-a-dsgriddatastream-query-into-one.html)


I have been trying to get those historical constituents for quite some time now and have tried several soltuions with none of them working for me (but they always work for the Refinitiv rep, either in Excel and/or Python) - I get an NA but the Refinitiv rep running the same code would get a result.


What do you think could be the reason for that?

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.