Convert Financial Time Series Objects fints
to Timetables
In R2018a, financial time series (fints
), and its associated methods have been replaced with a MATLAB®
timetable
function. If you use
fints
or the associated methods, you receive a warning. You can
use fts2timetable
to convert a
fints
object to a timetable
object. To help
you convert from the older fints
to the newer
timetable
functionality, use the following information.
Create Time Series
I/O Related Operations
Task | Old Functionality | New Functionality |
---|---|---|
Construct by passing in data and dates | fints(dates,data,datanames) |
|
Construct by conversion of files | ascii2fts(filename,descrow,colheadrow,skiprows) |
|
Write files | fts2ascii(filename,tsobj,exttext) | writetable(TT,filename) |
Convert to matrix | fts2mat(tsobj) |
|
Index an Object
Indexing an Object
Task | Old Functionality | New Functionality |
---|---|---|
Indexing with a date | myfts('05/11/99') |
|
Indexing with a date range | myfts ('05/11/99::05/15/99') |
|
Indexing with integers for rows |
|
|
Contents of a specific time field | myfts.times | timeofday(TT.Properties.RowTimes) |
Contents for a specific field in a matrix | fts2mat(myfts.series2) |
|
Transform Time Series
Assume that all variables are numeric within a timetable, or the operations can be
applied on TT2
:
S = vartype('numeric');
TT2 = TT(:,S)
Filter Time Series
Task | Old Functionality | New Functionality |
---|---|---|
Boxcox transformation | newfts = boxcox(oldfts) |
|
Differencing | diff(myfts) |
|
Indexing with integers for rows |
|
(Assumes no missing dates) |
Linear filtering | filter(B,A, myfts) |
|
Lag or lead time series object |
|
(Assumes a regularly spaced timetable) |
Periodic average | peravg(myfts) |
|
Downsample data | resamplets(oldfts,samplestep) |
|
Smooth data | smoothts(input) |
|
Moving average | tsmovavg(tsobj,method,lag) |
|
Convert Time Series
Assume that all variables are numeric within a timetable, or the operations can be
applied on TT2
:
S = vartype('numeric');
TT2 = TT(:,S)
Conversion Operations
Task | Old Functionality | New Functionality |
---|---|---|
Convert to specified frequency | convertto(oldfts,newfreq) |
|
Convert to annual | toannual(oldfts,...) |
|
Convert to daily | todaily(oldfts,...) | convert2daily(TT,…) |
Convert to monthly | tomonthly(oldfts,...) | convert2monthly(TT,…) |
Convert to quarterly | toquarterly(oldfts,...) |
|
Convert to semiannual | tosemi(oldfts,...) |
|
Convert to weekly | toweekly(oldfts,...) |
|
Merge Time Series
Merge Operations
Task | Old Functionality | New Functionality |
---|---|---|
Merge multiple time series objects | merge(fts1,fts2) |
|
Concatenate financial time series objects horizontally | horzcat(fts1,fts2) or
[fts1,fts2] |
|
Concatenate financial time series objects vertically | vertcat(fts1,fts2) or
[fts1;fts2] | vertcat[TT1;TT2] |
Analyze Time Series
Due to flexibility of a timetable that can hold heterogeneous variables, a timetable does not support math operations or descriptive statistical calculations. If you would like to apply any numeric calculations on a timetable, use the following guidelines.
Assume that all variables are numeric within a timetable, or the operations can be
applied on TT2
:
S = vartype('numeric');
TT2 = TT(:,S)
Descriptive Statistics and Arithmetic and Math Operations
Task | Old Functionality | New Functionality |
---|---|---|
Extract out numerical data | srs2 = myfts.series2 |
|
Apply some options (statistics) | For example: min , max ,
mean , median ,
cov , std , and
var |
|
Apply some options (operations) | For example: sum and
cumsum |
|
Data Extraction
Refer to timetable
documentation for data
extraction methods and examples.
See Also
timetable
| retime
| synchronize
| timerange
| withtol
| vartype
| issorted
| sortrows
| unique
| diff
| isregular
| rmmissing
| fillmissing
| convert2daily
| convert2weekly
| convert2monthly
| convert2quarterly
| convert2semiannual
| convert2annual
| fts2timetable