timeseries
Tick History from Refinitiv intraday data
Syntax
Description
returns intraday data using:d
= timeseries(c
,sec
,fields
,startdate
,enddate
)
Tick History from Refinitiv™ connection object
Refinitiv securities (for example, Reuters® Instrument Codes, or RICs)
Refinitiv intraday fields
Start date for the beginning of the intraday date range
End date for the end of the intraday date range
Examples
Retrieve Intraday Data for One Security
Use a Tick History connection to retrieve intraday data for one security.
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 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
Retrieve Aggregated Intraday Data for Two Securities
Use a Tick History connection to retrieve intraday data for two securities, aggregated into 1-hour intervals.
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 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
c
— Tick History from Refinitiv connection
connection object
Tick History from Refinitiv connection, specified as a connection object created with trth
.
sec
— Security
string array | cell array of character vectors
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
— Fields
string array | cell array of character vectors
Fields, specified as a string array or cell array of character vectors. Specify Refinitiv intraday fields to retrieve intraday data. You can search for fields in MyRefinitiv.
Example: ["Trade - Exchange Time";"Trade -
Price"]
Data Types: string
| cell
startdate
— Start date
datetime
array | string scalar | character vector | numeric scalar
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
enddate
— End date
datetime
array | string scalar | character vector | numeric scalar
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
interval
— Aggregation interval
'OneSecond'
| 'FiveSeconds'
| 'OneMinute'
| ...
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
d
— Intraday data
timetable
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.
Version History
Introduced in R2018a
See Also
External Websites
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)