This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

datastream

(To be removed) Thomson Reuters Datastream DataWorks API connection

The datastream object will be removed in a future release. Use the datastreamws object instead. For details, see Compatibility Considerations.

Description

The datastream function creates a datastream object. The datastream object represents a Thomson Reuters® Datastream® DataWorks® API connection.

After you create a datastream object, you can use the object functions to retrieve historical data for different securities, and retrieve fields for a specific date or date range.

Creation

Syntax

c = datastream(username,password,source)
c = datastream(username,password,source,url)

Description

example

c = datastream(username,password,source) creates a connection to the Thomson Reuters Datastream DataWorks API using a user name, password, and data source.

example

c = datastream(username,password,source,url) connects using a Thomson Reuters URL.

Input Arguments

expand all

Thomson Reuters user name, specified as a character vector or string scalar. To find your user name, contact Thomson Reuters.

Note

The character vector or string scalar must start with DS: followed by the user name.

Example: 'DS:USER1'

Data Types: char | string

Thomson Reuters password, specified as a character vector or string scalar. To find your password, contact Thomson Reuters.

Example: 'XXXXXXX'

Data Types: char | string

Data source, specified as the value 'Datastream' or "Datastream".

Thomson Reuters URL, specified as a character vector or string scalar. For details, contact Thomson Reuters.

Example: 'http://dataworks.thomson.com/Dataworks/Enterprise/1.0'

Data Types: char | string

Properties

expand all

Thomson Reuters user name, specified as a character vector.

The datastream function sets this property using the username input argument.

Example: 'DS:USER1'

Data Types: char

Thomson Reuters password, specified as a character vector. To find your password, contact Thomson Reuters.

The datastream function sets this property using the password input argument.

Example: 'XXXXXXX'

Data Types: char

Data source, specified as the value 'Datastream'.

The datastream function sets this property using the source input argument.

API endpoint URL, specified as a character vector.

The datastream function sets this property using the url input argument.

Example: 'http://dataworks.thomson.com/dataworks/enterprise/1.0/webserviceclient.asmx'

Data Types: char

API endpoint WSDL, specified as a character vector. This property describes the endpoint for the messages associated with the Datastream DataWorks service.

Example: 'http://dataworks.thomson.com/dataworks/enterprise/1.0/webserviceclient.asmx?WSDL'

Data Types: char

Object Functions

fetch(To be removed) Request data from Thomson Reuters Datastream data servers
get(To be removed) Retrieve properties of Thomson Reuters Datastream connection objects
isconnection(To be removed) Determine if connections to Thomson Reuters Datastream data servers are valid
close(To be removed) Close connections to Thomson Reuters Datastream data servers

Examples

collapse all

Create a Thomson Reuters Datastream connection. Then, retrieve closing and lowest prices for a security. The data you see when completing this example can differ from the output data shown.

Connect to Thomson Reuters Datastream using a user name, password, and data source. c is the Thomson Reuters Datastream connection object.

username = 'DS:USER1';
password = 'XXXXXXX';
source = 'Datastream';
c = datastream(username,password,source)
c = 

  datastream with properties:

          user: 'DS:USER1''
      password: 'XXXXXXX'
    datasource: 'Datastream'
      endpoint: 'http://dataworks.thomson.com/dataworks/enterprise/1.0/webserviceclient.asmx'
          wsdl: 'http://dataworks.thomson.com/dataworks/enterprise/1.0/webserviceclient.asmx?WSDL'

Using the IBM® security, retrieve closing and lowest prices for yesterday. Each price value is returned as a field in the structure d.

sec = 'U:IBM';
prices = {'P','PL'};
yesterday = floor(now)-1;

d = fetch(c,sec,prices,yesterday);

Convert closing and lowest prices from character vectors to doubles, and display them using the str2num function.

closing = str2num(d.P);
lowest = str2num(d.PL);

[closing lowest]
ans =

        166.73        166.06

Close the Thomson Reuters Datastream connection.

close(c)

Create a Thomson Reuters Datastream connection. Then, retrieve the closing prices for a security. The data you see when completing this example can differ from the output data shown.

Connect to Thomson Reuters Datastream using a user name, password, data source, and URL. c is the Thomson Reuters Datastream connection object.

username = 'DS:USER1';
password = 'XXXXXXX';
source = 'Datastream';
url = 'http://dataworks.thomson.com/Dataworks/Enterprise/1.0';
c = datastream(username,password,source,url)
c = 

  datastream with properties:

          user: 'DS:USER1''
      password: 'XXXXXXX'
    datasource: 'Datastream'
      endpoint: 'http://dataworks.thomson.com/dataworks/enterprise/1.0/webserviceclient.asmx'
          wsdl: 'http://dataworks.thomson.com/dataworks/enterprise/1.0/webserviceclient.asmx?WSDL'

Retrieve the closing prices for the IBM security. The structure d contains each price value in the field P as a cell array.

sec = 'IBM';

d = fetch(c,sec)
d = 

  struct with fields:

           Source: 'Datastream'
       Instrument: 'IBM'
       StatusType: 'Connected'
       StatusCode: '0'
    StatusMessage: ''
              CCY: 'U$'
             DATE: {262×1 cell}
         DISPNAME: 'INTL.BUS.MCHS. (IRS)'
        FREQUENCY: 'D'
                P: {262×1 cell}
           SYMBOL: 'IBM'

Display the first three prices in the cell array.

d.P{1:3}
ans =

    '157.9'


ans =

    '160.28'


ans =

    '158.99'

Close the Thomson Reuters Datastream connection.

close(c)

Tips

If the datastream function returns a connection error, verify that your proxy settings are correct in MATLAB®. On the Home tab, in the Environment section, click Preferences and then click Web.

Compatibility Considerations

expand all

Not recommended starting in R2018b

Introduced in R2006a