/usr/share/perl5/Finance/Quote/SEB.pm is in libfinance-quote-perl 1.18-2.
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 | # Copyright (C) 1998, Dj Padzensky <djpadz@padz.net>
# Copyright (C) 1998, 1999 Linas Vepstas <linas@linas.org>
# Copyright (C) 2000, Yannick LE NY <y-le-ny@ifrance.com>
# Copyright (C) 2000, Paul Fenwick <pjf@cpan.org>
# Copyright (C) 2000, Brent Neal <brentn@users.sourceforge.net>
# Copyright (C) 2000, Keith Refson <Keith.Refson@earth.ox.ac.uk>
# Copyright (C) 2003, Tomas Carlsson <tc@tompa.nu>
#
# 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
#
#
# This code was derived from the work on the packages Finance::Yahoo::*
#
package Finance::Quote::SEB;
require 5.004;
use strict;
use vars qw($VERSION $SEB_FUNDS_URL);
use LWP::UserAgent;
use HTTP::Request::Common;
use utf8;
$VERSION = '1.18';
$SEB_FUNDS_URL = 'http://taz.vv.sebank.se/cgi-bin/pts3/pow/fmk/2100/Senaste_fondkurserna.TXT';
sub methods { return (seb_funds => \&seb_funds); }
{
my @labels = qw/date isodate method source name currency price/;
sub labels { return (seb_funds => \@labels); }
}
sub seb_funds {
my $quoter = shift;
my @symbols = @_;
return unless @symbols;
my ($ua, $reply, $url, %funds);
$url = $SEB_FUNDS_URL;
$ua = $quoter->user_agent;
$reply = $ua->request(GET $url);
unless ($reply->is_success) {
foreach my $symbol (@symbols) {
$funds{$symbol, "success"} = 0;
$funds{$symbol, "errormsg"} = "HTTP failure";
}
return wantarray ? %funds : \%funds;
}
foreach my $line (split /\n/, $reply->content) {
chomp($line);
# Format:
# 2003-08-11;SEB Aktiesparfond;5,605;387
my ($date, $name, $price, $hmm) = split ';', $line;
utf8::encode($name);
if (grep {$_ eq $name} @symbols) {
$price =~ s/,/\./; # change decimal point from , to .
$funds{$name, 'symbol'} = $name;
$quoter->store_date(\%funds, $name, {isodate => $date});
$funds{$name, 'method'} = 'seb_funds';
$funds{$name, 'source'} = 'Finance::Quote::SEB';
$funds{$name, 'name'} = $name;
$funds{$name, 'currency'} = 'SEK';
$funds{$name, 'price'} = $price;
$funds{$name, 'success'} = 1;
}
}
# Check for undefined symbols
foreach my $symbol (@symbols) {
unless ($funds{$symbol, 'success'}) {
$funds{$symbol, "success"} = 0;
$funds{$symbol, "errormsg"} = "Fund name not found";
}
}
return %funds if wantarray;
return \%funds;
}
1;
=head1 NAME
Finance::Quote::SEB - Obtain fund prices from www.seb.se
=head1 SYNOPSIS
use Finance::Quote;
$q = Finance::Quote->new;
%fundinfo = $q->fetch("seb_funds","fund name");
=head1 DESCRIPTION
This module obtains information about SEB fund prices from
www.seb.se. The only available information source is "seb_funds"
and it will use www.seb.se.
=head1 FUND NAMES
Unfortunately there is no unique identifier for the fund names.
Therefore the complete fund name must be given, including spaces, case
is important.
Consult http://www.seb.se/
for all available funds.
Example "SEB Aktiesparfond"
=head1 LABELS RETURNED
Information available from SEB may include the following labels:
date method source name currency price. The prices are updated at the
end of each bank day.
=head1 SEE ALSO
SEB website - http://www.seb.se/
=cut
|