line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Deka import modul based on Union.pm |
4
|
|
|
|
|
|
|
# Version 2016-01-12 |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Finance::Quote::Deka; |
7
|
|
|
|
|
|
|
require 5.005; |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
2613
|
use strict; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
158
|
|
10
|
5
|
|
|
5
|
|
28
|
use LWP::UserAgent; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
67
|
|
11
|
5
|
|
|
5
|
|
115
|
use HTTP::Request::Common; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2777
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '1.58_01'; # TRIAL VERSION |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
0
|
22
|
sub methods { return (deka => \&deka); } |
16
|
5
|
|
|
5
|
0
|
22
|
sub labels { return (deka => [qw/exchange name date isodate price method/]); } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# ======================================================================= |
19
|
|
|
|
|
|
|
# The deka routine gets quotes of DEKA funds (Deka Investments) |
20
|
|
|
|
|
|
|
# On their website DEKA provides a csv file in the format |
21
|
|
|
|
|
|
|
# label1;label2;... |
22
|
|
|
|
|
|
|
# symbol1;name1;date1;date_before1;bid1;... |
23
|
|
|
|
|
|
|
# symbol2;name2;date2;date_before2,bid2,... |
24
|
|
|
|
|
|
|
# ... |
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# This subroutine was written by Andre Joost <andrejoost@gmx.de> |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Convert number separators to US values |
29
|
|
|
|
|
|
|
sub convert_price { |
30
|
0
|
|
|
0
|
0
|
|
$_ = shift; |
31
|
0
|
|
|
|
|
|
tr/.,/,./ ; |
32
|
0
|
|
|
|
|
|
return $_; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub deka |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
0
|
0
|
|
my $quoter = shift; |
38
|
0
|
|
|
|
|
|
my @funds = @_; |
39
|
0
|
0
|
|
|
|
|
return unless @funds; |
40
|
0
|
|
|
|
|
|
my $ua = $quoter->user_agent; |
41
|
0
|
|
|
|
|
|
my (%fundhash, @q, %info, $tempdate); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# create hash of all funds requested |
44
|
0
|
|
|
|
|
|
foreach my $fund (@funds) |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
|
|
|
$fundhash{$fund} = 0; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# get csv data |
50
|
0
|
|
|
|
|
|
my $response = $ua->request(GET &dekaurl); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
if ($response->is_success) |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# process csv data |
57
|
0
|
|
|
|
|
|
foreach (split('\015?\012',$response->content)) |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
# @q = $quoter->parse_csv($_) or next; |
60
|
0
|
0
|
|
|
|
|
@q = split(/;/) or next; |
61
|
0
|
0
|
|
|
|
|
next unless (defined $q[0]); |
62
|
0
|
0
|
|
|
|
|
if (exists $fundhash{$q[0]}) |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
|
|
|
$fundhash{$q[0]} = 1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$info{$q[0], "exchange"} = "DEKA"; |
68
|
0
|
|
|
|
|
|
$info{$q[0], "name"} = $q[1]; |
69
|
0
|
|
|
|
|
|
$info{$q[0], "symbol"} = $q[0]; |
70
|
0
|
|
|
|
|
|
$tempdate = $q[2]; |
71
|
0
|
|
|
|
|
|
$quoter->store_date(\%info, $q[0], {eurodate => $tempdate}); |
72
|
0
|
|
|
|
|
|
$info{$q[0], "price"} = convert_price($q[4]); |
73
|
0
|
|
|
|
|
|
$info{$q[0], "last"} = convert_price($q[4]); |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$info{$q[0], "method"} = "deka"; |
76
|
0
|
|
|
|
|
|
$info{$q[0], "currency"} = $q[8]; |
77
|
0
|
|
|
|
|
|
$info{$q[0], "success"} = 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# check to make sure a value was returned for every fund requested |
82
|
0
|
|
|
|
|
|
foreach my $fund (keys %fundhash) |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
0
|
|
|
|
|
if ($fundhash{$fund} == 0) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
|
|
|
$info{$fund, "success"} = 0; |
87
|
0
|
|
|
|
|
|
$info{$fund, "errormsg"} = "No data returned"; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else |
92
|
|
|
|
|
|
|
{ |
93
|
0
|
|
|
|
|
|
foreach my $fund (@funds) |
94
|
|
|
|
|
|
|
{ |
95
|
0
|
|
|
|
|
|
$info{$fund, "success"} = 0; |
96
|
0
|
|
|
|
|
|
$info{$fund, "errormsg"} = "HTTP error"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
return wantarray() ? %info : \%info; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# DEKA provides a csv file named fondspreise.csv containing the prices of all |
104
|
|
|
|
|
|
|
# their funds for the most recent business day. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub dekaurl |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
0
|
0
|
|
return "https://www.deka.de/privatkunden/pflichtseiten/fondspreise?service=fondspreislisteExportController&action=exportCsv&typ=inVertrieb"; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 NAME |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Finance::Quote::Deka - Obtain quotes from DEKA (Wertpapierhaus der Sparkassen). |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SYNOPSIS |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
use Finance::Quote; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$q = Finance::Quote->new; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
%stockinfo = $q->fetch("deka","DE0008474503"); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 DESCRIPTION |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This module obtains information about DEKA managed funds. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Information returned by this module is governed by DEKA's terms |
130
|
|
|
|
|
|
|
and conditions. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 LABELS RETURNED |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The following labels may be returned by Finance::Quote::DEKA: |
135
|
|
|
|
|
|
|
exchange, name, date, price, last. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 SEE ALSO |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
DEKA (Deka Investments), http://www.deka.de/ |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |