/usr/share/perl5/Finance/Quote/Deka.pm is in libfinance-quote-perl 1.47-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 | #!/usr/bin/perl -w
#
# Deka import modul based on Union.pm
# Version 2016-01-12
package Finance::Quote::Deka;
require 5.005;
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
our $VERSION = '1.47'; # VERSION
sub methods { return (deka => \&deka); }
sub labels { return (deka => [qw/exchange name date isodate price method/]); }
# =======================================================================
# The deka routine gets quotes of DEKA funds (Deka Investments)
# On their website DEKA provides a csv file in the format
# label1;label2;...
# symbol1;name1;date1;date_before1;bid1;...
# symbol2;name2;date2;date_before2,bid2,...
# ...
#
# This subroutine was written by Andre Joost <andrejoost@gmx.de>
# Convert number separators to US values
sub convert_price {
$_ = shift;
tr/.,/,./ ;
return $_;
}
sub deka
{
my $quoter = shift;
my @funds = @_;
return unless @funds;
my $ua = $quoter->user_agent;
my (%fundhash, @q, %info, $tempdate);
# create hash of all funds requested
foreach my $fund (@funds)
{
$fundhash{$fund} = 0;
}
# get csv data
my $response = $ua->request(GET &dekaurl);
if ($response->is_success)
{
# process csv data
foreach (split('\015?\012',$response->content))
{
# @q = $quoter->parse_csv($_) or next;
@q = split(/;/) or next;
next unless (defined $q[0]);
if (exists $fundhash{$q[0]})
{
$fundhash{$q[0]} = 1;
$info{$q[0], "exchange"} = "DEKA";
$info{$q[0], "name"} = $q[1];
$info{$q[0], "symbol"} = $q[0];
$tempdate = $q[2];
$quoter->store_date(\%info, $q[0], {eurodate => $tempdate});
$info{$q[0], "price"} = convert_price($q[4]);
$info{$q[0], "last"} = convert_price($q[4]);
$info{$q[0], "method"} = "deka";
$info{$q[0], "currency"} = $q[12];
$info{$q[0], "success"} = 1;
}
}
# check to make sure a value was returned for every fund requested
foreach my $fund (keys %fundhash)
{
if ($fundhash{$fund} == 0)
{
$info{$fund, "success"} = 0;
$info{$fund, "errormsg"} = "No data returned";
}
}
}
else
{
foreach my $fund (@funds)
{
$info{$fund, "success"} = 0;
$info{$fund, "errormsg"} = "HTTP error";
}
}
return wantarray() ? %info : \%info;
}
# DEKA provides a csv file named fondspreise.csv containing the prices of all
# their funds for the most recent business day.
sub dekaurl
{
return "https://www.deka.de/privatkunden/pflichtseiten/fondspreise?service=fondspreislisteExportController&action=exportCsv&typ=inVertrieb";
}
1;
=head1 NAME
Finance::Quote::Deka - Obtain quotes from DEKA (Wertpapierhaus der Sparkassen).
=head1 SYNOPSIS
use Finance::Quote;
$q = Finance::Quote->new;
%stockinfo = $q->fetch("deka","DE0008474503");
=head1 DESCRIPTION
This module obtains information about DEKA managed funds.
Information returned by this module is governed by DEKA's terms
and conditions.
=head1 LABELS RETURNED
The following labels may be returned by Finance::Quote::DEKA:
exchange, name, date, price, last.
=head1 SEE ALSO
DEKA (Deka Investments), http://www.deka.de/
=cut
|