Documentation

fetch

Request data from Reuters data servers

Syntax

Description

example

d = fetch(c,sec) returns the current data for the security sec, given the Reuters® session object c.

example

d = fetch(c,sec,[],fields) requests the given fields fields, for the security sec, given the Reuters session object c.

example

subs = fetch(c,sec,eventhandler) uses the Reuters session object c to subscribe to the security sec. MATLAB® runs the eventhandler function for each data event that occurs.

Examples

expand all

Retrieve Current Securities Data

Connect to Thomson Reuters™.

c = reuters('myNS::remotesession','dIDN_RDF');
Jan 13, 2014 2:23:09 PM com.reuters.rfa.internal.connection.md.MDConnectionImpl initializeEntitlements

INFO: com.reuters.rfa.connection.ssl.myNS.RemoteConnection
DACS disabled for connection myNS::RemoteConnection

The output message specifies a successful connection to the Reuters Market Data System.

Retrieve the current data for the Google® security using the Reuters session object c.

sec = 'GOOG.O';

d = fetch(c,sec)
d = 

     PROD_PERM: 74.00
    RDNDISPLAY: 66.00
    DSPLY_NAME: 'DELAYED-15GOOGLE'
    ...

d contains a large number of Thomson Reuters market data fields. This output shows the product permissions information, PROD_PERM, the display information for the IDN terminal device, RDNDISPLAY, and the expanded name for the instrument, DSPLY_NAME.

Close the Thomson Reuters connection.

close(c)

Request Specific Fields

Connect to Thomson Reuters.

c = reuters('myNS::remotesession','dIDN_RDF');
Jan 13, 2014 2:23:09 PM com.reuters.rfa.internal.connection.md.MDConnectionImpl initializeEntitlements

INFO: com.reuters.rfa.connection.ssl.myNS.RemoteConnection
DACS disabled for connection myNS::RemoteConnection

The output specifies a successful connection to the Reuters Market Data System.

Request the product permissions information 'PROD_PERM' for the Google security from Reuters.

sec = 'GOOG.O';
field = 'PROD_PERM';

d = fetch(c,sec,[],field)
d = 

    PROD_PERM: 74

Request the product permissions information 'PROD_PERM' and the display information for the IDN terminal device 'RDNDISPLAY' for the Google security from Reuters. Use a cell array to input these two fields to the function.

sec = 'GOOG.O';
fields = {'PROD_PERM','RDNDISPLAY'};

d = fetch(c,sec,[],fields)
d = 

     PROD_PERM: 74
    RDNDISPLAY: 66

Close the Thomson Reuters connection.

close(c)

Subscribe to a Security

To subscribe to a security and process the data in real time, specify an event handler function. MATLAB runs this function each time it receives a real-time data event from Reuters.

Connect to Thomson Reuters.

c = reuters('myNS::remotesession','dIDN_RDF');
Jan 13, 2014 2:23:09 PM com.reuters.rfa.internal.connection.md.MDConnectionImpl initializeEntitlements

INFO: com.reuters.rfa.connection.ssl.myNS.RemoteConnection
DACS disabled for connection myNS::RemoteConnection

The output specifies a successful connection to the Reuters Market Data System.

The event handler rtdemo function returns the real-time Reuters data for the Google security to the MATLAB workspace variable A. openvar displays A in the Variables editor.

sec = 'GOOG.O';
eventhandler = 'rtdemo';

subs = fetch(c,sec,eventhandler);
openvar('A')

In this instance, the fields represent a bid or ask tick.

The fetch function returns the subscription handle associated with this request in the variable subs. Display the subscription handle contents.

subs
subs =
 
com.reuters.rfa.internal.common.SubHandleImpl[]:
    [com.reuters.rfa.internal.common.SubHandleImpl]

Stop the real-time subscription.

stop(c,subs)

Close the Thomson Reuters connection.

close(c)

Input Arguments

expand all

c — Reuters sessionobject

Reuters session, specified as a Reuters session object created using reuters.

sec — Security liststring | cell array

Security list, specified as a string or a cell array of strings to denote Reuters securities.

Data Types: char | cell

fields — Reuters fields liststring | cell array

Reuters fields list, specified as a string or cell array of strings to denote Reuters field names.

Data Types: char | cell

eventhandler — Reuters real-time event handlerfunction

Reuters real-time event handler, specified as a MATLAB function that runs for each data event that occurs. The sample event handler called rtdemo.m returns Reuters real-time data from the Reuters Market Data System to the MATLAB workspace. The sample event handler specifies these input arguments.

Event Handler Input Argument

Description

x

Return data structure

itemName

Reuters data name

serviceName

Reuters service name

The sample event handler writes variable A to the Workspace browser with the contents of x.

Data Types: function_handle

Output Arguments

expand all

d — Reuters request datastructure

Reuters request data, returned as a structure. The structure contains many Reuters data fields. For details, see Reuters Data Support.

subs — Reuters subscription handleobject

Reuters subscription handle, returned as a Reuters subscription object.

See Also

| |

Was this topic helpful?