Datastream and Python: a wrapper for DSWS

Published on October 2nd, 2020

If you like to use Python to retrieve data from the Datastream Web Services API (DSWS), you can use the package PyDSWS. It is a simple Python wrapper I’ve built. You do need to have a Datastream subscription and a username/password to use this package. Please note that this is an unofficial/unsupported package and it is still under development. The package has basic functionality and most of the error handling still needs to be done. The source code can be found on GitHub.


First, install the Python package. Installation:

pip install PyDSWS

PyDSWS is written in Python 3. It has the following dependencies:

  • pandas
  • requests

Retrieve Datastream data with Python

An example how to retrieve closing prices for Vodafone.

  1. import the ‘PyDSWS’ package
  2. authenticate with your username and password
  3. use the ‘get_data’ function
import PyDSWS 

ds = PyDSWS.Datastream(username='XXXXXXX', password='XXXXXXX') 

df = ds.get_data('VOD') 


Please find below examples on how to set parameters for the requests.

Firstly, for static data:

ds.get_data(tickers='VOD', fields='P', date='2017-01-01')

Secondly, for time series:

ds.get_data(tickers='VOD', fields='P,MV,VO', start='-10D', end='-0D', freq='D')

*for multiple tickers/fields, just use a comma. In this example: fields=’P,MV,VO’

Finally, the output is a Pandas DataFrame:

Instrument     VOD
Field            P        MV       VO
2017-11-21  229.75  61283.06  55100.4
2017-11-22  228.75  61016.34  79602.5
2017-11-23  225.40  60122.75  35724.1
2017-11-24  225.50  60149.44  42918.0
2017-11-27  224.60  59909.38  50355.3
2017-11-28  226.45  60402.83  49027.0
2017-11-29  225.25  60082.74  61618.1
2017-11-30  224.30  59829.99  95423.4
2017-12-01  224.00  59749.96  54855.4
2017-12-04  225.55  60163.41  47524.1
2017-12-05  225.25  60083.38  43846.7

In addition, in order to get usage statistics call:


Likewise, the output is a Pandas DataFrame:

Instrument    STATS                                                           
Field          User Hits Requests Datatypes Datapoints  Start Date    End Date
2019-06-26  ZMTXXXX  564      362      1319    1283696  2019-06-01  2019-07-01

Please check for further documentation. Furthermore, you can use the Datastream Navigator to look up codes and data types:


If you discover any issues with regards to this project, please feel free to create an Issue on GitHub. If you have coding suggestions that you would like to provide for review, please create a Pull Request.


The packages used other packages as example. Most importantly, thanks to Vladimir Filimonov for his work on, and Charles Cara for

Conclusion: Datastream❤️ Python

To conclude: the Datastream WebServices API and Python can work together nicely. Are you also using the Eikon API? If not, you might want to take a look at Eikon Data API & Python – A Quickstart.

 Finally, you have any questions regarding the PyDSWS package, please feel free to reach out.  Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.