Financial Time Series | ![]() ![]() |
Transforming a Text File
The function ascii2fts
creates a financial time series object from a text (ASCII) data file provided that the data file conforms to a general format.The general format of the text data file is:
'ddmmmyy' or 'ddmmmyyyy' 'mm/dd/yy' or 'mm/dd/yyyy' 'dd-mmm-yy' or 'dd-mmm-yyyy'
Several example text data files are included with the toolbox. These files are in the ftsdata
subdirectory within the Financial Time Series Toolbox directory <matlab>/toolbox/ftseries
.
fts = ascii2fts(filename, descrow, colheadrow, skiprows);
takes in the data filename (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 contiguous rows to be skipped (skiprows
).
disfts = ascii2fts('disney.dat', 1, 3, 2)
uses disney.dat
to create time series object disfts
. This example:
disney.dat
Look at the object at this point.
disfts = desc: Walt Disney Company (DIS) freq: Unknown (0) 'dates: (782)' 'OPEN: (782)' 'HIGH: (782)' 'LOW: (782)' '29-Mar-1999' [ 33.0625] [ 33.1880] [ 32.7500] '26-Mar-1999' [ 33.3125] [ 33.3750] [ 32.7500] '25-Mar-1999' [ 33.5000] [ 33.6250] [ 32.8750] '24-Mar-1999' [ 33.0625] [ 33.2500] [ 32.6250] '23-Mar-1999' [ 34.1250] [ 34.1880] [ 32.8130] '22-Mar-1999' [ 34.9375] [ 35] [ 34.2500] '19-Mar-1999' [ 35.7500] [ 35.8130] [ 34.8750] '18-Mar-1999' [ 34.8125] [ 35.6880] [ 34.6880] '17-Mar-1999' [ 35.2500] [ 35.5630] [ 34.5000] '16-Mar-1999' [ 35.7500] [ 36.4380] [ 35.0630] '15-Mar-1999' [ 36.1250] [ 36.5630] [ 35.1250] '12-Mar-1999' [ 35.6250] [ 36.4380] [ 35.6250] '11-Mar-1999' [ 34.1250] [ 34.9380] [ 34.1250] '10-Mar-1999' [ 34.6875] [ 35.0630] [ 34.3750] '09-Mar-1999' [ 35.7500] [ 35.8130] [ 34.3130] '08-Mar-1999' [ 35.9375] [ 36.6880] [ 35.9380] '05-Mar-1999' [ 35.8125] [ 36] [ 35.5630]
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, which are not shown here.
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.
![]() | Using the Constructor | Working with Financial Time Series Objects | ![]() |