view release on metacpan or search on metacpan
'all-status' => $set_output, # undocumented
'lwp-debug' => sub {
require LWP::Debug;
LWP::Debug::level('+');
},
)
or exit 1;
}
# $filename is in filesystem charset bytes.
#
# The file should end with some non-undef value, since otherwise it's
# indistinguishable from undef for the various do/require errors.
#
sub initfile {
my ($filename) = @_;
if (! -e $filename) { return; }
$! = 0;
my $ret = do $filename;
if (! defined $ret) {
devel/weblinks-samples.pl view on Meta::CPAN
use strict;
use warnings;
use App::Chart::Weblink;
my %attempted_urls;
print <<'HERE';
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
HERE
my $errors = '';
sub attempt {
my @symbol_list = @_;
my $langs = [ undef ];
doc/chart.texi view on Meta::CPAN
@c @ifinfo
@c @sp 1
@c @end ifinfo
@section Locale Selection
@cindex Locale selection
@cindex Language
@cindex @env{LANG}
On a typical Unix/POSIX-style system the locale is selected with the
@env{LANG} environment variable, set to a language code and optional territory
and charset. For example US English,
@example
LANG=en_US
export LANG
@end example
This is often set by the system administrator, but you can do it yourself in
your @file{~/.profile} (@pxref{Bash Startup Files,,, bashref, Bash Features}).
@cindex Language codes
emacs/chartprog-devel.el view on Meta::CPAN
(put 'program-version-proc 'scheme-indent-function 1)
(put 'sensitive-preferences 'scheme-indent-function 1)
(put 'sensitive-series 'scheme-indent-function 1)
(put 'sockpool-call 'scheme-indent-function 1)
(put 'symbol-exchange-url! 'scheme-indent-function 1)
(put 'weblink-handler! 'scheme-indent-function 1)
(put 'yahoo-quote-delay! 'scheme-indent-function 1)
;;-----------------------------------------------------------------------------
;; bogus mime charsets in some html seen
;; for html-coding.el
(eval-after-load "mm-util"
'(progn
;; CME pages (old stuff, might be all utf-8 now)
(add-to-list 'mm-charset-synonym-alist '(iso8859-1 . iso-8859-1))
;; TGE disclaimer.e.html (though no actual jp chars)
(add-to-list 'mm-charset-synonym-alist '(x-euc-jp . euc-jp))
;; Fukuoka (which is defunct) historical.html
(add-to-list 'mm-charset-synonym-alist '(x-sjis . shift_jis))))
(when (fboundp 'define-coding-system-alias) ;; emacs 22 or xemacs
(define-coding-system-alias 'iso8859-1 'iso-8859-1)
(define-coding-system-alias 'x-euc-jp 'euc-jp)
(define-coding-system-alias 'x-sjis 'shift_jis))
(provide 'chartprog-devel)
;;; chartprog-devel.el ends here
lib/App/Chart.pm view on Meta::CPAN
\&Locale::Messages::turn_utf_8_on);
}
# sub chart_gettext_filter {
# my ($str) = @_;
# Locale::Messages::turn_utf_8_on ($str);
# $str =~ s/^CONTEXT\(.*?\): *//;
# return $str;
# }
# Return the user's ~/Chart directory, as an absolute path in filesystem
# charset encoding.
# Note not using Glib::get_home_dir() here, since it wrongly prefers
# /etc/passwd file over $HOME.
use constant::defer chart_directory => sub {
if (defined $ENV{'CHART_DIRECTORY'}) {
return $ENV{'CHART_DIRECTORY'}
} else {
require File::HomeDir;
my $home = File::HomeDir->my_home
// die "No home directory can be found by File::HomeDir\n";
return File::Spec->catdir($home, 'Chart');
lib/App/Chart.pm view on Meta::CPAN
}
#------------------------------------------------------------------------------
# App::Chart::datafilename ($filename)
# App::Chart::datafilename ($dir,...,$dir, $filename)
#
# Return an absolute path like /usr/share/perl5/App/Chart/$filename,
# wherever App/Chart/$filename is found in @INC. $dir arguments specify a
# subdirectory like App/Chart/$dir1/$dir2/$filename. All args and the
# return are in filesystem charset bytes.
#
# Module::Find and Module::Util have similar @INC searches, but only for .pm
# files it seems.
#
sub datafilename {
foreach my $inc (@INC) {
my $filename = File::Spec->catfile ($inc, 'App', 'Chart', @_);
if (-e $filename) { return $filename; }
}
require File::Basename;
lib/App/Chart/DBI.pm view on Meta::CPAN
use App::Chart;
# uncomment this to run the ### lines
#use Smart::Comments;
# See Database/Create.pm for revisions
use constant DATABASE_SCHEMA_VERSION => 2;
# return the database filename ~/Chart/database.sqdb or the notes database
# filename ~/Chart/notes.sqdb, as absolute path in filesystem charset bytes
use constant::defer database_filename => sub {
return File::Spec->catfile (App::Chart::chart_directory(), 'database.sqdb');
};
use constant::defer notes_filename => sub {
return File::Spec->catfile(App::Chart::chart_directory(), 'notes.sqdb');
};
use Class::Singleton 1.4;
use base 'Class::Singleton';
our $_instance;
lib/App/Chart/Database/Create.pm view on Meta::CPAN
App::Chart::Download::consider_latest_from_daily
([ App::Chart::Database->symbols_list() ]);
}
sub _upgrade_1_to_2 {
my $nbh = nbh();
$nbh->do ('DROP TABLE preference');
$nbh->do ($create_preference);
}
# $database_filename is in filesystem charset bytes
sub initial_database {
my ($database_filename) = @_;
print __x("Creating {filename}\n",
filename => Glib::filename_display_name($database_filename));
File::Path::mkpath (File::Basename::dirname ($database_filename));
my $dbh = DBI->connect ("dbi:SQLite:dbname=$database_filename",
'', '', {RaiseError=>1});
$dbh->{sqlite_unicode} = 1;
lib/App/Chart/Database/Create.pm view on Meta::CPAN
}
sub nbh {
require App::Chart::DBI;
my $notes_filename = App::Chart::DBI::notes_filename();
File::Path::mkpath (File::Basename::dirname ($notes_filename));
return DBI->connect ("dbi:SQLite:dbname=$notes_filename",
'', '', {RaiseError=>1});
}
# $notes_filename is in filesystem charset bytes
sub initial_notes {
my ($notes_filename) = @_;
print __x("Creating {filename}\n",
filename => Glib::filename_display_name($notes_filename));
my $nbh = nbh();
$nbh->{sqlite_unicode} = 1;
$nbh->do ('PRAGMA encoding = "UTF-8"');
$nbh->do ($create_preference);
lib/App/Chart/IntradayHandler.pm view on Meta::CPAN
my $resp = $ua->request
($req,
sub {
my ($chunk, $resp, $protobj) = @_;
$resp->add_content($chunk);
# if the message is deflate/gzip/etc compressed then decoded_content
# returns undef until the whole image -- but don't worry about that
# until we get a server sending us compressed images
#
my $image = $resp->decoded_content(charset=>'none');
if ($image && length $image >= 256) {
App::Chart::Intraday::write_intraday_image (symbol => $symbol,
mode => $mode,
image => $image);
}
});
if ($resp->is_success) {
$image = $resp->decoded_content(charset=>'none',raise_error=>1);
} else {
$error = __x('Error: {status_line}',
status_line => $resp->status_line);
}
}
require App::Chart::Intraday;
App::Chart::Intraday::write_intraday_image (symbol => $symbol,
mode => $mode,
image => $image,
resp => $resp,
lib/App/Chart/Suffix/LJ.pm view on Meta::CPAN
# latest
#
# This uses the text file at
#
# http://www.ljse.si/cgi-bin/jve.cgi?doc=2111
#
# which is
#
use constant BTS_URL => 'http://www.ljse.si/datoteke/BTStecajEUR.txt';
#
# The charset isn't specified in the http headers nor the file format specs
# but it's codepage 1250. The server provides ETag and Last-Modified.
#
# The symbols in each file are cached, so it's usually possible to go
# straight to the right one. If some symbols aren't where expected then
# both are downloaded to recheck.
#
App::Chart::LatestHandler->new
(pred => $pred,
available_tdate => \&available_tdate,
lib/App/Chart/Suffix/LJ.pm view on Meta::CPAN
my ($resp) = @_;
my @data = ();
my $h = { source => __PACKAGE__,
url_tags_key => 'LJ-BTStecajEUR',
resp => $resp,
currency => 'EUR',
date_format => 'dmy',
suffix => '.TSP',
data => \@data };
# charset not specified, but is codepage 1250
my $content = $resp->decoded_content (raise_error => 1,
default_charset => 'cp1250');
$content =~ s/\r//g;
# 0001 file format marker
# $content =~ /^ 0001 110 /
# or die 'Ljubljana: BTS file missing 0001 id line';
# my $date = txt_to_date ($content);
foreach my $line (split /\n+/, $content) {
my $elem;
lib/App/Chart/Suffix/LME.pm view on Meta::CPAN
'Tin' => 'SN',
'Nickel' => 'NI',
'Far East' => 'FF', # steel
'Med' => 'FM', # steel
'Averages' => undef,
'Plastic Avg' => undef,
'Averages inc. Euro Eq' => undef);
sub monthxls_parse {
my ($resp) = @_;
my $content = $resp->decoded_content (charset => 'none', raise_error => 1);
require Spreadsheet::ParseExcel;
require Spreadsheet::ParseExcel::Utility;
my @data = ();
my $h = { source => __PACKAGE__,
cover_pred => $pred,
data => \@data };
my $excel = Spreadsheet::ParseExcel::Workbook->Parse (\$content);
lib/App/Chart/Suffix/LME.pm view on Meta::CPAN
App::Chart::Download::status (__x('LME volumes {filename}',
filename => $filename));
my $resp = App::Chart::Download->get ($url);
my $h = volume_parse ($resp);
App::Chart::Download::write_daily_group ($h);
}
}
sub volume_parse {
my ($resp) = @_;
my $content = $resp->decoded_content (charset => 'none', raise_error => 1);
require Spreadsheet::ParseExcel;
require Spreadsheet::ParseExcel::Utility;
my @data = ();
my $h = { source => __PACKAGE__,
data => \@data };
my $excel = Spreadsheet::ParseExcel::Workbook->Parse (\$content);
my $sheet = $excel->Worksheet (0);
lib/App/Chart/Suffix/TGE.pm view on Meta::CPAN
filename => $filename));
my $resp = App::Chart::Download->get ($url,
url_tags_key => 'TGE-day');
if (! $resp->is_success) {
# not modified, no new data
return 1;
}
my $got_tdate = csv_tdate ($resp);
if ($got_tdate == $start_tdate) {
# got the expected data, process it
my $content = $resp->decoded_content (charset => 'none');
my $h = csv_parse ($content);
$h->{'url_tags_key'} = 'TGE-day';
return 1;
} elsif ($got_tdate < $avail_tdate) {
# got something older, there's no new data
return 1;
} else {
return 0;
}
}
lib/App/Chart/Suffix/TGE.pm view on Meta::CPAN
($end_year, $end_month, $end_day, -1, 0, 1);
return sprintf 'http://www.tge.or.jp/data/down_load/%s01%02d%02d%02d%02d%02d%02d.zip',
lc($commodity),
$start_year % 100, $start_month, $start_day,
$end_year % 100, $end_month, $end_day;
}
sub zip_parse {
my ($resp) = @_;
my $zipstr = $resp->decoded_content (charset => 'none', raise_error => 1);
my $h;
require Archive::Zip;
require IO::String;
my $zip = Archive::Zip->new;
my $io = IO::String->new ($zipstr);
$zip->readFromFileHandle ($io);
foreach my $member ($zip->members) {
my $csv = $member->contents;
lib/App/Chart/doc/chart.html view on Meta::CPAN
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual describes how to install and use Chart, version 275.
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2019, 2023, 2024 Kevin Ryde
Chart is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version
(Copying). -->
<title>Chart Manual</title>
lib/App/Chart/doc/chart.html view on Meta::CPAN
<li><a href="#Locale-Selection" accesskey="1">Locale Selection</a></li>
</ul>
<div class="section-level-extent" id="Locale-Selection">
<h3 class="section"><span>17.1 Locale Selection<a class="copiable-link" href="#Locale-Selection"> ¶</a></span></h3>
<a class="index-entry-id" id="index-Locale-selection"></a>
<a class="index-entry-id" id="index-Language"></a>
<a class="index-entry-id" id="index-LANG"></a>
<p>On a typical Unix/POSIX-style system the locale is selected with the
<code class="env">LANG</code> environment variable, set to a language code and optional territory
and charset. For example US English,
</p>
<div class="example">
<pre class="example-preformatted">LANG=en_US
export LANG
</pre></div>
<p>This is often set by the system administrator, but you can do it yourself in
your <samp class="file">~/.profile</samp> (see <a data-manual="bashref" href="http://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html">Bash Startup Files</a> in <cite class="cite">Bash Features</cite>).
</p>
<a class="index-entry-id" id="index-Language-codes"></a>
maybe/unused.pm view on Meta::CPAN
# my ($widget, $region) = @_;
# if (my $win = $widget->window) {
# window_clear_region ($win);
# }
# }
# strftime() on Time::Piece taking and returning a wide-char string
sub time_piece_strftime_wide {
my ($timepiece, $format) = @_;
my $charset = I18N::Langinfo::langinfo (I18N::Langinfo::CODESET());
$format = Encode::encode ($charset, $format);
my $str = $timepiece->strftime ($format);
return Encode::decode ($charset, $str);
}
# _all_map_same ($func, $x, $y, ...) returns true if calls $func->($x),
# $func->($y), etc all return the same number.
sub _all_map_same {
my $func = shift;
if (@_) {
my $want = $func->(shift @_);
misc/t-ath.pl view on Meta::CPAN
use strict;
use warnings;
use LWP;
use Data::Dumper;
use File::Slurp 'slurp';
use App::Chart::Suffix::ATH;
{
my $resp = HTTP::Response->new(200, 'OK');
my $content = slurp(<~/chart/samples/athex/last30-alpha.html>);
$resp->content_type('text/html; charset=iso-8859-7');
$resp->content($content);
my $h = App::Chart::Suffix::ATH::last30_parse ($resp);
print Dumper ($h);
# App::Chart::Download::write_daily_group ($h);
foreach (split //,$h->{'name'}) {
print ord($_)," ";
}
print "\n";
misc/t-float.pl view on Meta::CPAN
use Data::Dumper;
use File::Slurp 'slurp';
use App::Chart::Download;
use App::Chart::Float;
{
my $resp = HTTP::Response->new(200,'OK');
my $content = slurp (<~/chart/samples/float/CML.zip>);
$resp->content($content);
die if ($resp->decoded_content(charset=>'none') ne $content);
my $h = App::Chart::Float::zip_parse ('CML.zip', $resp, 'float-indiv-zip');
# print Dumper ($h);
App::Chart::Download::write_daily_group ($h);
exit 0;
}
{
require App::Chart::Gtk2::Symlist::All;
require App::Chart::Gtk2::Symlist::Glob;
require App::Chart::DownloadCost;
misc/t-http.pl view on Meta::CPAN
my $file = File::Slurp::slurp ('foo.gz');
print length($file),"\n";
my $chunk = substr ($file, 0, length($file)/2);
my $resp = HTTP::Message->new;
$resp->add_content($chunk);
$resp->push_header('Content-Encoding' => 'gzip');
print $resp->headers->as_string;
my $image = $resp->decoded_content(charset=>'none');
print length ($image);
misc/t-lme.pl view on Meta::CPAN
exit 0;
}
{
my $resp = HTTP::Response->new(200,'OK');
# my $content = slurp (<~/chart/samples/lme/Dataprices_daily_metals-18sep08.aspx.html>);
# my $content = slurp (<~/chart/samples/lme/Dataprices_Steels_OfficialPrices.aspx-20sep08.html>);
my $content = slurp (<~/chart/samples/lme/Dataprices_daily_prices_plastics.aspx-20sep08.html>);
$resp->content($content);
$resp->content_type('text/html; charset=iso-8859-1');
my $h = App::Chart::Suffix::LME::daily_metals_parse($resp);
print Dumper($h);
# App::Chart::Download::write_latest_group ($h);
exit 0;
}
{
my $resp = HTTP::Response->new(200,'OK');
my $content = slurp (<~/chart/samples/lme/Dataprices_daily_prices_plastics.aspx-20sep08.html>);
$resp->content($content);
$resp->content_type('text/html');
misc/t-misc.pl view on Meta::CPAN
exit 0;
}
{
my $aref = ref (undef);
print Dumper ($aref);
exit 0;
}
{
my $charset = langinfo (CODESET);
print "charset $charset\n";
foreach my $name (@Encode::FB_FLAGS) {
my $value = eval "$name";
printf "%-20s %#05X\n", $name, $value;
}
require PerlIO::encoding;
local $PerlIO::encoding::fallback = 0; # FB_DEFAULT, substitute quietly
local $PerlIO::encoding::fallback = Encode::PERLQQ;
printf "fallback %#x\n",$PerlIO::encoding::fallback;
misc/t-mlc.pl view on Meta::CPAN
use strict;
use warnings;
use Data::Dumper;
use File::Slurp;
use HTTP::Response;
use App::Chart::Suffix::MLC;
{
my $content = File::Slurp::slurp ($ENV{'HOME'}.'/chart/samples/mlc/mlc2.data');
my $resp = HTTP::Response->new(200, 'OK',
['Content-Type' => 'text/html; charset=utf-8'],
$content);
my $h = App::Chart::Suffix::MLC::parse ('FOO.MLC',$resp);
print Dumper ($h);
# App::Chart::Download::write_latest_group ($h);
# App::Chart::Download::write_daily_group ($h);
exit 0;
}
misc/t-nz.pl view on Meta::CPAN
# my $content = slurp ("$ENV{'HOME'}/chart/samples/nzx/upcoming_dividends.html");
# old jul 09
# my $content = slurp ("$ENV{'HOME'}/chart/samples/nzx/Dividends.html");
# new sep 17
# my $content = slurp ("$ENV{HOME}/chart/samples/nzx/dividends-sep18.html");
# new sep 24
my $content = slurp ("$ENV{HOME}/chart/samples/nzx/dividends-sep24-json.html");
my $resp = HTTP::Response->new
(200, 'OK',
['Content-Type' => 'text/html; charset=utf-8'],
$content);
# my $req = HTTP::Request->new();
# $req->uri(App::Chart::Suffix::NZ->DIVIDENDS_URL);
# $resp->request ($req);
### charset: $resp->content_charset
# ### resp: $resp->as_string
$App::Chart::option{'verbose'} = 1;
my $h = App::Chart::Suffix::NZ::dividends_parse ($resp);
App::Chart::Download::crunch_h($h);
print Dumper ($h);
# App::Chart::Download::write_daily_group ($h);
exit 0;
}
{
misc/t-tsp.pl view on Meta::CPAN
{
my $url;
$url = 'https://www.tsp.gov/data/fund-price-history.csv?startdate=2023-02-01&enddate=2023-02-07&Lfunds=1&InvFunds=1&download=1';
$url = 'https://www.tsp.gov/data/fund-price-history.csv?startdate=2023-01-30&enddate=2023-02-03';
$App::Chart::option{'verbose'} = 2;
my $resp = App::Chart::Download->get
($url,
user_agent => App::Chart::Suffix::TSP::TSP_USER_AGENT,
referer => 'https://www.tsp.gov/share-price-history/');
my $content = $resp->decoded_content (charset => 'none');
### $content
my $h = App::Chart::Suffix::TSP::parse($resp);
print "h= ",Dumper($h);
exit 0;
}
{
# my $content = slurp ($ENV{'HOME'}.'/chart/samples/tsp/share-prices.html');
# my $content = slurp ("$ENV{HOME}/chart/samples/tsp/sharePriceHistory.shtml.2");
misc/t-tsp.pl view on Meta::CPAN
;
}
{
require App::Chart::Download;
my $hi_tdate = App::Chart::Download::tdate_today();
my $lo_tdate = $hi_tdate - 10;
my $resp = App::Chart::Suffix::TSP::get_chunk (['LINCOME.TSP'],
$lo_tdate,
$hi_tdate);
print $resp->headers->as_string;
print $resp->decoded_content (charset => 'none');
exit 0;
}
{
print App::Chart::Suffix::TSP::symbol_to_name('G.TSP'),"\n";
print App::Chart::Suffix::TSP::symbol_to_name('LINCOME.TSP'),"\n";
exit 0;
}
{
misc/t-yahoo.pl view on Meta::CPAN
$filename = "$ENV{HOME}/chart/samples/yahoo/GSPC-v7.json";
$filename = "$ENV{HOME}/chart/samples/yahoo/RMX-v7.json";
$filename = "$ENV{HOME}/chart/samples/yahoo/SCG-v7.json";
$filename = "$ENV{HOME}/chart/samples/yahoo/WDC.AX-v7.json";
$filename =~ m{/(.*)?-v7} or die;
my $symbol = $1;
require HTTP::Response;
my $resp = HTTP::Response->new();
my $content = slurp ($filename);
$resp->content($content);
$resp->content_type('text/html; charset=utf-8');
my $h = App::Chart::Yahoo::latest_parse ($symbol, $resp);
print Dumper(\$h);
# App::Chart::Download::write_latest_group ($h);
exit 0;
}
{
# SCT.AX Scout Security, 1 old -> 100 new consolidation Aug 2024
# As of September 2024, split appears 4 times
# Think one only 5 Aug 24 price 0.52 up from 0.0052
# 1718409600
misc/t-yahoo.pl view on Meta::CPAN
."&period2=$hi_timet"
."&interval=1d"
."&events=". URI::Escape::uri_escape('div|split')
."&close=unadjusted";
print "$url\n";
require App::Chart::UserAgent;
my $ua = App::Chart::UserAgent->instance;
my $resp = $ua->get($url);
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/z', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
my $decoded = JSON::from_json($content);
print JSON->new->pretty->encode($decoded);
exit 0;
}
{
# v1 info parse
my $filename = "$ENV{HOME}/chart/samples/yahoo/v1-info-CSCO.json";
$filename = "$ENV{HOME}/chart/samples/yahoo/v1-info-ORD.AX.json";
$filename =~ /v1-info-([A-Z.]+)\.json/ or die;
my $symbol = $1;
require HTTP::Response;
my $resp = HTTP::Response->new(200,'OK');
$resp->content(slurp($filename));
$resp->content_type('application/json;charset=utf-8');
my $h = App::Chart::Yahoo::info_parse ($symbol,$resp);
print Dumper ($h);
# App::Chart::Download::write_daily_group ($h);
exit 0;
}
{
# v8 parse
my $filename = "$ENV{HOME}/chart/samples/yahoo/TSCO.L-2017.json";
misc/t-yahoo.pl view on Meta::CPAN
my $jar = HTTP::Cookies->new;
my $user_agent = 'Mozilla/5.0';
my $resp = App::Chart::Download->get
($url,
user_agent => $user_agent,
cookie_jar => $jar,
redirect_ok => 0);
### headers: $resp->headers->as_string
print "jar string: ",$jar->as_string,"\n";
print "content:\n";
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
print $content,"\n";
exit 0;
}
{
$App::Chart::option{'verbose'} = 2;
my $h = App::Chart::Yahoo::cookie_and_crumb_data();
print Dumper($h);
exit 0;
}
misc/t-yahoo.pl view on Meta::CPAN
."&period2=$hi_timet"
."&interval=1d"
."&events=". URI::Escape::uri_escape('div|split')
."&close=unadjusted";
print "$url\n";
require App::Chart::UserAgent;
my $ua = App::Chart::UserAgent->instance;
my $resp = $ua->get($url);
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/z', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
print $content;
exit 0;
}
{
# v8 dates, as of June 2024
my $t = 1504013400; # IBM
my $tz = "America/New_York";
misc/t-yahoo.pl view on Meta::CPAN
$events = "split";
$events = "div";
$events = "history";
$events = "history|split";
my $url = "https://query2.finance.yahoo.com/v8/finance/chart/$symbol?formatted=true&lang=en-US®ion=US&period1=$start&period2=$end&interval=1d&events=$events&corsDomain=finance.yahoo.com";
require App::Chart::UserAgent;
my $ua = App::Chart::UserAgent->instance;
my $resp = $ua->get($url);
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/z', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
print $content;
exit 0;
}
{
# v7 in June 2024
# https://finance.yahoo.com/quote/AMP.AX/history?p=AMP.AX
misc/t-yahoo.pl view on Meta::CPAN
# 404
exit 0;
}
{
require HTTP::Response;
my $filename = "$ENV{HOME}/chart/samples/yahoo/history?p=BHP.AX";
my $resp = HTTP::Response->new();
my $content = slurp ($filename);
$resp->content($content);
$resp->content_type('text/html; charset=utf-8');
my @ret = App::Chart::Yahoo::daily_cookie_parse($content,$resp);
### @ret
exit 0;
}
{
# Date,Dividends
# 2014-05-14,1.41429
# 2015-05-15,1.41428
# 2013-05-30,1.32857
# 2013-11-06,1.38571
misc/t-yahoo.pl view on Meta::CPAN
my $url = "https://query1.finance.yahoo.com/v7/finance/download/$symbol?period1=$start&period2=$end&interval=1d®ion-AU&events=$events&crumb=$crumb";
print "$url\n";
my $resp = $ua->get($url);
print "\n";
my $resp_size = length($resp->as_string);
print "size $resp_size\n";
print $resp->status_line,"\n";
print $resp->headers->as_string;
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/y', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
print $content;
exit 0;
}
{
# daily_parse_split()
require HTTP::Response;
my $filename = "$ENV{HOME}/chart/samples/yahoo/GXY-split.csv";
my $resp = HTTP::Response->new();
my $content = slurp ($filename);
$resp->content($content);
$resp->content_type('text/html; charset=utf-8');
my $h = {};
App::Chart::Yahoo::daily_parse_split('GXY.AX', $resp, $h);
print Dumper(\$h);
exit 0;
}
{
# json v7 download
my $symbol;
$symbol = 'NAB.AX';
misc/t-yahoo.pl view on Meta::CPAN
."?period1=$start&period2=$end&interval=1d&events=$events";
# seem to be defaults:
# &includeTimestamps=true
# &indicators=quote
require App::Chart::UserAgent;
my $ua = App::Chart::UserAgent->instance;
my $resp = $ua->get($url);
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/z', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
print $content;
exit 0;
}
misc/t-yahoo.pl view on Meta::CPAN
}
{
# daily_parse()
my $symbol = 'NAB.AX';
my $filename = "$ENV{HOME}/chart/samples/yahoo/daily.csv";
require HTTP::Response;
my $resp = HTTP::Response->new();
my $content = slurp ($filename);
$resp->content($content);
$resp->content_type('text/html; charset=utf-8');
my $h = { source => __PACKAGE__,
prefer_decimals => 2,
date_format => 'ymd',
};
App::Chart::Yahoo::daily_parse
($symbol, $resp, $h, App::Chart::ymd_to_tdate_floor(2017,9,7));
print Dumper(\$h);
exit 0;
# (chart-quote "NAB.AX")
misc/t-yahoo.pl view on Meta::CPAN
}
{
# latest_parse() for quotes
my $symbol = 'NAB.AX';
my $filename = "$ENV{HOME}/chart/samples/yahoo/daily.csv";
require HTTP::Response;
my $resp = HTTP::Response->new();
my $content = slurp ($filename);
$resp->content($content);
$resp->content_type('text/html; charset=utf-8');
my $h = App::Chart::Yahoo::latest_parse
($symbol, $resp, App::Chart::ymd_to_tdate_floor(2017,9,1));
print Dumper(\$h);
# App::Chart::Download::write_latest_group ($h);
exit 0;
# (chart-quote "NAB.AX")
# (chart-latest "NAB.AX" 'last)
}
misc/t-yahoo.pl view on Meta::CPAN
});
my $crumb;
if (0) {
my $url = "https://finance.yahoo.com/quote/$symbol/history?p=$symbol";
my $resp = $ua->get($url);
my $resp_size = length($resp->as_string);
print "size $resp_size\n";
print $resp->status_line,"\n";
print $resp->headers->as_string;
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/x', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
$content =~ /"CrumbStore":\{"crumb":"([^"]*)"}/;
$crumb = $1;
print "crumb raw $crumb\n";
$crumb = App::Chart::Yahoo::javascript_string_unquote($crumb);
$jar->save('/tmp/cookie3.txt');
} else {
$crumb = 'GmF7zbT8OWV';
$jar->load('/tmp/cookie3.txt');
misc/t-yahoo.pl view on Meta::CPAN
my $start = $end - 86400*5;
my $url = "https://query1.finance.yahoo.com/v7/finance/download/$symbol?period1=$start&period2=$end&interval=1d&events=$events&crumb=$crumb";
print "$url\n";
my $resp = $ua->get($url);
print "\n";
my $resp_size = length($resp->as_string);
print "size $resp_size\n";
print $resp->status_line,"\n";
print $resp->headers->as_string;
my $content = $resp->decoded_content (raise_error => 1, charset => 'none');
File::Slurp::write_file('/tmp/y', {err_mode=>'carp'}, $content);
$content = $resp->decoded_content (raise_error => 1);
print $content;
exit 0;
}
{
# timegm 00:00:00 AAPL last day missed, TSCO.L ok, BHP.AX ok
# end +86399 AAPL ok, TSCO.L and BHP.AX extra day
my $symbol;
misc/t-yahoo.pl view on Meta::CPAN
exit 0;
}
{
App::Chart::Database->add_symbol ('ETR.AX');
my $resp = HTTP::Response->new();
my $content = slurp ($ENV{'HOME'}.'/chart/samples/yahoo/etr.csv');
$resp->{'_rc'} = 200;
$resp->content($content);
die if ($resp->decoded_content(charset=>'none') ne $content);
my $h = App::Chart::Yahoo::daily_parse ('ETR.AX', $resp);
print Dumper ($h);
App::Chart::Download::write_daily_group ($h);
exit 0;
}
{
my $content = slurp ('/nosuchfile');
exit 0;
}
po/App-Chart.pot view on Meta::CPAN
#
#
msgid ""
msgstr ""
"Project-Id-Version: Chart @VERSION@\n"
"POT-Creation-Date: 2011-10-13 06:55+1100\n"
"PO-Revision-Date: YYYY-MM-DD HH:MM+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/App/Chart/Suffix/ST.pm:33
msgid "Stockholm"
msgstr ""
#: lib/App/Chart/Series/Derived/COG.pm:40
#: lib/App/Chart/Gtk2/IndicatorModelGenerated.pm:92
msgid "Centre of Gravity"
msgstr ""
You should have received a copy of the GNU General Public License
along with Chart. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------
The translations here are mainly to see the setups work. There's very
little actually translated, and most messages aren't settled enough to
want to put work into translating them.
"charset=UTF-8" should be used in .po files because that's what
App::Chart asks for, to become Perl wide-char strings everywhere
internally. A charset other than utf-8 works, it just means gettext
must convert at runtime. The .pot file, incidentally, is all ASCII.
The "msgctxt" context is used to distinguish separate uses of the same
or similar short string, in the usual way.
Context "manual-node" is a node name, ie. @node, in chart.texi.
Unless the manual is translated too then they should be left
untranslated to go to the English copy.
msgid ""
msgstr ""
"Project-Id-Version: Chart 249\n"
"Report-Msgid-Bugs-To: Kevin Ryde <user42_kevin@yahoo.com.au>\n"
"POT-Creation-Date: 2011-10-13 06:55+1100\n"
"PO-Revision-Date: 2024-09-16 16:59+1000\n"
"Last-Translator: Kevin Ryde <user42_kevin@yahoo.com.au>\n"
"Language-Team: Kevin Ryde <user42_kevin@yahoo.com.au>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1\n"
#: lib/App/Chart/Suffix/ST.pm:33
msgid "Stockholm"
msgstr ""
#: lib/App/Chart/Series/Derived/COG.pm:40
#: lib/App/Chart/Gtk2/IndicatorModelGenerated.pm:92
msgid "Centre of Gravity"
po/en_US.po view on Meta::CPAN
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chart. If not, see <http://www.gnu.org/licenses/>.
#
#
# See the file README for notes on translations.
#
#
# charset=UTF-8 here, since that's what App::Chart sets up to ask
# for, but actually all the messages are ASCII
msgid ""
msgstr ""
"Project-Id-Version: Chart 249\n"
"Report-Msgid-Bugs-To: Kevin Ryde <user42_kevin@yahoo.com.au>\n"
"POT-Creation-Date: 2011-10-13 06:55+1100\n"
"PO-Revision-Date: 2009-05-27 08:49+1000\n"
"Last-Translator: Kevin Ryde <user42_kevin@yahoo.com.au>\n"
"Language-Team: Kevin Ryde <user42_kevin@yahoo.com.au>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1\n"
#: lib/App/Chart/Suffix/ST.pm:33
msgid "Stockholm"
msgstr ""
#: lib/App/Chart/Series/Derived/COG.pm:40
#: lib/App/Chart/Gtk2/IndicatorModelGenerated.pm:92
msgid "Centre of Gravity"