CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Building a time series from multiple files

 



sean.snv
New User

Oct 14, 2010, 9:03 AM

Post #1 of 2 (740 views)
Building a time series from multiple files Can't Post

Hello All,

I have a series of dated files (each file is associated with a specific date). Every file has a 2 columns, the first is a stock identifier and the second is an attribute value (e.g. price). I am looking for an efficient way to build a time series for a particular stock spanning a specific date range. The way I have done it already is to open each file that has a date within the specified range and read through line by line until I reach the specified stock identifier, read the attribute, move on to the next file. The question is: Is there a better way to do this in perl?

thanks in advance.


BillKSmith
Veteran

Oct 15, 2010, 6:40 AM

Post #2 of 2 (722 views)
Re: [sean.snv] Building a time series from multiple files [In reply to] Can't Post

I cannot think of a better way to extract the data from the files you describe. Of course, you should read the data for all the stocks you are interested in while you have a file open. If you must generate many reports on one stock, it would help to write a new file which contains dates and attributes for that stock. Each time you get new data, you would extract the data for your stock and append an entry to your stock file. You would use only the new file to generate reports.

Your choice of date format in the new single stock file could make a huge difference. Formats such as epoc seconds or yyyymmdd would allow you to read a range of entries with the range operator. Other formats could reduce format conversions. The choice depends on the size of the files and the frequency of their use.
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives