/usr/share/perl5/Finance/Quote/ASEGR.pm is in libfinance-quote-perl 1.38-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | #!/usr/bin/perl -w
# This modules is based on the Finance::Quote::AEX module
#
# The code has been modified by Morten Cools <morten@cools.no> to be able to
# retrieve stock information from the Athens Exchange in Greece.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA
require 5.005;
use strict;
package Finance::Quote::ASEGR;
use vars qw( $ASEGR_URL);
use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::TableExtract;
our $VERSION = '1.38'; # VERSION
my $ASEGR_URL = 'http://www.ase.gr/content/en/MarketData/Stocks/Prices/Share_SearchResults.asp?';
sub methods { return ( greece => \&asegr,
asegr => \&asegr,
europe => \&asegr); }
{
my @labels = qw/name last date isodate p_change open high low close volume currency method exchange/;
sub labels { return (greece => \@labels,
asegr => \@labels,
europe => \@labels); }
}
sub asegr {
my $quoter = shift;
my @stocks = @_;
my (%info,$reply,$url,$te);
my $ua = $quoter->user_agent();
$url=$ASEGR_URL;
foreach my $stocks (@stocks)
{
$reply = $ua->request(GET $url.join('',"share=",$stocks));
if ($reply->is_success)
{
$te= new HTML::TableExtract( headers =>
[("Date","Price","\%Change","Volume","Max","Min","Value","Trades","Open")]);
$te->parse($reply->content);
unless ( $te->tables)
{
$info {$stocks,"success"} = 0;
$info {$stocks,"errormsg"} = "Stock name $stocks not found";
next;
}
my @rows;
unless (@rows = $te->rows)
{
$info {$stocks,"success"} = 0;
$info {$stocks,"errormsg"} = "Parse error";
next;
}
$info{$stocks, "success"}=1;
$info{$stocks, "exchange"}="Athens Stock Exchange";
$info{$stocks, "method"}="asegr";
$info{$stocks, "name"}=$stocks;
($info{$stocks, "last"}=$rows[0][1]) =~ s/\s*//g;
($info{$stocks, "close"}=$rows[1][1]) =~ s/\s*//g;
($info{$stocks, "p_change"}=$rows[0][2]) =~ s/\s*//g;
($info{$stocks, "volume"}=$rows[0][3]) =~ s/\s*//g;
($info{$stocks, "high"}=$rows[0][4]) =~ s/\s*//g;
($info{$stocks, "low"}=$rows[0][5]) =~ s/\s*//g;
($info{$stocks, "nav"}=$rows[0][6]) =~ s/\s*//g;
($info{$stocks, "open"}=$rows[0][8]) =~ s/\s*//g;
$quoter->store_date(\%info, $stocks, {eurodate => $rows[0][0]});
$info{$stocks,"currency"}="EUR";
} else {
$info{$stocks, "success"}=0;
$info{$stocks, "errormsg"}="Error retreiving $stocks ";
}
}
return wantarray() ? %info : \%info;
return \%info;
}
1;
=head1 NAME
Finance::Quote::ASEGR - Obtain quotes from Athens Stock Exchange.
=head1 SYNOPSIS
use Finance::Quote;
$q = Finance::Quote->new;
%info = Finance::Quote->fetch("asegr","minoa"); # Only query ASEGR
%info = Finance::Quote->fetch("greece","aaak"); # Failover to other sources OK.
=head1 DESCRIPTION
This module fetches information from the "Athens Stock Exchange",
http://www.ase.gr. All stocks are available.
This module is loaded by default on a Finance::Quote object. It's
also possible to load it explicity by placing "ASEGR" in the argument
list to Finance::Quote->new().
This module provides both the "asegr" and "greece" fetch methods.
Please use the "greece" fetch method if you wish to have failover
with future sources for Greek stocks. Using the "asegr" method
will guarantee that your information only comes from the Athens Stock Exchange.
Information obtained by this module may be covered by www.ase.gr
terms and conditions See http://www.ase.gr/ for details.
=head1 LABELS RETURNED
The following labels may be returned by Finance::Quote::ASEGR :
name, last, date, p_change, open, high, low, close,
volume, currency, method, exchange.
=head1 SEE ALSO
Athens Stock Exchange, http://www.ase.gr
=cut
|