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!