datastreamws

Datastream Web Services 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 Datastream Web Services historical data

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.

Introduced in R2018b