Main Content

history

Tick History from Refinitiv historical data

Description

example

d = history(c,sec,fields,startdate,enddate) returns historical data using:

  • Tick History from Refinitiv™ connection object

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

  • Refinitiv historical fields

  • Start date for the beginning of the historical date range

  • End date for the end of the historical date range

Examples

collapse all

Use a Tick History connection to retrieve historical data for a security.

Create a 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 historical data for the IBM® security. Using the history function, retrieve the open and closing prices for the prior day.

sec = ["IBM.N","Ric"];
fields = ["Open";"Last"];
startdate = datetime('yesterday');
enddate = datetime('today');

d = history(c,sec,fields,startdate,enddate)
d =

  1×2 timetable

       Time        Open      Last 
    __________    ______    ______

    2017/11/02    154.25    153.35

d is a timetable that contains these variables:

  • Date for the prior day

  • Open price

  • Closing price

Use a Tick History connection to retrieve historical data for two securities.

Create a Tick History from Refinitiv 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 historical data for the IBM and Ford Motor Company® securities. Using the history function, retrieve the open and closing prices for the days in the date range from October 30, 2017, through November 3, 2017.

sec = ["IBM.N","Ric";"F.N","Ric"];
fields = ["Open";"Last"];
startdate = datetime('10/30/2017','InputFormat','MM/dd/yyyy');
enddate = datetime('11/03/2017','InputFormat','MM/dd/yyyy');

d = history(c,sec,fields,startdate,enddate)
d =

  10×2 timetable

       Time        Open      Last 
    __________    ______    ______

    2017/10/30    153.76    154.36
    2017/10/31    154.26    154.06
    2017/11/01    153.97    154.03
    2017/11/02    154.25    153.35
    2017/11/03    153.36    151.58
    2017/10/30     12.00     12.10
    2017/10/31     12.14     12.27
    2017/11/01     12.40     12.35
    2017/11/02     12.33     12.42
    2017/11/03     12.40     12.36

d is a timetable that contains these variables:

  • Date in the date range

  • Open price

  • Closing price

The first five rows contain data for the IBM security. The next five rows contain data for the Ford Motor Company security.

Input Arguments

collapse all

Tick History from Refinitiv 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 Refinitiv historical fields to retrieve historical data. You can search for fields in MyRefinitiv.

Example: ["Low";"Last";"Volume"]

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

Output Arguments

collapse all

Historical data from Tick History, returned as a timetable. Except for the Time variable, each variable in the timetable corresponds to a specified field in the fields input argument.

Version History

Introduced in R2018a