DKB: convert price to english number formal; small changes; now works in Gnucash

This commit is contained in:
Matthias Merz 2016-06-07 22:57:06 +02:00
parent cea3bbc917
commit c748976007

View File

@ -44,8 +44,10 @@ my %wknmap = (
sub methods {return ('dkb' => \&dkb,
'europe' => \&dkb);}
sub labels { return (dkb=>[qw/name date price currency/]); }
{
my @labels = ('name', 'date', 'price', 'last', 'currency');
sub labels { return (dkb => \@labels, europe => \@labels); }
}
sub get_stock_url {
@ -93,7 +95,11 @@ sub dkb
my $pricestr = $prices[0]->as_text;
my @splitvals = ( $pricestr =~ /((\d|,|\.)*)\s*/g);
if (@splitvals) {
$info{$stock,'price'} = $splitvals[0];
my $converted_price = $splitvals[0];
$converted_price =~ s/\.//g;
$converted_price =~ s/,/./g;
$info{$stock,'price'} = $converted_price;
$info{$stock,'last'} = $converted_price;
if ($pricestr =~ /EUR/) {
$info{$stock,'currency'} = 'EUR';
}
@ -104,7 +110,7 @@ sub dkb
#$info{$stock,'date'} = $dates[0]->as_text;
$quoter->store_date(\%info, $stock, {eurodate => $dates[0]->as_text});
};
#$info{$stock,'last'} = '18.70';
$info{$stock,'timezone'} = 'Europe/Berlin';
#$info{$stock,'currency'} = 'EUR';
}
}