question

Upvotes
Accepted
37 3 3 10

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 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Upvote
38.1k 71 35 53

@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 5.0 MiB each and 10.0 MiB total.

Upvotes
37 3 3 10

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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea