Main Content

fints

Construct financial time series object

fints is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Description

example

tsobj = fints(dates_and_data) creates a financial time series object containing the dates and data from the matrix dates_and_data. If the dates contain time-of-day information, the object contains an additional series of times. The date series and each data series must each be a column in the input matrix. The names of the data series default to series1, ..., seriesn. The desc and freq fields are set to their defaults.

fints constructs a financial time series object. A financial time series object is a MATLAB® object that contains a series of dates and one or more series of data. Before you perform an operation on the data, you must set the frequency indicator (freq). You can optionally provide a description (desc) for the time series.

Note

fints only supports hourly and minute time series. Seconds are not supported and will be disregarded when the fints object is created (that is, 01-jan-2001 12:00:01 will be considered as 01-jan-2001 12:00). If there are duplicate dates and times, the fints constructor sorts the dates and times and chooses the first instance of the duplicate dates and times. The other duplicate dates and times are removed from the object along with their corresponding data.

example

tsobj = fints(dates,data) generates a financial time series object containing dates from the dates column vector of dates and data from the matrix data. If the dates contain time-of-day information, the object contains an additional series of times. The data matrix must be column-oriented, that is, each column in the matrix is a data series. The names of the series default to series1, ..., seriesn, where n is the total number of columns in data. The desc and freq fields are set to their defaults.

example

tsobj = fints(dates,data,datanames) also allows you to rename the data series. The names are specified in the datanames cell array. The number of character vectors in datanames must correspond to the number of columns in data. The desc and freq fields are set to their defaults.

example

tsobj = fints(___freq,desc) sets the frequency (freq) or description (desc) when you create the object.

Examples

collapse all

Define the data:

data = [1:6]'
data = 6×1

     1
     2
     3
     4
     5
     6

Define the dates:

dates = [today:today+5]'
dates = 6×1

      738578
      738579
      738580
      738581
      738582
      738583

Create the financial times series object:

tsobjkt = fints(dates, data)
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
 
tsobjkt = 
 
    desc:  (none)
    freq:  Unknown (0)

    {'dates:  (6)'}    {'series1:  (6)'}
    {'26-Feb-2022'}    {[            1]}
    {'27-Feb-2022'}    {[            2]}
    {'28-Feb-2022'}    {[            3]}
    {'01-Mar-2022'}    {[            4]}
    {'02-Mar-2022'}    {[            5]}
    {'03-Mar-2022'}    {[            6]}

Define the data:

data = [1:6]'
data = 6×1

     1
     2
     3
     4
     5
     6

Define the dates:

dates = [now:now+5]'
dates = 6×1
105 ×

    7.3858
    7.3858
    7.3858
    7.3858
    7.3858
    7.3858

Create the financial times series object:

tsobjkt = fints(dates, data)
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
 
tsobjkt = 
 
    desc:  (none)
    freq:  Unknown (0)

    {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
    {'26-Feb-2022'}    {'11:18'      }    {[            1]}
    {'27-Feb-2022'}    {'11:18'      }    {[            2]}
    {'28-Feb-2022'}    {'11:18'      }    {[            3]}
    {'01-Mar-2022'}    {'11:18'      }    {[            4]}
    {'02-Mar-2022'}    {'11:18'      }    {[            5]}
    {'03-Mar-2022'}    {'11:18'      }    {[            6]}

Define the dates and times:

dates_and_times = (now:now+5)'
dates_and_times = 6×1
105 ×

    7.3858
    7.3858
    7.3858
    7.3858
    7.3858
    7.3858

Create the financial times series object:

 f = fints(dates_and_times, randn(6,1))
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
 
f = 
 
    desc:  (none)
    freq:  Unknown (0)

    {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
    {'26-Feb-2022'}    {'11:18'      }    {[       0.5377]}
    {'27-Feb-2022'}    {'11:18'      }    {[       1.8339]}
    {'28-Feb-2022'}    {'11:18'      }    {[      -2.2588]}
    {'01-Mar-2022'}    {'11:18'      }    {[       0.8622]}
    {'02-Mar-2022'}    {'11:18'      }    {[       0.3188]}
    {'03-Mar-2022'}    {'11:18'      }    {[      -1.3077]}

This generates a financial time series object, f, and obtains the dates and data from the matrix dates_and_times. The dates and times in the input matrix must be oriented column-wise (i.e. the date series and each time series are columns in the input matrix). In addition, the dates entered must be in the serial date format (i.e. 01-Jan-2001 is 730852). You can also use the function now to enter in date information. The names of the series will default to 'series1', ..., '|seriesN'| where N is the total number of columns in dates_and_times less 1 (that is the number of data columns). The default contents of the desc and freq fields are|''| and | 'Unknown'| (0), respectively.

Input Arguments

collapse all

Financial time series object, specified as a fints object.

Dates and data, specified as a column-oriented matrix containing one column of dates and a single column for each series of data. In this format, dates must be entered in serial date number and time format. If the input serial date numbers encode time-of-day information, the output tsobj object contains a column labeled 'dates' containing the date information and another labeled 'times' containing the time information.

You can use the MATLAB function today to enter date information or the MATLAB function now to enter date with time information.

Data Types: double

Dates, specified as a cell array of date character vectors. Valid date and time character vector 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'

Dates and times can initially be separate column-oriented vectors, but they must be concatenated into a single column-oriented matrix before being passed to fints. You can use the MATLAB functions today and now to help with entering date and time information.

Data Types: cell

Data, specified as a column-oriented matrix containing a column for each series of data. The number of values in each data series must match the number of dates. If a mismatch occurs, MATLAB does not generate the financial time series object, and you receive an error message.

Data Types: double

Data series names, specified as a cell array of character vectors for data series names. This argument overrides the default data series names. The default data series names are series1, series2, and so on.

Note

Not all character vectors are accepted as datanames parameters. Supported data series names cannot start with a number and must contain only these characters:

  • Lowercase Latin alphabet, a to z

  • Uppercase Latin alphabet, A to Z

  • Underscore, _

Data Types: cell

Frequency indicator, specified using one of the allowed values:

  • 'UNKNOWN', 'Unknown', 'unknown', 'U', or 'u'

  • 'DAILY', 'Daily', 'daily', 'D', or 'd'

  • 'WEEKLY', 'Weekly', 'weekly', 'W', or 'w'

  • 'MONTHLY', 'Monthly', 'monthly', 'M', or 'm'

  • 'QUARTERLY', 'Quarterly', 'quarterly', 'Q', or 'q'

  • 'SEMIANNUAL', 'Semiannual', 'semiannual', 'S', or 's'

  • 'ANNUAL', 'Annual', 'annual', 'A', or 'a'

Data Types: char

descriptive name for financial time series object, specified as a character vector.

Data Types: char

Output Arguments

collapse all

Financial time series object, returned as a fints object.

Version History

Introduced before R2006a