Financial Toolbox™ software provides three ways to create a financial time series object:
At the command line using the object constructor fints
From a text data file through the function ascii2fts
Use the Financial Time Series app, you can create
a financial time series (fints
) object from one
or more selected variables. For more information, see Creating a Financial Time Series Object.
The structure of the object minimally consists of a description field, a frequency
indicator field, the date vector field, and at least one data series
vector. The names for the fields are fixed for the first three fields: desc
, freq
,
and dates
. You can specify names of your choice
for any data series vectors. If you do not specify names, the object
uses the default names series1
, series2
, series3
,
and so on.
If time-of-day information is incorporated in the date vector,
the object contains an additional field named times
.
The object constructor function fints
has
five different syntaxes. These forms exist to
simplify object construction. The syntaxes vary according to the types
of input arguments presented to the constructor. The syntaxes are
Single Matrix Input
Separate Vector Input
See Data Name Input.
The date information provided with this syntax must be in serial date number format. The date number may or may not include time-of-day information.
Note
If you are unfamiliar with the concepts of date character vectors and serial date numbers, consult Handle and Convert Dates.
Time-of-Day Information Excluded
fts = fints(dates_and_data)
In this simplest form of syntax, the input must be at least a two-column matrix. The first column contains the dates in serial date format; the second column is the data series. The input matrix can have more than two columns, each additional column representing a different data series or set of observations.
If the input is a two-column matrix, the output object contains
four fields: desc
, freq
, dates
,
and series1
. The description field, desc
,
defaults to blanks ''
, and the frequency indicator
field, freq
, defaults to 0
.
The dates field, dates
, contains the serial dates
from the first column of the input matrix, while the data series field, series1
,
has the data from the second column of the input matrix.
The first example makes two financial time series objects. The
first one has only one data series, while the other has more than
one. A random vector provides the values for the data series. The
range of dates is arbitrarily chosen using the today
function:
date_series = (today:today+100)'; data_series = exp(randn(1, 101))'; dates_and_data = [date_series data_series]; fts1 = fints(dates_and_data)
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts1 = desc: (none) freq: Unknown (0) 'dates: (101)' 'series1: (101)' '03-Oct-2017' [ 0.97] '04-Oct-2017' [ 1.20] '05-Oct-2017' [ 0.21] '06-Oct-2017' [ 0.92] '07-Oct-2017' [ 4.97] '08-Oct-2017' [ 1.10] '09-Oct-2017' [ 1.04] '10-Oct-2017' [ 0.48] '11-Oct-2017' [ 0.97] '12-Oct-2017' [ 1.26] '13-Oct-2017' [ 1.53] '14-Oct-2017' [ 0.69] '15-Oct-2017' [ 0.79] '16-Oct-2017' [ 7.57] '17-Oct-2017' [ 0.10] '18-Oct-2017' [ 9.29] '19-Oct-2017' [ 1.40] '20-Oct-2017' [ 2.72] '21-Oct-2017' [ 0.19] '22-Oct-2017' [ 0.55] '23-Oct-2017' [ 0.76] '24-Oct-2017' [ 1.53] '25-Oct-2017' [ 0.19] '26-Oct-2017' [ 1.60] '27-Oct-2017' [ 0.30] '28-Oct-2017' [ 1.07] '29-Oct-2017' [ 1.92] '30-Oct-2017' [ 1.39] '31-Oct-2017' [ 2.95] '01-Nov-2017' [ 2.73] '02-Nov-2017' [ 0.52] '03-Nov-2017' [ 1.29] '04-Nov-2017' [ 0.39] '05-Nov-2017' [ 0.27] '06-Nov-2017' [ 2.52] '07-Nov-2017' [ 1.00] '08-Nov-2017' [ 0.95] '09-Nov-2017' [ 2.49] '10-Nov-2017' [ 1.81] '11-Nov-2017' [ 1.42] '12-Nov-2017' [ 3.49] '13-Nov-2017' [ 2.53] '14-Nov-2017' [ 1.27] '15-Nov-2017' [ 0.50] '16-Nov-2017' [ 0.52] '17-Nov-2017' [ 3.29] '18-Nov-2017' [ 0.20] '19-Nov-2017' [ 0.98] '20-Nov-2017' [ 0.14] '21-Nov-2017' [ 2.77] '22-Nov-2017' [ 2.37] '23-Nov-2017' [ 1.00] '24-Nov-2017' [ 0.93] '25-Nov-2017' [ 0.08] '26-Nov-2017' [ 1.79] '27-Nov-2017' [ 0.11] '28-Nov-2017' [ 0.10] '29-Nov-2017' [ 1.08] '30-Nov-2017' [ 0.39] '01-Dec-2017' [ 1.51] '02-Dec-2017' [ 1.97] '03-Dec-2017' [ 2.36] '04-Dec-2017' [ 0.50] '05-Dec-2017' [ 1.57] '06-Dec-2017' [ 1.11] '07-Dec-2017' [ 2.28] '08-Dec-2017' [ 1.71] '09-Dec-2017' [ 2.45] '10-Dec-2017' [ 0.88] '11-Dec-2017' [ 0.86] '12-Dec-2017' [ 2.74] '13-Dec-2017' [ 0.12] '14-Dec-2017' [ 0.60] '15-Dec-2017' [ 0.28] '16-Dec-2017' [ 0.68] '17-Dec-2017' [ 1.91] '18-Dec-2017' [ 2.28] '19-Dec-2017' [ 0.36] '20-Dec-2017' [ 0.62] '21-Dec-2017' [ 1.15] '22-Dec-2017' [ 0.75] '23-Dec-2017' [ 1.35] '24-Dec-2017' [ 1.49] '25-Dec-2017' [ 0.39] '26-Dec-2017' [ 0.84] '27-Dec-2017' [ 0.12] '28-Dec-2017' [ 3.14] '29-Dec-2017' [ 0.53] '30-Dec-2017' [ 0.30] '31-Dec-2017' [ 0.78] '01-Jan-2018' [ 0.24] '02-Jan-2018' [ 0.98] '03-Jan-2018' [ 0.57] '04-Jan-2018' [ 8.83] '05-Jan-2018' [ 3.12] '06-Jan-2018' [ 0.08] '07-Jan-2018' [ 1.55] '08-Jan-2018' [ 0.25] '09-Jan-2018' [ 0.77] '10-Jan-2018' [ 1.18] '11-Jan-2018' [ 2.11]
Examine the contents of the object fts1
. The actual date series you observe
will vary according to the day when you run the example (the value of
today
). Also, your values
in series1
will differ from those shown, depending upon
the sequence of random numbers generated:
fts1 = desc: (none) freq: Unknown (0) 'dates: (101)' 'series1: (101)' '12-Jul-1999' [ 0.3124] '13-Jul-1999' [ 3.2665] '14-Jul-1999' [ 0.9847] '15-Jul-1999' [ 1.7095] '16-Jul-1999' [ 0.4885] '17-Jul-1999' [ 0.5192] '18-Jul-1999' [ 1.3694] '19-Jul-1999' [ 1.1127] '20-Jul-1999' [ 6.3485] '21-Jul-1999' [ 0.7595] '22-Jul-1999' [ 9.1390] '23-Jul-1999' [ 4.5201] '24-Jul-1999' [ 0.1430] '25-Jul-1999' [ 0.1863] '26-Jul-1999' [ 0.5635] '27-Jul-1999' [ 0.8304] '28-Jul-1999' [ 1.0090]...
The output is truncated for brevity. There are actually 101 data points in the object.
The desc
field displays as (none)
instead
of ''
, and that the contents of the object display
as cell array elements. Although the object displays as such, it should
be thought of as a MATLAB® structure containing the default field
names for a single data series object: desc
, freq
, dates
,
and series1
.
Now create an object with more than one data series in it:
date_series = (today:today+100)'; data_series1 = exp(randn(1, 101))'; data_series2 = exp(randn(1, 101))'; dates_and_data = [date_series data_series1 data_series2]; fts2 = fints(dates_and_data)
Now look at the object created (again in abbreviated form):
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts2 = desc: (none) freq: Unknown (0) 'dates: (101)' 'series1: (101)' 'series2: (101)' '03-Oct-2017' [ 0.76] [ 4.56] '04-Oct-2017' [ 4.84] [ 0.97] '05-Oct-2017' [ 0.62] [ 5.13] '06-Oct-2017' [ 1.39] [ 0.65] '07-Oct-2017' [ 1.94] [ 1.80] '08-Oct-2017' [ 1.09] [ 0.94] '09-Oct-2017' [ 2.41] [ 0.13] '10-Oct-2017' [ 1.38] [ 0.37] '11-Oct-2017' [ 0.46] [ 1.85] '12-Oct-2017' [ 0.16] [ 0.95] '13-Oct-2017' [ 6.41] [ 0.33] '14-Oct-2017' [ 0.55] [ 0.53] '15-Oct-2017' [ 1.11] [ 1.28] '16-Oct-2017' [ 1.76] [ 0.37] '17-Oct-2017' [ 1.12] [ 2.65] '18-Oct-2017' [ 0.40] [ 0.53] '19-Oct-2017' [ 0.63] [ 6.10] '20-Oct-2017' [ 0.88] [ 0.34] '21-Oct-2017' [ 4.39] [ 1.22] '22-Oct-2017' [ 0.42] [ 0.22] '23-Oct-2017' [ 2.19] [ 0.48] '24-Oct-2017' [ 1.36] [ 0.55] '25-Oct-2017' [ 0.79] [ 1.49] '26-Oct-2017' [ 0.35] [ 2.57] '27-Oct-2017' [ 0.75] [ 1.35] '28-Oct-2017' [ 0.92] [ 0.69] '29-Oct-2017' [ 0.23] [ 2.26] '30-Oct-2017' [ 1.21] [ 2.22] '31-Oct-2017' [ 0.44] [ 1.13] '01-Nov-2017' [ 0.91] [ 1.77] '02-Nov-2017' [ 1.40] [ 1.51] '03-Nov-2017' [ 0.40] [ 0.37] '04-Nov-2017' [ 0.75] [ 2.14] '05-Nov-2017' [ 1.42] [ 0.52] '06-Nov-2017' [ 0.16] [ 0.55] '07-Nov-2017' [ 2.82] [ 1.19] '08-Nov-2017' [ 11.30] [ 0.74] '09-Nov-2017' [ 2.61] [ 0.88] '10-Nov-2017' [ 0.73] [ 1.81] '11-Nov-2017' [ 1.54] [ 2.85] '12-Nov-2017' [ 0.35] [ 0.82] '13-Nov-2017' [ 6.54] [ 1.39] '14-Nov-2017' [ 2.56] [ 0.79] '15-Nov-2017' [ 2.20] [ 1.26] '16-Nov-2017' [ 0.42] [ 1.55] '17-Nov-2017' [ 1.38] [ 0.54] '18-Nov-2017' [ 0.57] [ 1.32] '19-Nov-2017' [ 0.73] [ 1.82] '20-Nov-2017' [ 0.57] [ 1.10] '21-Nov-2017' [ 0.36] [ 5.64] '22-Nov-2017' [ 0.40] [ 0.54] '23-Nov-2017' [ 0.81] [ 0.48] '24-Nov-2017' [ 0.18] [ 0.17] '25-Nov-2017' [ 1.84] [ 2.49] '26-Nov-2017' [ 0.89] [ 2.38] '27-Nov-2017' [ 2.01] [ 0.92] '28-Nov-2017' [ 1.31] [ 2.46] '29-Nov-2017' [ 1.64] [ 1.20] '30-Nov-2017' [ 0.23] [ 1.34] '01-Dec-2017' [ 0.36] [ 1.12] '02-Dec-2017' [ 0.64] [ 1.55] '03-Dec-2017' [ 1.12] [ 1.11] '04-Dec-2017' [ 3.09] [ 16.24] '05-Dec-2017' [ 0.75] [ 0.31] '06-Dec-2017' [ 3.53] [ 0.16] '07-Dec-2017' [ 1.61] [ 0.32] '08-Dec-2017' [ 3.24] [ 0.34] '09-Dec-2017' [ 1.14] [ 0.65] '10-Dec-2017' [ 0.52] [ 0.84] '11-Dec-2017' [ 0.23] [ 0.80] '12-Dec-2017' [ 1.17] [ 1.72] '13-Dec-2017' [ 2.27] [ 1.48] '14-Dec-2017' [ 0.75] [ 2.12] '15-Dec-2017' [ 0.58] [ 5.92] '16-Dec-2017' [ 0.73] [ 3.40] '17-Dec-2017' [ 0.33] [ 0.28] '18-Dec-2017' [ 0.61] [ 0.10] '19-Dec-2017' [ 0.83] [ 2.46] '20-Dec-2017' [ 1.05] [ 0.16] '21-Dec-2017' [ 0.94] [ 1.07] '22-Dec-2017' [ 1.84] [ 1.04] '23-Dec-2017' [ 1.12] [ 9.27] '24-Dec-2017' [ 6.14] [ 0.93] '25-Dec-2017' [ 1.37] [ 0.60] '26-Dec-2017' [ 6.08] [ 1.27] '27-Dec-2017' [ 0.49] [ 1.28] '28-Dec-2017' [ 1.69] [ 1.07] '29-Dec-2017' [ 0.77] [ 0.54] '30-Dec-2017' [ 1.82] [ 0.29] '31-Dec-2017' [ 1.81] [ 1.37] '01-Jan-2018' [ 0.11] [ 0.26] '02-Jan-2018' [ 0.27] [ 0.36] '03-Jan-2018' [ 0.24] [ 3.79] '04-Jan-2018' [ 1.49] [ 0.66] '05-Jan-2018' [ 4.35] [ 0.87] '06-Jan-2018' [ 0.72] [ 2.46] '07-Jan-2018' [ 2.25] [ 0.74] '08-Jan-2018' [ 1.73] [ 2.80] '09-Jan-2018' [ 0.35] [ 0.71] '10-Jan-2018' [ 1.49] [ 2.75] '11-Jan-2018' [ 0.47] [ 1.88]
The second data series name defaults to series2
,
as expected.
Before you can perform any operations on the object, you must
set the frequency indicator field freq
to the valid
frequency of the data series contained in the object. You can leave
the description field desc
blank.
To set the frequency indicator field to a daily frequency, enter
fts2.freq = 1
, or
fts2.freq = 'daily'
.
For more information, see fints
.
Time-of-Day Information Included. The serial date number used with this form of the fints
function
can incorporate time-of-day information. When time-of-day information
is present, the output of the function contains a field times
that
indicates the time of day.
If you recode the previous example to include time-of-day information, you can see the additional column present in the output object:
time_series = (now:now+100)'; data_series = exp(randn(1, 101))'; times_and_data = [time_series data_series]; fts1 = fints(times_and_data)
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts1 = desc: (none) freq: Unknown (0) 'dates: (101)' 'times: (101)' 'series1: (101)' '03-Oct-2017' '16:17' [ 0.81] '04-Oct-2017' '16:17' [ 0.42] '05-Oct-2017' '16:17' [ 0.35] '06-Oct-2017' '16:17' [ 0.76] '07-Oct-2017' '16:17' [ 0.65] '08-Oct-2017' '16:17' [ 0.66] '09-Oct-2017' '16:17' [ 2.67] '10-Oct-2017' '16:17' [ 0.74] '11-Oct-2017' '16:17' [ 3.14] '12-Oct-2017' '16:17' [ 0.59] '13-Oct-2017' '16:17' [ 2.64] '14-Oct-2017' '16:17' [ 0.59] '15-Oct-2017' '16:17' [ 1.19] '16-Oct-2017' '16:17' [ 2.64] '17-Oct-2017' '16:17' [ 0.66] '18-Oct-2017' '16:17' [ 0.65] '19-Oct-2017' '16:17' [ 7.41] '20-Oct-2017' '16:17' [ 2.59] '21-Oct-2017' '16:17' [ 0.65] '22-Oct-2017' '16:17' [ 1.91] '23-Oct-2017' '16:17' [ 0.70] '24-Oct-2017' '16:17' [ 2.03] '25-Oct-2017' '16:17' [ 4.12] '26-Oct-2017' '16:17' [ 0.20] '27-Oct-2017' '16:17' [ 2.80] '28-Oct-2017' '16:17' [ 4.30] '29-Oct-2017' '16:17' [ 1.05] '30-Oct-2017' '16:17' [ 5.73] '31-Oct-2017' '16:17' [ 1.17] '01-Nov-2017' '16:17' [ 0.29] '02-Nov-2017' '16:17' [ 0.11] '03-Nov-2017' '16:17' [ 0.72] '04-Nov-2017' '16:17' [ 2.04] '05-Nov-2017' '16:17' [ 1.37] '06-Nov-2017' '16:17' [ 1.51] '07-Nov-2017' '16:17' [ 0.56] '08-Nov-2017' '16:17' [ 1.15] '09-Nov-2017' '16:17' [ 0.19] '10-Nov-2017' '16:17' [ 0.47] '11-Nov-2017' '16:17' [ 0.44] '12-Nov-2017' '16:17' [ 1.68] '13-Nov-2017' '16:17' [ 0.99] '14-Nov-2017' '16:17' [ 0.31] '15-Nov-2017' '16:17' [ 0.99] '16-Nov-2017' '16:17' [ 0.50] '17-Nov-2017' '16:17' [ 0.51] '18-Nov-2017' '16:17' [ 2.37] '19-Nov-2017' '16:17' [ 1.12] '20-Nov-2017' '16:17' [ 1.49] '21-Nov-2017' '16:17' [ 2.42] '22-Nov-2017' '16:17' [ 1.20] '23-Nov-2017' '16:17' [ 1.73] '24-Nov-2017' '16:17' [ 1.98] '25-Nov-2017' '16:17' [ 3.22] '26-Nov-2017' '16:17' [ 1.61] '27-Nov-2017' '16:17' [ 4.11] '28-Nov-2017' '16:17' [ 1.02] '29-Nov-2017' '16:17' [ 0.95] '30-Nov-2017' '16:17' [ 5.48] '01-Dec-2017' '16:17' [ 0.60] '02-Dec-2017' '16:17' [ 1.00] '03-Dec-2017' '16:17' [ 2.51] '04-Dec-2017' '16:17' [ 1.16] '05-Dec-2017' '16:17' [ 4.08] '06-Dec-2017' '16:17' [ 2.81] '07-Dec-2017' '16:17' [ 1.34] '08-Dec-2017' '16:17' [ 0.46] '09-Dec-2017' '16:17' [ 1.76] '10-Dec-2017' '16:17' [ 0.25] '11-Dec-2017' '16:17' [ 1.28] '12-Dec-2017' '16:17' [ 2.24] '13-Dec-2017' '16:17' [ 1.24] '14-Dec-2017' '16:17' [ 2.41] '15-Dec-2017' '16:17' [ 7.68] '16-Dec-2017' '16:17' [ 2.52] '17-Dec-2017' '16:17' [ 1.31] '18-Dec-2017' '16:17' [ 1.90] '19-Dec-2017' '16:17' [ 1.53] '20-Dec-2017' '16:17' [ 0.27] '21-Dec-2017' '16:17' [ 0.66] '22-Dec-2017' '16:17' [ 3.40] '23-Dec-2017' '16:17' [ 0.96] '24-Dec-2017' '16:17' [ 1.79] '25-Dec-2017' '16:17' [ 0.37] '26-Dec-2017' '16:17' [ 1.07] '27-Dec-2017' '16:17' [ 1.82] '28-Dec-2017' '16:17' [ 0.26] '29-Dec-2017' '16:17' [ 1.42] '30-Dec-2017' '16:17' [ 0.83] '31-Dec-2017' '16:17' [ 0.39] '01-Jan-2018' '16:17' [ 0.96] '02-Jan-2018' '16:17' [ 0.15] '03-Jan-2018' '16:17' [ 0.12] '04-Jan-2018' '16:17' [ 0.31] '05-Jan-2018' '16:17' [ 0.37] '06-Jan-2018' '16:17' [ 0.31] '07-Jan-2018' '16:17' [ 0.18] '08-Jan-2018' '16:17' [ 1.33] '09-Jan-2018' '16:17' [ 0.20] '10-Jan-2018' '16:17' [ 1.12] '11-Jan-2018' '16:17' [ 2.20]
The date information provided with this syntax can be in serial date number or date character vector format. The date information may or may not include time-of-day information.
Time-of-Day Information Excluded
fts = fints(dates, data)
In this second syntax the dates and data series are entered
as separate vectors to fints
, the financial time
series object constructor function. The dates
vector
must be a column vector, while the data series data
can
be a column vector (if there is only one data series) or a column-oriented
matrix (for multiple data series). A column-oriented matrix, in this
context, indicates that each column is a set of observations. Different
columns are different sets of data series.
Here is an example:
dates = (today:today+100)'; data_series1 = exp(randn(1, 101))'; data_series2 = exp(randn(1, 101))'; data = [data_series1 data_series2]; fts = fints(dates, data)
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts = desc: (none) freq: Unknown (0) 'dates: (101)' 'series1: (101)' 'series2: (101)' '03-Oct-2017' [ 1.00] [ 0.50] '04-Oct-2017' [ 1.10] [ 0.20] '05-Oct-2017' [ 0.69] [ 4.31] '06-Oct-2017' [ 0.23] [ 7.77] '07-Oct-2017' [ 0.96] [ 1.13] '08-Oct-2017' [ 2.61] [ 0.37] '09-Oct-2017' [ 5.69] [ 3.31] '10-Oct-2017' [ 0.65] [ 0.55] '11-Oct-2017' [ 0.20] [ 0.63] '12-Oct-2017' [ 1.18] [ 2.43] '13-Oct-2017' [ 1.46] [ 0.25] '14-Oct-2017' [ 0.80] [ 0.14] '15-Oct-2017' [ 0.32] [ 1.52] '16-Oct-2017' [ 7.57] [ 1.49] '17-Oct-2017' [ 0.09] [ 1.10] '18-Oct-2017' [ 0.60] [ 1.64] '19-Oct-2017' [ 0.27] [ 2.95] '20-Oct-2017' [ 0.53] [ 2.64] '21-Oct-2017' [ 1.37] [ 0.57] '22-Oct-2017' [ 1.15] [ 2.25] '23-Oct-2017' [ 0.49] [ 1.19] '24-Oct-2017' [ 2.17] [ 0.60] '25-Oct-2017' [ 1.86] [ 0.30] '26-Oct-2017' [ 1.91] [ 1.91] '27-Oct-2017' [ 0.65] [ 0.70] '28-Oct-2017' [ 2.85] [ 1.05] '29-Oct-2017' [ 1.94] [ 0.45] '30-Oct-2017' [ 12.29] [ 0.21] '31-Oct-2017' [ 2.90] [ 1.19] '01-Nov-2017' [ 3.18] [ 0.94] '02-Nov-2017' [ 1.05] [ 3.32] '03-Nov-2017' [ 0.28] [ 2.23] '04-Nov-2017' [ 0.69] [ 2.87] '05-Nov-2017' [ 0.47] [ 0.47] '06-Nov-2017' [ 0.57] [ 0.39] '07-Nov-2017' [ 1.74] [ 0.28] '08-Nov-2017' [ 0.57] [ 1.65] '09-Nov-2017' [ 0.41] [ 16.27] '10-Nov-2017' [ 0.66] [ 2.07] '11-Nov-2017' [ 0.85] [ 0.46] '12-Nov-2017' [ 1.51] [ 2.31] '13-Nov-2017' [ 0.39] [ 0.32] '14-Nov-2017' [ 1.37] [ 0.24] '15-Nov-2017' [ 1.08] [ 2.05] '16-Nov-2017' [ 3.76] [ 0.46] '17-Nov-2017' [ 0.81] [ 1.37] '18-Nov-2017' [ 0.87] [ 4.08] '19-Nov-2017' [ 0.31] [ 1.49] '20-Nov-2017' [ 0.25] [ 2.53] '21-Nov-2017' [ 1.36] [ 0.20] '22-Nov-2017' [ 0.78] [ 1.94] '23-Nov-2017' [ 1.65] [ 8.49] '24-Nov-2017' [ 0.41] [ 1.72] '25-Nov-2017' [ 6.74] [ 0.21] '26-Nov-2017' [ 1.13] [ 0.82] '27-Nov-2017' [ 2.85] [ 0.61] '28-Nov-2017' [ 0.80] [ 1.47] '29-Nov-2017' [ 0.85] [ 1.51] '30-Nov-2017' [ 1.99] [ 1.50] '01-Dec-2017' [ 1.74] [ 0.70] '02-Dec-2017' [ 0.33] [ 0.55] '03-Dec-2017' [ 0.22] [ 0.55] '04-Dec-2017' [ 0.33] [ 2.35] '05-Dec-2017' [ 0.24] [ 0.16] '06-Dec-2017' [ 1.06] [ 0.81] '07-Dec-2017' [ 0.66] [ 1.31] '08-Dec-2017' [ 0.69] [ 0.52] '09-Dec-2017' [ 0.26] [ 1.61] '10-Dec-2017' [ 2.18] [ 0.93] '11-Dec-2017' [ 1.55] [ 0.39] '12-Dec-2017' [ 0.91] [ 1.18] '13-Dec-2017' [ 2.78] [ 0.76] '14-Dec-2017' [ 0.42] [ 0.66] '15-Dec-2017' [ 1.51] [ 0.49] '16-Dec-2017' [ 1.42] [ 1.06] '17-Dec-2017' [ 1.42] [ 0.16] '18-Dec-2017' [ 0.48] [ 0.67] '19-Dec-2017' [ 1.39] [ 0.58] '20-Dec-2017' [ 0.60] [ 0.40] '21-Dec-2017' [ 0.41] [ 1.92] '22-Dec-2017' [ 0.30] [ 0.48] '23-Dec-2017' [ 2.82] [ 1.72] '24-Dec-2017' [ 0.43] [ 2.65] '25-Dec-2017' [ 0.84] [ 0.85] '26-Dec-2017' [ 0.30] [ 1.32] '27-Dec-2017' [ 0.74] [ 1.90] '28-Dec-2017' [ 0.04] [ 0.92] '29-Dec-2017' [ 0.34] [ 1.72] '30-Dec-2017' [ 0.24] [ 0.28] '31-Dec-2017' [ 0.36] [ 3.04] '01-Jan-2018' [ 0.81] [ 0.37] '02-Jan-2018' [ 0.72] [ 0.16] '03-Jan-2018' [ 6.99] [ 3.99] '04-Jan-2018' [ 0.56] [ 0.94] '05-Jan-2018' [ 0.78] [ 1.57] '06-Jan-2018' [ 0.21] [ 0.70] '07-Jan-2018' [ 0.62] [ 0.36] '08-Jan-2018' [ 0.26] [ 0.05] '09-Jan-2018' [ 1.03] [ 1.87] '10-Jan-2018' [ 2.35] [ 0.75] '11-Jan-2018' [ 1.50] [ 0.82]
The result is exactly the same as the first syntax. The only difference between the first and second syntax is the way the inputs are entered into the constructor function.
Time-of-Day Information Included. With this form of the function you can enter the time-of-day information either as a serial date number or as a date character vector. If more than one serial date and time are present, the entry must be in the form of a column-oriented matrix. If more than one character vector date and time are present, the entry must be a column-oriented cell array of character vectors for dates and times.
With date character vector input, the dates and times can initially
be separate column-oriented date and time series, but you must concatenate
them into a single column-oriented cell array before entering them
as the first input to fints
.
For date character vector input the allowable formats are
'ddmmmyy hh:mm'
or 'ddmmmyyyy
hh:mm'
'mm/dd/yy hh:mm'
or 'mm/dd/yyyy
hh:mm'
'dd-mmm-yy hh:mm'
or 'dd-mmm-yyyy
hh:mm'
'mmm.dd,yy hh:mm'
or 'mmm.dd,yyyy
hh:mm'
The next example shows time-of-day information input as serial date numbers in a column-oriented matrix:
f = fints([now;now+1],(1:2)')
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) f = desc: (none) freq: Unknown (0) 'dates: (2)' 'times: (2)' 'series1: (2)' '03-Oct-2017' '16:19' [ 1.00] '04-Oct-2017' '16:19' [ 2.00]
If the time-of-day information is in date character vector format,
you must provide it to fints
as a column-oriented
cell array:
f = fints({'01-Jan-2001 12:00';'02-Jan-2001 12:00'},(1:2)')
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) f = desc: (none) freq: Unknown (0) 'dates: (2)' 'times: (2)' 'series1: (2)' '01-Jan-2001' '12:00' [ 1.00] '02-Jan-2001' '12:00' [ 2.00]
If the dates and times are in date character vector format and
contained in separate matrices, you must concatenate them before using
the date and time information as input to fints
:
dates = ['01-Jan-2001'; '02-Jan-2001'; '03-Jan-2001']; times = ['12:00';'12:00';'12:00']; dates_time = cellstr([dates,repmat(' ',size(dates,1),1),times]); f = fints(dates_time,(1:3)')
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) f = desc: (none) freq: Unknown (0) 'dates: (3)' 'times: (3)' 'series1: (3)' '01-Jan-2001' '12:00' [ 1.00] '02-Jan-2001' '12:00' [ 2.00] '03-Jan-2001' '12:00' [ 3.00]
fts = fints(dates, data, datanames)
The third syntax lets you specify the names for the data series
with the argument datanames
. The datanames
argument
can be a MATLAB character vector for a single data series. For
multiple data series names, it must be a cell array of character vectors.
Look at two examples, one with a single data series and a second
with two. The first example sets the data series name to the specified
name First
:
dates = (today:today+100)';
data = exp(randn(1, 101))';
fts1 = fints(dates, data, 'First')
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts1 = desc: (none) freq: Unknown (0) 'dates: (101)' 'First: (101)' '03-Oct-2017' [ 1.50] '04-Oct-2017' [ 0.24] '05-Oct-2017' [ 0.48] '06-Oct-2017' [ 3.15] '07-Oct-2017' [ 1.82] '08-Oct-2017' [ 0.28] '09-Oct-2017' [ 0.11] '10-Oct-2017' [ 0.56] '11-Oct-2017' [ 1.24] '12-Oct-2017' [ 2.57] '13-Oct-2017' [ 1.10] '14-Oct-2017' [ 0.33] '15-Oct-2017' [ 1.36] '16-Oct-2017' [ 0.31] '17-Oct-2017' [ 0.38] '18-Oct-2017' [ 0.52] '19-Oct-2017' [ 0.29] '20-Oct-2017' [ 0.76] '21-Oct-2017' [ 0.41] '22-Oct-2017' [ 0.75] '23-Oct-2017' [ 0.63] '24-Oct-2017' [ 0.66] '25-Oct-2017' [ 0.60] '26-Oct-2017' [ 3.43] '27-Oct-2017' [ 1.84] '28-Oct-2017' [ 1.06] '29-Oct-2017' [ 0.23] '30-Oct-2017' [ 0.20] '31-Oct-2017' [ 0.14] '01-Nov-2017' [ 13.53] '02-Nov-2017' [ 2.64] '03-Nov-2017' [ 1.29] '04-Nov-2017' [ 0.38] '05-Nov-2017' [ 0.32] '06-Nov-2017' [ 1.73] '07-Nov-2017' [ 4.78] '08-Nov-2017' [ 0.18] '09-Nov-2017' [ 0.64] '10-Nov-2017' [ 0.92] '11-Nov-2017' [ 0.14] '12-Nov-2017' [ 2.32] '13-Nov-2017' [ 0.66] '14-Nov-2017' [ 6.77] '15-Nov-2017' [ 0.68] '16-Nov-2017' [ 1.51] '17-Nov-2017' [ 0.32] '18-Nov-2017' [ 0.54] '19-Nov-2017' [ 0.31] '20-Nov-2017' [ 1.48] '21-Nov-2017' [ 3.68] '22-Nov-2017' [ 0.55] '23-Nov-2017' [ 1.55] '24-Nov-2017' [ 0.60] '25-Nov-2017' [ 1.11] '26-Nov-2017' [ 3.31] '27-Nov-2017' [ 1.13] '28-Nov-2017' [ 0.35] '29-Nov-2017' [ 0.42] '30-Nov-2017' [ 0.84] '01-Dec-2017' [ 0.83] '02-Dec-2017' [ 0.42] '03-Dec-2017' [ 1.20] '04-Dec-2017' [ 3.55] '05-Dec-2017' [ 0.78] '06-Dec-2017' [ 0.81] '07-Dec-2017' [ 0.11] '08-Dec-2017' [ 0.46] '09-Dec-2017' [ 0.25] '10-Dec-2017' [ 0.68] '11-Dec-2017' [ 1.69] '12-Dec-2017' [ 4.59] '13-Dec-2017' [ 6.04] '14-Dec-2017' [ 0.89] '15-Dec-2017' [ 0.73] '16-Dec-2017' [ 2.26] '17-Dec-2017' [ 1.63] '18-Dec-2017' [ 2.15] '19-Dec-2017' [ 2.18] '20-Dec-2017' [ 0.23] '21-Dec-2017' [ 1.72] '22-Dec-2017' [ 0.91] '23-Dec-2017' [ 0.47] '24-Dec-2017' [ 0.50] '25-Dec-2017' [ 3.60] '26-Dec-2017' [ 0.44] '27-Dec-2017' [ 0.29] '28-Dec-2017' [ 1.24] '29-Dec-2017' [ 7.47] '30-Dec-2017' [ 1.03] '31-Dec-2017' [ 1.36] '01-Jan-2018' [ 0.39] '02-Jan-2018' [ 5.33] '03-Jan-2018' [ 1.13] '04-Jan-2018' [ 1.70] '05-Jan-2018' [ 0.39] '06-Jan-2018' [ 2.35] '07-Jan-2018' [ 1.48] '08-Jan-2018' [ 0.31] '09-Jan-2018' [ 1.04] '10-Jan-2018' [ 0.64] '11-Jan-2018' [ 1.12]
The second example provides two data series named First
and Second
:
dates = (today:today+100)'; data_series1 = exp(randn(1, 101))'; data_series2 = exp(randn(1, 101))'; data = [data_series1 data_series2]; fts2 = fints(dates, data, {'First', 'Second'})
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts2 = desc: (none) freq: Unknown (0) 'dates: (101)' 'First: (101)' 'Second: (101)' '03-Oct-2017' [ 0.78] [ 3.36] '04-Oct-2017' [ 0.83] [ 1.63] '05-Oct-2017' [ 0.36] [ 2.79] '06-Oct-2017' [ 0.72] [ 2.39] '07-Oct-2017' [ 2.15] [ 0.68] '08-Oct-2017' [ 5.72] [ 1.54] '09-Oct-2017' [ 0.31] [ 0.74] '10-Oct-2017' [ 10.78] [ 0.41] '11-Oct-2017' [ 4.60] [ 1.89] '12-Oct-2017' [ 1.18] [ 1.07] '13-Oct-2017' [ 0.74] [ 0.83] '14-Oct-2017' [ 0.50] [ 1.34] '15-Oct-2017' [ 2.30] [ 2.69] '16-Oct-2017' [ 0.50] [ 1.48] '17-Oct-2017' [ 0.63] [ 1.21] '18-Oct-2017' [ 2.42] [ 1.32] '19-Oct-2017' [ 1.55] [ 1.05] '20-Oct-2017' [ 2.45] [ 0.46] '21-Oct-2017' [ 1.66] [ 2.20] '22-Oct-2017' [ 0.67] [ 4.09] '23-Oct-2017' [ 0.60] [ 0.59] '24-Oct-2017' [ 2.22] [ 6.87] '25-Oct-2017' [ 0.51] [ 0.84] '26-Oct-2017' [ 3.28] [ 0.78] '27-Oct-2017' [ 2.20] [ 0.41] '28-Oct-2017' [ 1.33] [ 0.45] '29-Oct-2017' [ 1.00] [ 0.39] '30-Oct-2017' [ 1.44] [ 1.42] '31-Oct-2017' [ 34.01] [ 4.94] '01-Nov-2017' [ 0.89] [ 1.69] '02-Nov-2017' [ 0.21] [ 2.35] '03-Nov-2017' [ 6.79] [ 3.83] '04-Nov-2017' [ 1.84] [ 0.08] '05-Nov-2017' [ 0.52] [ 0.85] '06-Nov-2017' [ 13.70] [ 1.42] '07-Nov-2017' [ 1.73] [ 2.05] '08-Nov-2017' [ 1.34] [ 0.27] '09-Nov-2017' [ 0.46] [ 0.37] '10-Nov-2017' [ 0.34] [ 2.20] '11-Nov-2017' [ 0.17] [ 0.89] '12-Nov-2017' [ 0.66] [ 1.74] '13-Nov-2017' [ 0.35] [ 0.38] '14-Nov-2017' [ 1.91] [ 0.20] '15-Nov-2017' [ 0.73] [ 2.14] '16-Nov-2017' [ 5.86] [ 3.30] '17-Nov-2017' [ 4.53] [ 5.11] '18-Nov-2017' [ 1.18] [ 0.22] '19-Nov-2017' [ 0.75] [ 0.26] '20-Nov-2017' [ 3.17] [ 0.23] '21-Nov-2017' [ 0.32] [ 0.96] '22-Nov-2017' [ 1.96] [ 0.54] '23-Nov-2017' [ 0.51] [ 3.72] '24-Nov-2017' [ 0.67] [ 0.23] '25-Nov-2017' [ 0.51] [ 0.18] '26-Nov-2017' [ 1.78] [ 1.23] '27-Nov-2017' [ 0.46] [ 3.30] '28-Nov-2017' [ 0.35] [ 0.45] '29-Nov-2017' [ 1.74] [ 0.28] '30-Nov-2017' [ 0.65] [ 0.86] '01-Dec-2017' [ 1.44] [ 0.19] '02-Dec-2017' [ 0.70] [ 1.02] '03-Dec-2017' [ 1.31] [ 2.29] '04-Dec-2017' [ 0.08] [ 1.24] '05-Dec-2017' [ 1.59] [ 0.15] '06-Dec-2017' [ 6.38] [ 0.58] '07-Dec-2017' [ 2.83] [ 0.74] '08-Dec-2017' [ 2.49] [ 6.13] '09-Dec-2017' [ 0.79] [ 2.50] '10-Dec-2017' [ 1.20] [ 0.94] '11-Dec-2017' [ 1.28] [ 3.70] '12-Dec-2017' [ 1.10] [ 0.35] '13-Dec-2017' [ 0.44] [ 0.71] '14-Dec-2017' [ 0.70] [ 4.11] '15-Dec-2017' [ 0.84] [ 4.49] '16-Dec-2017' [ 0.62] [ 2.08] '17-Dec-2017' [ 2.31] [ 1.63] '18-Dec-2017' [ 12.66] [ 0.56] '19-Dec-2017' [ 0.27] [ 2.11] '20-Dec-2017' [ 1.14] [ 0.44] '21-Dec-2017' [ 0.24] [ 1.78] '22-Dec-2017' [ 3.68] [ 1.33] '23-Dec-2017' [ 4.10] [ 3.12] '24-Dec-2017' [ 0.19] [ 0.65] '25-Dec-2017' [ 6.98] [ 1.89] '26-Dec-2017' [ 0.34] [ 2.21] '27-Dec-2017' [ 1.25] [ 0.41] '28-Dec-2017' [ 3.00] [ 1.17] '29-Dec-2017' [ 1.16] [ 4.94] '30-Dec-2017' [ 9.93] [ 1.12] '31-Dec-2017' [ 15.68] [ 0.73] '01-Jan-2018' [ 1.15] [ 1.58] '02-Jan-2018' [ 0.15] [ 0.76] '03-Jan-2018' [ 0.69] [ 1.56] '04-Jan-2018' [ 0.43] [ 0.87] '05-Jan-2018' [ 0.47] [ 0.98] '06-Jan-2018' [ 0.32] [ 1.59] '07-Jan-2018' [ 1.08] [ 3.91] '08-Jan-2018' [ 8.22] [ 1.57] '09-Jan-2018' [ 0.49] [ 5.20] '10-Jan-2018' [ 0.76] [ 0.13] '11-Jan-2018' [ 3.21] [ 0.64]
Note
Data series names must be valid MATLAB variable names.
The only allowed nonalphanumeric character is the underscore (_
)
character.
Because freq
for fts2
has
not been explicitly indicated, the frequency indicator for fts2
is
set to Unknown
. Set the frequency indicator field freq
before
you attempt any operations on the object. You will not be able to
use the object until the frequency indicator field is set to a valid
indicator.
fts = fints(dates, data, datanames, freq)
With the fourth syntax you can set the frequency indicator field when
you create the financial time series object. The frequency indicator
field freq
is set as the fourth input argument.
You will not be able to use the financial time series object until freq
is
set to a valid indicator. Valid frequency indicators are
UNKNOWN, Unknown, unknown, U, u,0 DAILY, Daily, daily, D, d,1 WEEKLY, Weekly, weekly, W, w,2 MONTHLY, Monthly, monthly, M, m,3 QUARTERLY, Quarterly, quarterly, Q, q,4 SEMIANNUAL, Semiannual, semiannual, S, s,5 ANNUAL, Annual, annual, A, a,6
The previous example contained sets of daily data. The freq
field
displayed as Unknown (0)
because
the frequency indicator was not explicitly set. The command
fts = fints(dates, data, {'First', 'Second'}, 1)
sets the freq
indicator to Daily(1)
when
creating the financial time series object:
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts = desc: (none) freq: Daily (1) 'dates: (101)' 'First: (101)' 'Second: (101)' '03-Oct-2017' [ 1.27] [ 1.24] '04-Oct-2017' [ 0.43] [ 2.40] '05-Oct-2017' [ 0.28] [ 1.21] '06-Oct-2017' [ 1.85] [ 0.66] '07-Oct-2017' [ 1.85] [ 1.43] '08-Oct-2017' [ 1.34] [ 1.04] '09-Oct-2017' [ 1.48] [ 0.69] '10-Oct-2017' [ 0.42] [ 5.88] '11-Oct-2017' [ 0.61] [ 1.25] '12-Oct-2017' [ 0.90] [ 15.34] '13-Oct-2017' [ 0.50] [ 0.74] '14-Oct-2017' [ 1.39] [ 1.76] '15-Oct-2017' [ 10.65] [ 4.87] '16-Oct-2017' [ 0.62] [ 15.32] '17-Oct-2017' [ 1.91] [ 1.35] '18-Oct-2017' [ 0.36] [ 0.45] '19-Oct-2017' [ 3.82] [ 2.23] '20-Oct-2017' [ 0.38] [ 0.27] '21-Oct-2017' [ 1.23] [ 0.76] '22-Oct-2017' [ 0.54] [ 1.31] '23-Oct-2017' [ 1.67] [ 4.44] '24-Oct-2017' [ 1.01] [ 4.21] '25-Oct-2017' [ 0.96] [ 0.97] '26-Oct-2017' [ 19.09] [ 2.52] '27-Oct-2017' [ 0.53] [ 0.73] '28-Oct-2017' [ 0.95] [ 1.94] '29-Oct-2017' [ 14.63] [ 6.79] '30-Oct-2017' [ 0.32] [ 1.17] '31-Oct-2017' [ 1.74] [ 0.74] '01-Nov-2017' [ 0.34] [ 0.61] '02-Nov-2017' [ 2.80] [ 2.05] '03-Nov-2017' [ 1.39] [ 3.81] '04-Nov-2017' [ 1.92] [ 8.38] '05-Nov-2017' [ 0.76] [ 1.06] '06-Nov-2017' [ 1.28] [ 1.18] '07-Nov-2017' [ 4.36] [ 0.53] '08-Nov-2017' [ 0.10] [ 5.01] '09-Nov-2017' [ 0.20] [ 0.93] '10-Nov-2017' [ 1.52] [ 0.62] '11-Nov-2017' [ 0.52] [ 8.88] '12-Nov-2017' [ 0.74] [ 2.25] '13-Nov-2017' [ 0.22] [ 2.05] '14-Nov-2017' [ 0.40] [ 0.37] '15-Nov-2017' [ 0.67] [ 1.54] '16-Nov-2017' [ 0.48] [ 1.68] '17-Nov-2017' [ 0.42] [ 0.34] '18-Nov-2017' [ 0.66] [ 0.80] '19-Nov-2017' [ 0.39] [ 0.67] '20-Nov-2017' [ 3.83] [ 1.70] '21-Nov-2017' [ 0.37] [ 0.37] '22-Nov-2017' [ 6.16] [ 2.97] '23-Nov-2017' [ 0.69] [ 5.96] '24-Nov-2017' [ 0.23] [ 0.74] '25-Nov-2017' [ 0.54] [ 0.99] '26-Nov-2017' [ 2.55] [ 1.66] '27-Nov-2017' [ 2.87] [ 3.33] '28-Nov-2017' [ 1.17] [ 1.69] '29-Nov-2017' [ 1.33] [ 1.49] '30-Nov-2017' [ 1.88] [ 0.62] '01-Dec-2017' [ 0.23] [ 0.79] '02-Dec-2017' [ 0.56] [ 1.85] '03-Dec-2017' [ 0.16] [ 5.38] '04-Dec-2017' [ 0.64] [ 1.77] '05-Dec-2017' [ 2.58] [ 0.30] '06-Dec-2017' [ 2.05] [ 1.54] '07-Dec-2017' [ 9.85] [ 0.91] '08-Dec-2017' [ 1.18] [ 0.78] '09-Dec-2017' [ 0.12] [ 0.80] '10-Dec-2017' [ 5.42] [ 0.41] '11-Dec-2017' [ 3.60] [ 0.73] '12-Dec-2017' [ 0.56] [ 0.46] '13-Dec-2017' [ 1.25] [ 0.69] '14-Dec-2017' [ 2.18] [ 1.12] '15-Dec-2017' [ 1.47] [ 1.19] '16-Dec-2017' [ 2.01] [ 0.81] '17-Dec-2017' [ 0.89] [ 0.86] '18-Dec-2017' [ 0.96] [ 1.03] '19-Dec-2017' [ 1.09] [ 1.58] '20-Dec-2017' [ 0.45] [ 3.60] '21-Dec-2017' [ 4.15] [ 1.86] '22-Dec-2017' [ 1.01] [ 0.75] '23-Dec-2017' [ 1.99] [ 1.82] '24-Dec-2017' [ 0.43] [ 0.78] '25-Dec-2017' [ 0.34] [ 0.17] '26-Dec-2017' [ 0.91] [ 0.10] '27-Dec-2017' [ 0.78] [ 0.18] '28-Dec-2017' [ 3.30] [ 0.79] '29-Dec-2017' [ 1.83] [ 0.54] '30-Dec-2017' [ 1.72] [ 0.49] '31-Dec-2017' [ 0.24] [ 1.04] '01-Jan-2018' [ 0.38] [ 0.52] '02-Jan-2018' [ 1.22] [ 0.53] '03-Jan-2018' [ 0.71] [ 1.84] '04-Jan-2018' [ 3.63] [ 2.19] '05-Jan-2018' [ 3.82] [ 11.43] '06-Jan-2018' [ 0.56] [ 1.35] '07-Jan-2018' [ 2.40] [ 1.06] '08-Jan-2018' [ 4.04] [ 0.56] '09-Jan-2018' [ 1.38] [ 0.82] '10-Jan-2018' [ 5.07] [ 0.95] '11-Jan-2018' [ 2.89] [ 0.17]
When you create the object using this syntax, you can use the
other valid frequency indicators for a particular frequency. For a
daily data set you can use DAILY
, Daily
, daily
, D
,
or d
. Similarly, with the other frequencies, you
can use the valid character vector indicators or their numeric counterparts.
fts = fints(dates, data, datanames, freq, desc)
With the fifth syntax, you can explicitly set the description field as the fifth input argument. The description can be anything you want. It is not used in any operations performed on the object.
This example sets the desc
field to 'Test
TS'
.
dates = (today:today+100)'; data_series1 = exp(randn(1, 101))'; data_series2 = exp(randn(1, 101))'; data = [data_series1 data_series2]; fts = fints(dates, data, {'First', 'Second'}, 1, 'Test TS')
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints (line 165) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) fts = desc: Test TS freq: Daily (1) 'dates: (101)' 'First: (101)' 'Second: (101)' '03-Oct-2017' [ 0.77] [ 0.36] '04-Oct-2017' [ 2.12] [ 0.79] '05-Oct-2017' [ 0.57] [ 0.62] '06-Oct-2017' [ 1.64] [ 0.72] '07-Oct-2017' [ 2.70] [ 1.61] '08-Oct-2017' [ 2.94] [ 0.88] '09-Oct-2017' [ 2.17] [ 0.55] '10-Oct-2017' [ 0.10] [ 0.64] '11-Oct-2017' [ 0.57] [ 0.27] '12-Oct-2017' [ 2.46] [ 0.42] '13-Oct-2017' [ 1.48] [ 0.24] '14-Oct-2017' [ 1.00] [ 0.60] '15-Oct-2017' [ 1.55] [ 0.34] '16-Oct-2017' [ 3.10] [ 0.49] '17-Oct-2017' [ 1.17] [ 0.74] '18-Oct-2017' [ 0.47] [ 0.30] '19-Oct-2017' [ 0.84] [ 0.98] '20-Oct-2017' [ 0.81] [ 1.41] '21-Oct-2017' [ 2.45] [ 0.38] '22-Oct-2017' [ 1.51] [ 3.05] '23-Oct-2017' [ 1.73] [ 0.20] '24-Oct-2017' [ 1.16] [ 0.68] '25-Oct-2017' [ 0.70] [ 0.23] '26-Oct-2017' [ 1.06] [ 0.71] '27-Oct-2017' [ 1.24] [ 0.27] '28-Oct-2017' [ 0.25] [ 0.56] '29-Oct-2017' [ 1.20] [ 0.48] '30-Oct-2017' [ 2.53] [ 0.31] '31-Oct-2017' [ 0.90] [ 0.13] '01-Nov-2017' [ 4.82] [ 1.76] '02-Nov-2017' [ 1.75] [ 7.39] '03-Nov-2017' [ 0.66] [ 9.24] '04-Nov-2017' [ 0.86] [ 0.61] '05-Nov-2017' [ 0.76] [ 0.96] '06-Nov-2017' [ 1.27] [ 0.63] '07-Nov-2017' [ 2.13] [ 1.08] '08-Nov-2017' [ 0.75] [ 0.40] '09-Nov-2017' [ 1.58] [ 0.15] '10-Nov-2017' [ 5.79] [ 0.96] '11-Nov-2017' [ 2.54] [ 0.29] '12-Nov-2017' [ 2.28] [ 0.15] '13-Nov-2017' [ 0.44] [ 10.74] '14-Nov-2017' [ 0.59] [ 0.79] '15-Nov-2017' [ 1.27] [ 1.50] '16-Nov-2017' [ 0.90] [ 3.30] '17-Nov-2017' [ 0.20] [ 0.19] '18-Nov-2017' [ 0.22] [ 1.51] '19-Nov-2017' [ 2.79] [ 1.65] '20-Nov-2017' [ 0.47] [ 1.09] '21-Nov-2017' [ 7.99] [ 1.17] '22-Nov-2017' [ 0.11] [ 0.59] '23-Nov-2017' [ 1.57] [ 2.06] '24-Nov-2017' [ 1.00] [ 0.43] '25-Nov-2017' [ 0.47] [ 0.45] '26-Nov-2017' [ 1.50] [ 2.07] '27-Nov-2017' [ 0.45] [ 5.40] '28-Nov-2017' [ 2.36] [ 0.68] '29-Nov-2017' [ 1.07] [ 0.60] '30-Nov-2017' [ 0.19] [ 1.50] '01-Dec-2017' [ 0.09] [ 2.92] '02-Dec-2017' [ 0.75] [ 2.63] '03-Dec-2017' [ 3.14] [ 1.31] '04-Dec-2017' [ 1.20] [ 0.53] '05-Dec-2017' [ 1.06] [ 1.88] '06-Dec-2017' [ 1.99] [ 0.92] '07-Dec-2017' [ 0.25] [ 3.96] '08-Dec-2017' [ 4.16] [ 0.24] '09-Dec-2017' [ 0.41] [ 1.15] '10-Dec-2017' [ 1.04] [ 3.63] '11-Dec-2017' [ 0.70] [ 0.61] '12-Dec-2017' [ 1.16] [ 0.54] '13-Dec-2017' [ 0.14] [ 0.39] '14-Dec-2017' [ 4.59] [ 0.76] '15-Dec-2017' [ 1.73] [ 0.82] '16-Dec-2017' [ 7.46] [ 1.15] '17-Dec-2017' [ 4.12] [ 0.41] '18-Dec-2017' [ 1.01] [ 1.09] '19-Dec-2017' [ 0.39] [ 0.55] '20-Dec-2017' [ 0.18] [ 0.69] '21-Dec-2017' [ 1.02] [ 0.43] '22-Dec-2017' [ 1.25] [ 0.75] '23-Dec-2017' [ 2.85] [ 35.51] '24-Dec-2017' [ 0.39] [ 30.19] '25-Dec-2017' [ 2.21] [ 3.15] '26-Dec-2017' [ 1.07] [ 2.20] '27-Dec-2017' [ 0.46] [ 0.28] '28-Dec-2017' [ 2.17] [ 0.56] '29-Dec-2017' [ 1.30] [ 0.54] '30-Dec-2017' [ 0.79] [ 1.71] '31-Dec-2017' [ 6.54] [ 1.62] '01-Jan-2018' [ 1.84] [ 1.11] '02-Jan-2018' [ 0.90] [ 0.71] '03-Jan-2018' [ 1.32] [ 0.40] '04-Jan-2018' [ 1.09] [ 1.01] '05-Jan-2018' [ 1.19] [ 3.12] '06-Jan-2018' [ 1.57] [ 1.53] '07-Jan-2018' [ 0.55] [ 1.20] '08-Jan-2018' [ 0.45] [ 1.93] '09-Jan-2018' [ 1.43] [ 1.79] '10-Jan-2018' [ 6.59] [ 0.20] '11-Jan-2018' [ 0.74] [ 1.02]
Now the description field is filled with the specified character
vector 'Test TS'
when the constructor is called.
The function ascii2fts
creates a financial time series
object from a text (ASCII) data file if the data file conforms to
a general format. The general format of the text data file is as follows:
Can contain header text lines.
Can contain column header information. The column
header information must immediately precede the data series columns
unless the skiprows
argument (see below) is specified.
Leftmost column must be the date column.
Dates must be in a valid date character vector format:
'ddmmmyy'
or 'ddmmmyyyy'
'mm/dd/yy'
or 'mm/dd/yyyy'
'dd-mmm-yy'
or 'dd-mmm-yyyy'
'mmm.dd,yy'
or 'mmm.dd,yyyy'
Each column must be separated either by spaces or a tab.
Several example text data files are included with the toolbox.
These files are in the ftsdata
subfolder within the folder matlabroot
/toolbox/finance
.
The syntax of the function
fts = ascii2fts(filename, descrow, colheadrow, skiprows);
takes in the data file name (filename
), the
row number where the text for the description field is (descrow
),
the row number of the column header information (colheadrow
),
and the row numbers of rows to be skipped (skiprows
).
For example, rows need to be skipped when there are intervening rows
between the column head row and the start of the time series data.
Look at the beginning of the ASCII file disney.dat
in
the ftsdata
subfolder:
Walt Disney Company (DIS) Daily prices (3/29/96 to 3/29/99) DATE OPEN HIGH LOW CLOSE VOLUME 3/29/99 33.0625 33.188 32.75 33.063 6320500 3/26/99 33.3125 33.375 32.75 32.938 5552800 3/25/99 33.5 33.625 32.875 33.375 7936000 3/24/99 33.0625 33.25 32.625 33.188 6025400...
The command-line
disfts = ascii2fts('disney.dat', 1, 3, 2)
uses disney.dat
to create time series object disfts
.
This example
Reads the text data file disney.dat
Uses the first line in the file as the content of the description field
Skips the second line
Parses the third line in the file for column header (or data series names)
Parses the rest of the file for the date vector and the data series values
The resulting financial time series object looks like this.
Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In ascii2fts (line 64) Warning: FINTS will be removed in a future release. Use TIMETABLE instead. > In fints/display (line 66) disfts = desc: Walt Disney Company (DIS) freq: Unknown (0) 'dates: (782)' 'OPEN: (782)' 'HIGH: (782)' 'LOW: (782)' '29-Mar-1996' [ 21.1938] [ 21.6250] [ 21.2920] '01-Apr-1996' [ 21.1120] [ 21.6250] [ 21.4170] '02-Apr-1996' [ 21.3165] [ 21.8750] [ 21.6670] '03-Apr-1996' [ 21.4802] [ 21.8750] [ 21.7500] '04-Apr-1996' [ 21.4393] [ 21.8750] [ 21.5000] '05-Apr-1996' [ NaN] [ NaN] [ NaN] '09-Apr-1996' [ 21.1529] [ 21.5420] [ 21.2080] '10-Apr-1996' [ 20.7387] [ 21.1670] [ 20.2500] '11-Apr-1996' [ 20.0829] [ 20.5000] [ 20.0420] '12-Apr-1996' [ 19.9189] [ 20.5830] [ 20.0830] '15-Apr-1996' [ 20.2878] [ 20.7920] [ 20.3750] '16-Apr-1996' [ 20.3698] [ 20.9170] [ 20.1670] '17-Apr-1996' [ 20.4927] [ 20.9170] [ 20.7080] '18-Apr-1996' [ 20.4927] [ 21.0420] [ 20.7920]
There are 782 data points in this object. Only the first few
lines are shown here. Also, this object has two other data series,
the CLOSE
and VOLUME
data series,
that are not shown here. In creating the financial time series object, ascii2fts
sorts
the data into ascending chronological order.
The frequency indicator field, freq
, is set
to 0
for Unknown
frequency.
You can manually reset it to the appropriate frequency using structure
syntax disfts.freq = 1
for Daily
frequency.
With a slightly different syntax, the function ascii2fts
can
create a financial time series object when time-of-day data is present
in the ASCII file. The new syntax has the form
fts = ascii2fts(filename, timedata, descrow, colheadrow, skiprows);
Set timedata
to 'T'
when
time-of-day data is present and to 'NT'
when there
is no time data. For an example using this function with time-of-day
data, see the reference page for ascii2fts
.
ascii2fts
| boxcox
| convertto
| datestr
| diff
| fillts
| filter
| fints
| fts2mat
| ftsbound
| lagts
| leadts
| peravg
| resamplets
| smoothts
| toannual
| todaily
| today
| tomonthly
| toquarterly
| tosemi
| toweekly
| tsmovavg