finance-quote / finance-quote

Finance::Quote module for Perl
http://finance-quote.sourceforge.net/
131 stars 114 forks source link

Finance::Quote->fetch( dont work on me #412

Closed arnold-b closed 3 months ago

arnold-b commented 3 months ago

does anyone have a hint for me ? i have no idear, also none of the samples working. version Reading '/root/.cpan/Metadata' Database was generated on Thu, 25 Jul 2024 06:17:02 GMT Finance::Quote is up to date (1.62).

use Finance::Quote; use Data::Dumper;

$q = Finance::Quote->new; %info = Finance::Quote->fetch("onvista","ml"); print Dumper(\%info);


Sample 2 also problem use Finance::Quote; use Data::Dumper;

$q = Finance::Quote->new(); %info1 = Finance::Quote->fetch('comdirect', 'DE0007664039'); %info2 = Finance::Quote->fetch('comdirect', 'Volkswagen'); %info3 = Finance::Quote->fetch('comdirect', 'VWAGY');

print Dumper(\%info1); print Dumper(\%info2); print Dumper(\%info3);

i always get the same problem

error: Undefined fetch-method finance::quote passed to Finance::Quote::fetch at p1.pl line 5. print from qoutes.pm line 1746 push (@{$METHODS{$method}}, { name => $module, modpath => $modpath, function => $methodhash{$method}, labels => $labelhash{$method}, currency_fields => \@currency_fields});

$VAR1 = { 'modpath' => 'Finance::Quote::OnVista', 'function' => sub { "DUMMY" }, 'labels' => [ 'name', 'last', 'date', 'isodate', 'time', 'currency', 'method', 'exchange' ], 'name' => 'OnVista', 'currency_fields' => [ 'last', 'high', 'low', 'net', 'bid', 'ask', 'close', 'open', 'day_range', 'year_range', 'eps', 'div', 'cap', 'nav', 'price' ] }; use Finance::Quote;

$q = Finance::Quote->new;

%info = Finance::Quote->fetch('comdirect', 'DE0007664039'); %info = Finance::Quote->fetch('comdirect', 'Volkswagen'); %info = Finance::Quote->fetch('comdirect', 'VWAGY');

bpschuck commented 3 months ago

F::Q issues is not the forum for debugging Perl code. I suggest you look at the stockdump.pl script in the Examples directory for a guide on how to use the Data::Dumper module. Post to the Sourceforge finance-quote-user email list for general "How to?" questions.

On a related note, the comdirect and onvista methods are likely no longer working due to changes in the web pages being scraped and will probably be dropped from future releases of F::Q.