MATLAB > Time Series Basics |
Now that we have covered quotes, let's get our feet wet with time series. The following line will get the last 10 days of /GCL:
>> hist = getdailytail(con,'/GCL',10)
Matlab will reply with:
Time Series Collection Object: unnamed
Time vector characteristics
Start date 17-Aug-2011 00:00:00
End date 30-Aug-2011 00:00:00
Member Time Series Objects:
Open
High
Low
Close
Volume
OpenInterest
(In your case the date range is naturally going to be different; this query was executed on August 30th 2011.)
What we got back from Matlab was a standard Matlab Time Series Collection object containing Time Series objects for Open, High, Low, Close, Volume and OpenInterest.
We can now inspect, say, the Close time series component:
>> hist.Close
To which Matlab will reply with:
timeseries
Common Properties:
Name: 'Close'
Time: [10x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [1x1x10 double]
DataInfo: [1x1 tsdata.datametadata]
More properties, Methods
It's super-easy for us to get the mean and standard deviation of the time series above:
>> mean (hist.Close), std (hist.Close)
to which Matlab will reply with:
ans =
85.3610
ans =
2.1085