Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

fetch

Request data from Thomson Reuters Datastream data servers

Syntax

data = fetch(Connect, 'Security')
data = fetch(Connect, 'Security', 'Fields')
data = fetch(Connect, 'Security', 'Fields', 'Date')
data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate')
data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period')
data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period', 'Currency')
data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period', 'Currency', 'ReqFlag')

Arguments

Connect

Thomson Reuters™ Datastream® connection object created with the datastream function.

'Security'

MATLAB® character vector or string containing the name of a security, or cell array of character vectors or string array containing names of multiple securities. This data is in a format recognizable by the Thomson Reuters Datastream data server.

'Fields'

(Optional) MATLAB character vector, string, cell array of character vectors, or string array indicating the data fields for which to retrieve data.

'Date'

(Optional) MATLAB character vector or string indicating a specific calendar date for which you request data.

'FromDate'

(Optional) Start date for historical data.

'ToDate'

(Optional) End date for historical data. If you specify a value for 'ToDate', 'FromDate' cannot be an empty value.

Note

You can specify dates in any of the formats supported by datestr and datenum that show a year, month, and day.

'Period'

(Optional) Period within a date range. Period values are:

  • 'd': daily values

  • 'w': weekly values

  • 'm': monthly values

'Currency'

(Optional) Currency in which fetch returns the data.

'ReqFlag'

(Optional) Specifies how the fetch request is processed by Datastream. The default value is 0.

Note

You can enter the optional arguments 'Fields', 'FromDate', 'ToDate', 'Period', and 'Currency' as MATLAB character vectors, strings, or empty arrays ([ ]).

Description

data = fetch(Connect, 'Security') returns the default time series for the indicated security.

data = fetch(Connect, 'Security', 'Fields') returns data for the specified security and fields.

data = fetch(Connect, 'Security', 'Fields', 'Date') returns data for the specified security and fields on a particular date.

data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate')
returns data for the specified security and fields for the indicated date range.

data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period')
returns instrument data for the given range with the indicated period.

data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period', 'Currency')
also specifies the currency in which to report the data.

data = fetch(Connect, 'Security', 'Fields', 'FromDate',
'ToDate', 'Period', 'Currency', 'ReqFlag')
also specifies a ReqFlag that determines how the request is processed by Datastream.

Note

The Thomson Reuters Datastream interface returns all data as character vectors. For example, it returns Price data to the MATLAB workspace as a cell array of character vectors within the structure. There is no way to determine the data type from the Datastream interface. For details about the Thomson Reuters Datastream returned data, see Reuters Data Support.

Examples

Retrieving Time-Series Data

Return the trailing one-year price time series for the instrument ICI, with the default value P for the 'Fields' argument using the command:

data = fetch(Connect, 'ICI')

Or the command:

data = fetch(Connect, 'ICI', 'P')

Retrieving Opening and Closing Prices

Return the closing and opening prices for the instruments ICI on the date September 1, 2007.

data = fetch(Connect, 'ICI', {'P', 'PO'}, '09/01/2007')

Retrieving Monthly Opening and Closing Prices for a Specified Date Range

Return the monthly closing and opening prices for the securities ICI and IBM from 09/01/2005 to 09/01/2007:

data = fetch(Connect, {'ICI', 'IBM'}, {'P', 'PO'}, ...
'09/01/2005', '09/01/2007', 'M')

Retrieving Static Data

Return the static fields NAME and ISIN:

data = fetch(Connect,{'IBM~REP'}, {'NAME','ISIN'});

You can also return SECD in this way.

Retrieving Russell 1000 Constituent List

Return the Russell 1000 Constituent List:

russell = fetch(Connect, {'LFRUSS1L~LIST~#UserName'});

where UserName is the user name for the Thomson Reuters Datastream connection.

Introduced in R2006a

Was this topic helpful?