After browsing through a couple of other people's CUFP
i've found that this LWP::Simple type thing isn't
actually to original but at the same time, i'm pretty
proud of it
both because it's short and reasonably elegant (but TSE
specific, i don't know how easy it is to generalize)
I wrote it for my dad cause i think it will save hime
HOURS of time looking up stuff on the internet and give
hime the extra time he needs to do the analysis
he didn't want to use an online profile system because
he dosen't want other people to know what his stock
picks look like :)
one thing i would like help with is compiling the code
into an EXE for windows. I've looked at the thread
Compiling Code? and others but cannot make perl2exe OR
perlcc work properly (problems with either the use
LWP::Simple, or perlCC working at ALL)
i'm at the point where i'd just about rather be 'given
the fish' (if you get the reference)
here's the code for those who're interesed . . . note
the REGEX instead of HTML::Parser (yes Dave i knew
you'd be upset with that but ends and means
donchaknow ;)
the regex is actually code re-use i think it was the
strip html tags thread
#!f:\perl\bin\perl #note that strict is commented out, [jjhorner] i'm sure #you'll love that ;) #use strict; use LWP::Simple; my ($webpage,$TickerSymbol,$value,$junk,@wpArray,$counter,$results,%re +sults); my @fields = ("TickerSymbol","LastTraded","NetChange","Open","Low","Hi +gh","Volume","LastBidSize","LastBidPrice","LastAskSize","LastAskPrice +","#ofSharesOutstanding","Rolling52WeekHigh","Rolling52WeekLow","Quot +edMarketValue","DividendTimingIndicator","Earnings/Share(trailing12mo +nths)","DividendYield"); # ts file is a one-per line list of the TSE ticker symbols # that the user wants in their output # the file is terminated on each line with a comma # to keep the ticker symbol clean open tsFILE, "<ts.txt" or die "Couldn't open: $!"; foreach $value (@fields) { print "$value\t" } print "\n"; while (<tsFILE>) { ($TickerSymbol,$junk) = split/,/; $webpage= get "http://www.tse.com/cgi-bin/clan_quote?securityType= +TSE-EQUITY&qoteQuery=" . $TickerSymbol; $webpage =~ s/ //g; $webpage =~ s/<[^>]*?>//g; $webpage =~ s/ //g; @wpArray = split (/\n/,$webpage); $counter = 0; foreach $value (@wpArray) { $results{$value} = $wpArray[++$counter]; } $results{"TickerSymbol"} = $TickerSymbol; foreach my $key (@fields) { print "$results{$key}\t"; } print "\n"; }
anyways, i'm very happy with it as i started writing it
last night and it was a lot easier than i though it
would be.
If anyone can turn it into a windows98 EXE for me i
would be eternally in your debt . . . as i said, it's
intended as a gift for my father and has to be
standalone
it could bloat from 30K to 1.5 Megs and i wouldn't mind
so long as it worked as an EXE
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Stock Market Tracker (TSE)
by a (Friar) on Jan 16, 2001 at 08:45 UTC | |
by Anonymous Monk on Jan 17, 2001 at 05:52 UTC | |
Re: Stock Market Tracker (TSE)
by myocom (Deacon) on Jan 16, 2001 at 00:50 UTC | |
Re: Stock Market Tracker (TSE)
by wee (Scribe) on Jan 25, 2001 at 06:39 UTC |