renamed to yahooJSON
# since it gets a lot of quotes besides Indian
#
# The code has been modified by Abhijit K to
# retrieve stock information from Yahoo Finance through json calls
#
# Th
e strict;
use warnings;
use constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use JSON;
our $VERSION = '1.67_01'; # TRIAL VERSION
sub parameters {
return ('API_KEY');
}
sub new
{
$reply->content;
my $json_data = JSON::decode_json $body;
if ( !$json_data || $json_data->{error} || not exists $json_data->{rates}) {
### fixer error : $json_data->{error}->{info}
return;
}
$this->{cache} = $json_data->{rates};
### Fixer rates: $this->{cache}
}
if (exists $this->{cache}->{$from} and exists $this->{cache}->{$to}) {
### from : $from, $th
ockData;
use strict;
use warnings;
use Encode qw(decode);
use HTTP::Request::Common;
use JSON qw(decode_json);
use constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments', '###';
our $VERSI
eval {$quote = JSON::decode_json $body};
if ($@) {
$info{ $stock, 'success' } = 0;
$info{ $stock, 'errormsg' } = $@;
next;
}
### [<now>] JSON quote: $quote
e strict;
use warnings;
use constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use JSON;
our $VERSION = '1.67_01'; # TRIAL VERSION
sub parameters {
return ('API_KEY');
}
sub new
{
.json?app_id=$this->{API_KEY}";
my $reply = $ua->get($url);
return unless ($reply->code == 200);
my $body = $reply->content;
my $json_data = JSON::decode_json $body;
if ( !$json
_data || $json_data->{error} || not exists $json_data->{rates}) {
### OpenExchange error : $json_data->{description}
return;
}
$this->{cache} = $json_data->{rates};
### OpenEx
BUG => $ENV{DEBUG};
use constant TESTING => $ENV{TESTING};
use if DEBUG, 'Smart::Comments';
use JSON;
our $VERSION = '1.67_01'; # TRIAL VERSION
sub parameters {
return ('API_KEY');
}
sub new
{
body: $body
return unless ($reply_code == 200);
my $json_data = decode_json ($body);
if ( !$json_data->{'rates'}->{$from} || !$json_data->{'rates'}->{$to} ) {
return;
}
# We really
es base: $json_data->{"base"}
### from: $to
### to: $json_data->{"base"}
### rate: ($json_data->{'rates'}->{${to}})
### from: $json_data->{"base"}
### to: $from
### rate: ($json_data->{'
package Finance::Quote::CurrencyRates::YahooJSON;
use strict;
use warnings;
use constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use JSON;
our $VERSION = '1.67_01'; # TRIAL VERSION
his, $class;
my $args = shift;
### YahooJSON->new args : $args
return $this;
}
sub multipliers
{
my ($this, $ua, $from, $to) = @_;
my $json_data;
my $rate;
my $reply = $ua->get($YIN
$json_data = JSON::decode_json $body;
### JSON: $json_data
if ( !$json_data || !$json_data->{'chart'}->{'result'}->[0]->{'meta'}->{'regularMarketPrice'} ) {
return;
}
$rate =
$json_
ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use LWP::UserAgent;
use Text::Template;
use JSON qw( decode_json );
our $VERSION = '1.67_01'; # TRIAL VERSION
our $DISPLAY = 'ASEGR - Athens Exchang
strument}/inbroker');
my @instruments = qw/stocks bonds etfs lending derivatives indices/;
my ( %jsondata, %info );
sub methodinfo {
return (
asegr => $METHODHASH,
greece => $METHODHASH,
b methods {
my %m = methodinfo();
return map {$_ => $m{$_}{subroutine} } keys %m;
}
# Since %jsondata and %info are global to this module
# pass in the instrument and symbol to search for the dat
omments';
use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::TableExtract;
use Encode;
use JSON;
use Web::Scraper;
our $VERSION = '1.65'; # VERSION
my $BAMOSZ_MAINURL = "http://www.bamosz.hu/
ed to find JSON data" unless $response->content =~ m|window[.]dataSourceResults=([{].+[}])</script>|;
my $json = decode_json $1;
### json : $json
### keys : keys %{$json}
my
grep {/CompanyProfileDataSource;table=left/} keys %{$json};
die "Failed to process JSON" unless @profile_key == 1;
my $profile = $json->{$profile_key[0]};
### profile : $profile
e strict;
use warnings;
use constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use JSON;
use Web::Scraper;
our $VERSION = '1.64_03'; # TRIAL VERSION
sub methods {
return (aufunds =>
200;
my $json_data = JSON::decode_json $reply->content;
### MorningstarAU lookup: $json_data
die "Failed to find unique APIR $symbol" unless $json_data and $json_data->{hits}->{
total} == 1;
my $id = $json_data->{hits}->{hits}[0]->{_source}->{Symbol};
### MorningstarAU input: $symbol
### MorningstarAU id : $id
my $url = "https://www.morningsta
se Encode qw( encode_utf8 );
use HTTP::Request::Common;
use HTML::TreeBuilder::XPath;
use JSON qw( decode_json );
use LWP::Protocol::http;
use Text::Template;
use HTTP::Cookies;
use URI::Escape;
use
=> $ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use constant URLTAG => "data-url";
use constant JSONBODY => "body";
our $VERSION = '1.67_01'; # TRIAL VERSION
# Fix for 500 Header line too long mes
>decoded_content);
$script_tag = $tree->look_down(_tag => 'script', type => 'application/json', URLTAG, qr!https://query1.finance.yahoo.com/v7/finance/quote\?fields=fiftyTwoWeekHigh.*! );
constant DEBUG => $ENV{DEBUG};
use if DEBUG, 'Smart::Comments';
use LWP::UserAgent;
use JSON qw( decode_json );
use String::Util qw(trim);
our $VERSION = '1.67_01'; # TRIAL VERSION
our $DISPLAY =
charset=UTF-8',
};
my $reply = $ua->post($url, $form);
my $search = JSON::decode_json $reply->content;
### Search : $url, $form, $reply->code
### Search : $sea
BUG};
use if $DEBUG, 'Smart::Comments';
use HTTP::Request;
use LWP::UserAgent;
use JSON qw( decode_json encode_json );
use String::Util qw(trim);
our $VERSION = '1.67_01'; # TRIAL VERSION
our @labe
"authorization" => "",
"content-type" => "application/json",
"locale" => "en",
"sec-ch-ua" => "\"
h : $url, $reply->code
### reply : $reply->content
my $data = decode_json $reply->content;
if (exists $data->{errors}) {
$info{$symbol, 'errormsg'} = $da
:Comments';
use HTTP::Request::Common;
use HTML::TreeBuilder;
use Encode qw(decode);
use JSON qw( decode_json );
use utf8;
our $VERSION = '1.67_01'; # TRIAL VERSION
my $Bourso_URL = 'https://www.bo
my $json = JSON::decode_json($div->attr('data-ist-init'));
$date = $json->{'tradeDate'};
$last = $json->{'last'};
$symbol = $json->{'symbol'
= $json->{'low'};
$high = $json->{'high'};
$close = $json->{'previousClose'};
$exchange = $json->{'exchangeCode'};
$volume = $json->{'
';
use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Cookies;
use JSON qw(decode_json);
use Text::Template;
our $VERSION = '1.67_01'; # TRIAL VERSION
$MSTARCH_MAIN_URL =
next;
}
$webdoc = $response->content;
### [<now>] 2nd Webdoc: $webdoc
my $json;
eval {$json = decode_json $webdoc};
if ($@) {
# serious error, report it and give up
ecode JSON";
next;
}
### [<now>] JSON: $json
# Find date, currency and price all in one table row
my ($date, $time);
my $currency = $json->{'currency'};
my $price = $json->{'na