This script parses a web page and prints out all of the coordinates for tables found. This should make your life easier as far as determining the location of the table you are looking to parse.
#!c:\perl\bin\perl.exe
use LWP::Simple;
use LWP::UserAgent;
use HTML::TableExtract;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my $url = “http://www.drudgereport.com/”;
my $capture = get($url);
$depth = 0;
$count = 0;
while ($depth <= 10) {
DoLoop();
$depth++;
}
sub DoLoop {
for ($i = 0; $i <= 10; $i++)
{
$te = HTML::TableExtract->new( depth => “$depth”, count => $i );
$te->parse($capture);
my $table = $te->first_table_found;
foreach my $ts ($te->tables)
{
print “Table found at “, join(’,', $ts->coords), “:\n”;
foreach $row ($ts->rows) {
$x = 0;
print join(’,', @$row), “\n”;
This is a very simple script which gets yahoo economic events from the yahoo finance website and converts it to XML.
#!c:\perl\bin\perl.exe
use LWP::Simple;
use LWP::UserAgent;
use HTML::TableExtract;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my $url = “http://biz.yahoo.com/c/e.html”;
my $capture = get($url);
#http://www.treasurydirect.gov/xml/PendingAuctions.xml
print $cgi->header(-type => ‘application/xml’); # make browser expect xml
This script parses yahoo finance an pulls the Industry and sector for any ticker symbol you pass it. I used it to create a stock screener I am working on. Hope it becomes useful for you.
#!c:\perl\bin\perl.exe
use LWP::Simple;
use LWP::UserAgent;
use HTML::TableExtract;
if ($#ARGV != 0) {
print “$#ARGV usage: need to pass in a symbol\n”;
exit;
}
$sym = $ARGV[0];
my $url = “http://finance.yahoo.com/q/in?s=$sym”;
my $capture = get($url);
I have been a moderate investor in Dividend Reinvestment Plans. aka (DRIPS) If you are not sure what that is, check out http://www.fool.com/school/drips.htm as they do a pretty good job explaining it.
But basically it allows investors to buy shares of a particular equity on a periodic basis (bi-weekly, monthly,quarterly etc). Dividends on that equitiy are automatically reinvested when they are distributed, thus buying fractional shares of the company.
I have not found a tool out there that really tracks how a stock + dividend reinvestment performs over time. So I wrote this little tool to track it. You can find it at http://www.gregjessup.com/DRIP If you know of something similar, please post a comment with the link. If you think my math is wrong, also post a comment and challenge me.
If you want to see some changes made to it, send me an email. I’ll have a look and try to post a change.
Happy DRIPing!
By the way..This is by no means guaranteed to be accurate. Although I use the tool myself, and trust my work…it is not investment advice. Use it at your own risk. Persons seeking investment advice should consult a financial professional. Data not guaranteed to be accurate.
I haven’t seen this very well and clearly documented, as far as passing parameters go. Here is a simple create user proc.
DELIMITER $$
DROP PROCEDURE IF EXISTS `portfoliomanager`.`createNewUser` $$
CREATE PROCEDURE `portfoliomanager`.`createNewUser` (IN username varchar(45),IN pass varchar(45))
BEGIN
INSERT INTO portfoliomanager.users (email,password) VALUES(username,pass);
END $$