Best way to store "collection" of time series; issues with "execute" on structure array
12 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to create a structure array or other aggregate object of time series objects (a "collection"). The idea is to have a dataset fully encapsulated by this large object. I will have multiple stocks in each time series, and each time series will have a name, like "average_price" for example.
I am writing a script that takes an excel file with one variable per sheet (and many stocks per sheet). For convenience, I name each of the sheets with the name of each variable. I want to use these sheet names as my variable names.
The "importdata" function works well to get all the data I need. However, to extract data after using importdata, I need to use fieldnames originating from excel (i.e. variable names). I can get these into a text variable, but then in order to access the data, I must do it with this text variable (not knowing the actual text itself). This is where I run into a problem. I have tried "execute" and "eval" with a concatenated string, but get this error "Undefined function 'execute' for input arguments of type 'cell'."
Perhaps I am going about it the wrong way, but my idea is to have a collection of times series, where I can call a variable such as daily.average_price and the result is a time series object for average price (with many stocks in that single object). The alternative is to have many different time series variables floating around, but I will have so many I am worried about getting confused as to what was updated when, etc.
I would appreciate any help. Also, any help as to what data structure is best to store these time series. THANKS!
Mike
0 个评论
采纳的回答
per isakson
2014-7-17
编辑:per isakson
2014-7-17
See Time Series Collections, Query and set tscollection object properties, plot tscollection objects
"[...] text variable, but then in order to access the data, I must do it with this text variable [...]" . See containers.Map class
2 个评论
per isakson
2014-7-17
编辑:per isakson
2014-7-17
Yes, in my world the financial time series object is a collections of time series.
I'm definitely not an expert in OOD and I do my OOD by trial and error. My first idea is
classdef my_stock_class < handle
properties
price % array of fints object
volume % array of fints object
lib % containers.Map object
end
methods
function foo( this, name )
price_obj = this.price( this.lib( name ) );
end
end
end
- persistent storage of data in some kind of database. Storage of objects in a mat-file is a possibility (technically). (HDF5 is my "hammer".)
- creation of an instance of my_stock_class my take some time
"called for example "data_7_17_2014", and would assign"   I doubt that is a good idea.
Saving data-objects in a mat-file may (/will) eventually lead to
- many objects with overlapping data
- need for documentation of stored objects
- needs for tools for merging and inspecting objects
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Price and Analyze Financial Instruments 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!