question

Upvotes
Accepted
58 5 4 8

Datastream API Datatypes

Hi,

I'm trying to pull data via the python Datastream api as a replacement for the excel plugin. In excel, there is an option to specify datatype and different datatypes change the time series output entirely. I was wondering how I might do that via the python api?

An example for time series TOTMKCN on 2020 Q2 and Q3 data is in the attached photos.

Datatype DWNP:

Datatype DWSE:


Thanks,

pythondatastream-apidsws-api
capture2.png (1.2 KiB)
capture3.png (1.6 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.

1 Answer

· Write an Answer
Upvote
Accepted
39.4k 78 11 27

Assuming you're using DatastreamDSWS library, you can utilize the same mnemonics and datatypes you use in =DSGRID worksheet function in Excel, e.g.

ds.get_data ('TOTMKCN',['DWNP', 'DWSE'], start='-1Y', freq='Q')

Does this answer your question?

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 Alex. Helpful as always!
Just wanted to add the parameter names here as well in case anyone else is wondering.

ds = DSWS.Datastream(username=DSWS_login, password=DSWS_pswd)
df = ds.get_data(tickers="TOTMKCN", fields=['DWNP', 'DWSE'], start=start_date.strftime("%Y-%m-%d"), freq='M')

where start_date is a datetime object.


Thanks again!

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.