Main Content

datastreamws

Datastream Web Services from Refinitiv connection

Description

The datastreamws function creates a datastreamws object, which represents a Datastream™ Web Services connection. You must obtain Datastream Web Services credentials. For credentials, contact Datastream Web Services. After you create a datastreamws object, you can retrieve historical data.

Creation

Description

example

c = datastreamws(username,password) creates a Datastream Web Services connection using a user name and password.

Input Arguments

expand all

User name, specified as a character vector or string scalar. For your user name, contact Datastream Web Services.

Example: 'ABCDEF'

Data Types: char | string

Password, specified as a character vector or string scalar. For your password, contact Datastream Web Services.

Example: 'abcdef12345'

Data Types: char | string

Properties

expand all

This property is read-only.

User name, specified as a character vector. For your user name, contact Datastream Web Services.

The username input argument sets the Username property.

Example: 'ABCDEF'

Data Types: char | string

Timeout, specified as a numeric scalar that indicates the number of seconds to wait for data to return before canceling the request.

Example: 50

Data Types: double

Object Functions

historyRetrieve historical data from Datastream Web Services from Refinitiv

Examples

collapse all

Use a Datastream Web Services connection to retrieve historical data for the specified security.

Create a Datastream Web Services connection using your user name and password.

username = 'ABCDEF';
password = 'abcdef12345';
c = datastreamws(username,password)
c = 

  datastreamws with properties:

    Username: 'ABCDEF'
     TimeOut: 100

c is the datastreamws connection object with the Username and TimeOut properties. The Username property contains the specified user name. The TimeOut property specifies waiting for a maximum of 100 seconds to return historical data before canceling the request.

Adjust the display format to display currency.

format bank

Retrieve historical end-of-day price data for the last year. Specify the VOD security. d is a timetable that contains the date in the first variable and the end-of-day price in the second variable.

sec = 'VOD';
d = history(c,sec);

Display the first few prices.

head(d)
ans =

  8×1 timetable

            Time             VOD  
    ____________________    ______

    03-May-2017 00:00:00    202.95
    04-May-2017 00:00:00    203.70
    05-May-2017 00:00:00    204.95
    08-May-2017 00:00:00    205.15
    09-May-2017 00:00:00    205.15
    10-May-2017 00:00:00    206.60
    11-May-2017 00:00:00    206.25
    12-May-2017 00:00:00    211.05

Use the end-of-day prices to make investment decisions for the VOD security.

Version History

Introduced in R2018b