Re: How do I do this without database?

From: James Willmore (jwillmore_at_remove.adelphia.net)
Date: 10/19/03


Date: Sun, 19 Oct 2003 15:08:57 GMT

On Sun, 19 Oct 2003 04:11:32 GMT
"Public Interest" <ir@labranche.com> wrote:

> I am trying to scan stock price and volumes on a watch list. I have
> 1100 stocks on the list and I want to save them in a single file
> then use excel. Here is the format I want:
>
> symbol|price on day1|volume on day1|price on day2|price on day2|....
> IBM|98.02|203092|97.01|1212300
> SUNW|3.45|1112232|3.72|1212219
>
> I will scan the price and update add the new price and volume to the
> end of the line of each stock. The only thing I came up is to read
> the whole file in one array and add things to each element of the
> array then rewrite the whole array to the file. I know it is kind of
> breaking the RULE of not reading the whole file but only line by
> line. And it takes me 1 hours for scan all the data due to my
> dial-up connections. So I want to have something that I can start
> and pause then restart.But if I only read line by line, how do I
> append only to the end of the line not to the end of the file? It
> came back to the old question which is how to delete/modify lines in
> a text file.
>
> I am using active perl on windows.

You _could_ use DBD::CSV. In this case, the file could be treated as
a database. So, you could use SQL to manipulate the file. You _may_
not gain much as far as speed using this method.

If you're more interested in speed, use a RDBMS - such as MySQL,
PostgreSQL, etc.

You could also, since you're using Windows, M$ Access and use the
DBD::ODBC module to access the database. However, it's not an
efficent or portable solution.

Bottom line, IMHO, is give serious consideration to finding a way to
do this in a RDBMS.

HTH

-- 
Jim
Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.
a fortune quote ...
"We are on the verge: Today our program proved Fermat's
next-to-last theorem."   -- Epigrams in Programming, ACM SIGPLAN
Sept. 1982 


Relevant Pages

  • Re: Monthly Stock Return Volatility
    ... Did you enter the Stdev formula as an array? ... I've got a question for Biff. ... stocks' daily return for 6 year period. ... the monthly return volatility presented by standard deviation. ...
    (microsoft.public.excel.misc)
  • Re: How do I do this without database?
    ... > stocks on the list and I want to save them in a single file then use excel. ... > Here is the format I want: ... > I will scan the price and update add the new price and volume to the end of ... > in one array and add things to each element of the array then rewrite the ...
    (comp.lang.perl.misc)
  • Re: Very large database
    ... how do you define very large database? ... Or is it on the network? ... I asked it to return all stocks from a list of ... I have a basic understanding of normalization and it ...
    (microsoft.public.access.queries)
  • Re: sad, not free OODBMS that really works to use
    ... I was trying to make later changing of database easier. ... Design would be better for ... You can also insert Dictionaries, and that's when things start to get ... "Stocks" indexed by strings, and then the values of the dictionary are ...
    (comp.lang.smalltalk)
  • Re: Need design advice. Whats my best approach for storing this data?
    ... general number - assuming there are about 7000 listed stocks on the two ... They also have an API which allows you full access to the database ... Python for analysis. ...
    (comp.lang.python)