timeseries

Thomson Reuters Tick History intraday data

Description

example

d = timeseries(c,sec,fields,startdate,enddate) returns intraday data using:

  • Thomson Reuters® Tick History connection object

  • Thomson Reuters securities (for example, Reuters® Instrument Codes, or RICs)

  • Thomson Reuters intraday fields

  • Start date for the beginning of the intraday date range

  • End date for the end of the intraday date range

example

d = timeseries(c,sec,fields,startdate,enddate,interval) uses an aggregation value for the intraday data.

Examples

collapse all

Use a Thomson Reuters Tick History connection to retrieve intraday data for one security.

Create a Thomson Reuters Tick History connection by using a user name and password. The appearance of the connection object c in the MATLAB® workspace indicates a successful connection.

username = 'username';
password = 'password';
c = trth(username,password);

Retrieve intraday data for the IBM® security. Using the timeseries function, retrieve the exchange time, price, and volume from November 6, 2017 through November 7, 2017.

sec = ["IBM.N","Ric"];
fields = ["Trade - Exchange Time";"Trade - Price";"Trade - Volume"];
startdate = datetime('11/06/2017','InputFormat','MM/dd/yyyy');
enddate = datetime('11/07/2017','InputFormat','MM/dd/yyyy');

d = timeseries(c,sec,fields,startdate,enddate);

Display the first three rows of intraday data.

head(d,3)
ans =

  3×7 timetable

            Time             x_RIC         Domain        GMTOffset     Type       Price      Volume          ExchTime      
    ____________________    _______    ______________    _________    _______    ________    ______    ____________________

    06-Nov-2017 05:31:02    'IBM.N'    'Market Price'      '-5'       'Trade'    ''            NaN     '05:31:02.949873100'
    06-Nov-2017 14:30:10    'IBM.N'    'Market Price'      '-5'       'Trade'    '151.68'    69819     '14:30:10.077000000'
    06-Nov-2017 14:30:10    'IBM.N'    'Market Price'      '-5'       'Trade'    '151.66'        2     '14:30:10.094000000'

d is a timetable that contains these variables:

  • Transaction date and time

  • RIC

  • Domain

  • GMT time zone offset

  • Transaction type

  • Price

  • Volume

  • Exchange time

Use a Thomson Reuters Tick History connection to retrieve intraday data for two securities, aggregated into 1-hour intervals.

Create a Thomson Reuters Tick History connection by using a user name and password. The appearance of the connection object c in the MATLAB workspace indicates a successful connection.

username = 'username';
password = 'password';
c = trth(username,password);

Retrieve intraday data for the IBM and Ford Motor Company® securities. Using the timeseries function, retrieve the open, high, low, and last prices from November 6, 2017 through November 7, 2017. Aggregate the intraday data into 1-hour intervals.

sec = ["IBM.N","Ric";"F.N","Ric"];
fields = ["Open";"High";"Low";"Last"];
startdate = datetime('11/06/2017','InputFormat','MM/dd/yyyy');
enddate = datetime('11/07/2017','InputFormat','MM/dd/yyyy');
interval = 'OneHour';

d = timeseries(c,sec,fields,startdate,enddate,interval);

d is a timetable that contains 66 rows of aggregated intraday data. The first 33 rows contain data for the Ford Motor Company security. The last 33 rows contain data for the IBM security.

Display three rows of Ford Motor Company aggregated intraday data.

d(15:17,:)
ans =

  3×8 timetable

            Time            x_RIC        Domain        GMTOffset          Type          Open     High      Low     Last 
    ____________________    _____    ______________    _________    ________________    _____    _____    _____    _____

    06-Nov-2017 14:00:00    'F.N'    'Market Price'      '-5'       'Intraday 1Hour'    12.34    12.43    12.31    12.38
    06-Nov-2017 15:00:00    'F.N'    'Market Price'      '-5'       'Intraday 1Hour'    12.38    12.38    12.32    12.32
    06-Nov-2017 16:00:00    'F.N'    'Market Price'      '-5'       'Intraday 1Hour'    12.32    12.34    12.30    12.30
 

Display three rows of IBM aggregated intraday data.

d(48:50,:)
ans =

  3×8 timetable

            Time             x_RIC         Domain        GMTOffset          Type           Open      High      Low       Last 
    ____________________    _______    ______________    _________    ________________    ______    ______    ______    ______

    06-Nov-2017 14:00:00    'IBM.N'    'Market Price'      '-5'       'Intraday 1Hour'    151.68    151.81    151.01    151.12
    06-Nov-2017 15:00:00    'IBM.N'    'Market Price'      '-5'       'Intraday 1Hour'    151.13    151.36    150.53    150.78
    06-Nov-2017 16:00:00    'IBM.N'    'Market Price'      '-5'       'Intraday 1Hour'    150.78    150.89    150.47    150.63

d is a timetable that contains these variables:

  • Transaction date and time

  • RIC

  • Domain

  • GMT time zone offset

  • Aggregation type

  • Open price

  • High price

  • Low price

  • Last price

Input Arguments

collapse all

Thomson Reuters Tick History connection, specified as a connection object created with trth.

Security, specified as an N-by-2 string array or cell array of character vectors. The first column of the string array or cell array identifies the security. The second column identifies the type of security (for example, Reuters Instrument Code, or RIC).

Example: ["IBM.N","Ric"]

Data Types: string | cell

Fields, specified as a string array or cell array of character vectors. Specify Thomson Reuters intraday fields to retrieve intraday data. You can search for fields in the Thomson Reuters Customer Zone.

Example: ["Trade - Exchange Time";"Trade - Price"]

Data Types: string | cell

Start date of the date range, specified as a datetime array, string scalar, character vector, or numeric scalar.

Example: datetime('yesterday')

Data Types: double | char | string | datetime

End date of the date range, specified as a datetime array, string scalar, character vector, or numeric scalar.

Example: datetime('today')

Data Types: double | char | string | datetime

Aggregation interval, specified as one of these values:

  • 'OneSecond'

  • 'FiveSeconds'

  • 'OneMinute'

  • 'FiveMinutes'

  • 'TenMinutes'

  • 'FifteenMinutes'

  • 'OneHour'

Specify these values as character vectors or string scalars.

Output Arguments

collapse all

Intraday data, returned as a timetable with these variables:

  • Transaction date and time

  • RIC

  • Domain

  • GMT time zone offset

  • Transaction type

Other variables in d include the specified fields in the fields input argument.

Introduced in R2018a