question

Upvotes
Accepted
21 1 3 2

How to specify Hint and Return Properties in DSWS Python API?

The REST API documentation is not clear about 3 Hint Properties and 3 Return Properties which are available from the REST Service Test Page(see below).

What is the syntax for specifying Hint and Return properties when using the DSWS Python API? Can you provide a working example please?



datastream
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.

Attaching image

Hello @vijay.shah ,

Thank you for your participation in the forum.

Is one of the replies below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

-AHS

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

Thanks,


AHS


Upvotes
Accepted
22k 58 14 21

Hi @vijay.shah,

These are described in the SOAP API tutorials - https://developers.refinitiv.com/en/api-catalog/eikon/datastream-web-service/Tutorials#dsws-soap-tutorial.

I will ask product team to include this in the REST API documentation as well.

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.

Thanks @Gurpreet.

The REST documentation page

Reference for DSService.svc - Data (datastream.com) (http://product.datastream.com/DswsClient/Docs/restapihelp/Data.html)

does mention the URL syntax for GET call as below.

https://product.datastream.com/dswsclient/V1/DSService.svc/rest/Data?token={TOKEN}&instrument={INSTRUMENT}&datatypes={DATATYPES}&datekind={DATEKIND}&start={START}&end={END}&freq={FREQ}&;props={PROPS}&format={FORMAT}

Is there any translation for props and format when using DSWS Python library? I can see in the DSResponse.py file / post_user_request( ) function there is some parsing for Properties object when we include a pipe (|) symbol in tickers field. Trying to understand what are valid syntax and sample for that case.

@vijay.shah

I checked the source code and found that it supports the following hints.

hints = {
                    "E":"IsExpression", "L":"IsList", "R":"ReturnName"} 

Use following samples to specify the hint flags -

Get data for a list:

ds.get_data(tickers="LS&PCOMP|L",fields =["NAME"], kind=0)

Get data for an expression:

ds.get_data(tickers='PCH#(VOD(P),3M)|E', start="20181101",end="-1M", freq="M")

The |R flag is not used, since get data call can be passed the return name argument:

get_data(self, tickers, fields=None, start='', end='', freq='', kind=1, retName=False)
Upvotes
22k 58 14 21

@vijay.shah What hints are you referring to? Can you please post a link to REST service test page.

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 1 3 2

Hi @Gurpreet


This is the link I was referring to earlier -https://product.datastream.com/DswsClient/Docs/TestRestV1.aspx. Specifically the GetData function has Hint & Return properties for Instrument and Properties for the Fields provide further control.

Side question - I tried to attach screenshot images to my post to provide example. The images appear when editing the post but get dropped after it is submitted? Is there any workaround for this?

hints_props.png


hints-props.png (9.3 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.

@vijay.shah

There's a problem with image attaching in the forum currently, the workaround is to upload it as a file, please see the attached screenshot for an example attach.png

sorry for the inconvenient

attach.png (10.2 KiB)

Thanks, I was able to make an edit and attach screenshot.

Upvotes
22k 58 14 21

Raised the question with product team; will update when I get an answer.

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.