view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# FIXME: version 2.10 has Gtk '-init' which tries to open the display ...
'Gtk2::Ex::Datasheet::DBI' => 0,
'HTML::LinkExtor' => 0, # part of HTML::Parser, only for RBA actually
'HTML::TableExtract' => 0,
'HTML::TreeBuilder' => 0, # only for LME plastics hack actually
# Yahoo quotes and daily
'JSON' => 0,
# anything Archive::Zip is happy with is enough, 1.07 looks likely
'IO::String' => '1.07',
# Perl-Lisp dist, only for the Emacs interface actually
# think at least 0.04 to read nil as undef
'Lisp::Reader' => 0.04,
'Lisp::Printer' => 0,
'Lisp::Symbol' => 0,
# verison 0.13 apparently for memory leaks in subr args like after()
# version 0.10 for minmax()
# version 0.22 xsubs had some problems,
# - minmax() on one arg looks at the wrong bit of stack
# - apply() and part() don't cope with stack growth
# The minmax() bit affected App::Chart::Gtk2::Graph.
# 0.24 might be fixed.
#
'List::MoreUtils' => '0.24',
# version 1.19 for N__() in scalar context
# (Locale::Messages in 1.16 didn't declare a version, it was only in
# Locale::TextDomain until 1.17 or 1.18 or something)
'Locale::TextDomain' => '1.19',
devel/brown72-import.pl view on Meta::CPAN
my @data = ();
my $h = { source => $progname,
prefer_decimals => 2,
data => \@data };
my $tdate = App::Chart::ymd_to_tdate_floor (1980,1,1);
open my $in, '<', $filename or die;
while (defined (my $line = <$in>)) {
$line =~ s/,//;
Scalar::Util::looks_like_number($line) or next;
push @data, { symbol => $symbol,
date => App::Chart::tdate_to_iso($tdate),
close => $line,
};
$tdate++;
}
close $in or die;
print "$symbol @{[scalar @data]} values imported\n";
App::Chart::Database->add_symbol ($symbol);
devel/brown72-import.pl view on Meta::CPAN
my $total = 0;
push @data, { symbol => $symbol,
date => App::Chart::tdate_to_iso($tdate),
close => $total,
};
$tdate++;
open my $in, '<', $filename or die;
while (defined (my $line = <$in>)) {
$line =~ s/,//;
Scalar::Util::looks_like_number($line) or next;
$line -= $mean;
$total += $line;
push @data, { symbol => $symbol,
date => App::Chart::tdate_to_iso($tdate),
close => $total,
};
$tdate++;
}
close $in or die;
devel/convert-scm.pl view on Meta::CPAN
if (! ref($form)) {
# string dividend
my $str = $form;
if ($option_verbose) {
print "dividend $date \"$str\"\n";
}
my $amount;
my $imputation;
my $qualifier;
my $note;
if (Scalar::Util::looks_like_number ($str)) {
$amount = $str;
} elsif ($amount eq 'unknown') {
$qualifier = 'unknown';
} elsif ($amount eq 'To be Advised') {
$qualifier = 'TBA';
} else {
print "string dividend \"$str\"\n";
$note = $str;
}
push @dividends, { symbol => $symbol,
doc/chart.texi view on Meta::CPAN
@cindex @key{Shift-W}
@key{Z} and @key{Shift-Z} zoom in and out vertically. @key{W} and
@key{Shift-W} zoom in and out horizontally (@samp{W} stands for ``wider'').
The initial vertical scaling is based on apparent price volatility, so active
stocks take the full window (or more), and sedate stocks are shown fairly
flat.
@cindex Latest
During trading, the current day's open/high/low/last so far is shown in yellow
(to emphasise it's a latest quote). This is always in OHLC style, even on a
candlestick chart. The figure drawn looks like
@ifnottex
@example
|
|
+--
|
+-----
|
+--
doc/chart.texi view on Meta::CPAN
The starting point (ie.@: the zero point) for the running total is arbitrary.
In Chart it's merely the segment of data first displayed.
The name accumulation/distribution comes from the idea that during
accumulation buyers are in control and the price will be bid up through the
day, or will make a recovery after being sold down, in any case finishing near
the high. Vice versa for distribution.
Acc/Dist is somewhat similar to On-Balance Volume (@pxref{On-Balance Volume}).
But Acc/Dist looks at close within that day's range, whereas OBV looks just at
close-to-close up or down. An Acc/Dist calculation within an N-day window can
be made too, see @ref{Chaikin Money Flow}.
@c ---------------------------------------------------------------------------
@node Accumulative Swing Index, Aroon, Accumulation/Distribution, Indicators
@section Accumulative Swing Index
@cindex Accumulative swing index
@cindex ASI
@cindex Index, accumulative swing
doc/chart.texi view on Meta::CPAN
@node Random Walk Index, Stochastics, Relative Volatility Index, Indicators
@section Random Walk Index
@cindex Random walk index
@cindex Index, random walk
@cindex RWI
The random walk index (RWI) by E.@: Michael Poulos is a measure of how much
price ranges over N days differ from what would be expected by a random walk
(randomly going up and down). A bigger than expected range suggests a trend.
The index is in two parts, an RWI high which looks at upward movement and an
RWI low for downward movement. In Chart RWI high is shown in green, and RWI
low in red. The RWI high looks at terms like
@tex
$$ { High[today] - Low[K] \over Average TR [K] } \times { 1 \over \sqrt K } $$
@end tex
@ifnottex
@example
High[today] - Low[K] 1
-------------------- * ------
Average TR [K] sqrt(K)
@end example
doc/chart.texi view on Meta::CPAN
@section TD Range Expansion Index
@cindex TD range expansion index
@cindex Range expansion index
@cindex TDREI
@cindex DeMark, Tom
The range expansion index by Tom DeMark is designed to identify price
exhaustion which may be the end of a move up or down.
The calculation is somewhat similar to an RSI (@pxref{Relative Strength
Index}) but looks at 2-day changes in the daily high and daily low values and
smooths with a 5-day SMA (@pxref{Simple Moving Average}). Changes are ignored
if the current day in not either within or covering price action from 5 or 6
days ago. That test effectively holds the indicator around zero while prices
are making breakaway runs.
DeMark regarded values above @math{+45} or below @math{-45} as overbought or
oversold. Such a reading maintained for up to five days suggests a reversal,
except that if it remains there for 6 or more days then the signal may be
unreliable and trading should be avoided.
doc/chart.texi view on Meta::CPAN
list of language preferences for message translations (@pxref{Using
gettextized software,, User influence on @code{gettext}, libc, GNU C Library
Reference Manual}). For example to have Italian preferred, otherwise Spanish,
otherwise English,
@example
LANGUAGE=it_IT:es:en
export LANGUAGE
@end example
Chart looks at @env{LANGUAGE} too (on all systems) for the preferred language
for stock and commodity names.
@c ---------------------------------------------------------------------------
@node Emacs, Concept Index, Internationalization, Top
@chapter Emacs
@cindex Emacs
@uref{http://www.gnu.org/software/emacs/}
lib/App/Chart/Finance/Yahoo/Exchanges.pm view on Meta::CPAN
# Currently unused ...
package App::Chart::Finance::Yahoo::Exchanges;
use 5.006;
use strict;
use warnings;
use Locale::TextDomain ('App-Chart');
# This looks at the exchanges page
#
# use constant URL => 'http://finance.yahoo.com/exchanges';
use constant URL => 'https://help.yahoo.com/kb/SLN2310.html';
# Refetch the exchanges page after this many days
#
use constant UPDATE_DAYS => 7;
# return a hashref of exchange delay data like { '.AX' => 20, '.BI' => 15 }
sub exchanges_data {
lib/App/Chart/Gtk2/Diagnostics.pm view on Meta::CPAN
# return a string of the contents of a hash (passed as a hashref)
sub hash_format {
my ($h) = @_;
my $nf = App::Chart::number_formatter();
require Scalar::Util;
my %mung;
foreach my $key (keys %$h) {
my $value = $h->{$key};
if (Scalar::Util::looks_like_number ($value)) {
$mung{$key} = $nf->format_number ($value);
} elsif (ref ($_) && ref($_) eq 'HASH') {
$mung{$key} = "subhash, " . scalar(keys %{$_}) . " keys";
} else {
$mung{$key} = $value;
}
}
my $field_width = max (map {length} keys %mung);
my $value_width = max (map {length} values %mung);
lib/App/Chart/Gtk2/GUI.pm view on Meta::CPAN
if (Gtk2->can('show_uri')) { # new in Gtk 2.14
my $screen = $parent_widget && $parent_widget->get_screen;
if (eval { Gtk2::show_uri ($screen, $uri); 1 }) {
return;
}
# possible Glib::Error "operation not supported" on http urls
### show_uri() error: $@
}
{
# Debian "sensible-browser" program which looks at $BROWSER and various
# other things.
my @command = ('sensible-browser', $uri);
if (_spawn (@command)) { return }
}
{
# The quoting, or lack thereof, expected of the url in openURL is in
# mozilla XRemoteService.cpp. It looks for ( ) delims, then the last
# "," is the last arg to take off new-window, new-tab, noraise, etc.
my @command = ('mozilla', '-remote', "openURL($uri,new-window)");
### run: @command
if (system (@command) == 0) {
return;
}
### run status: $?
### error: "$!"
}
{
lib/App/Chart/Gtk2/IntradayImage.pm view on Meta::CPAN
my $symbol = $self->{'symbol'};
my $mode = $self->{'mode'};
if (! $symbol || ! $mode) { return __('(No data)'); }
my $dbh = App::Chart::DBI->instance;
my $sth = $dbh->prepare_cached
('SELECT image, error FROM intraday_image WHERE symbol=? AND mode=?');
# Crib note: Some DBI 1.618 SQLite3 1.35 seems to hold a ref to the
# scalars passed to selectrow_array() until the next call. So use the
# local variables since holding onto $self->{'symbol'} looks like a leak.
#
my ($image, $error) = $dbh->selectrow_array ($sth, undef,
$symbol,
$mode);
$sth->finish();
if (! defined $image) { # error message in database
return $error || __('(No data)');
}
my $loader = Gtk2::Gdk::PixbufLoader->new();
lib/App/Chart/IndicatorInfo.pm view on Meta::CPAN
# ENHANCE-ME: @DEFAULT_ARGS shows when OHLCV needed ...
use constant manual => __p('manual-node','Other Indicator Packages');
sub parameter_info {
my ($self) = @_;
my $module = $self->module_load || return;
my @default_args = do { no strict 'refs'; @{"${module}::DEFAULT_ARGS"} };
my @ret;
foreach my $arg (@default_args) {
if (Scalar::Util::looks_like_number ($arg)) {
my $i = @ret;
push @ret, { name => "Arg$i",
key => "GT-arg$i",
default => $default_args[$i],
};
}
}
return \@ret;
}
lib/App/Chart/Series/Derived/Adjust.pm view on Meta::CPAN
if ($p_volumes->[$t]) { $s_volumes->[$t] = $p_volumes->[$t] / $factor;}
if ($p_openints->[$t]){ $s_openints->[$t] = $p_openints->[$t] / $factor;}
for ( ; $splits->[0]->{'date'} >= $t; shift @$splits) {
$factor *= ($splits->[0]->{'old'} / $splits->[0]->{'new'});
### factor now: $factor
}
for ( ; $dividends->[0]->{'ex_date'} >= $t; shift @$dividends) {
my $div = $dividends->[0]->{'amount'};
Scalar::Util::looks_like_number ($div) or next;
if ($self->{'adjust_imputation'}) {
my $imp = $dividends->[0]->{'imputation'};
if (Scalar::Util::looks_like_number ($imp)) { $div += $imp; }
}
if (defined $post_close) {
# factor chosen so if prev=post+div then prev*factor==post
$factor *= $post_close / ($post_close + $div);
### dividend: $div
### $post_close
### factor now: $factor
}
}
}
lib/App/Chart/Series/Derived/EPMA.pm view on Meta::CPAN
#
# http://www.linnsoft.com/tour/techind/mma.htm
# Formula, but sample chart is only an intraday.
#
# http://trader.online.pl/MSZ/e-w-Modified_Moving_Average.html
# Formulas for N=2, N=3, N=4, and N=10.
# http://trader.online.pl/MSZ/e-w-Modified_Moving_Average_II.html
# Formulas for N=20.
# http://trader.online.pl/ELZ/t-i-Modified_Moving_Averages.html
# Formula for general N, per traders tips, from www.omegaresearch.com.
# Sample chart S&P 500 (yahoo symbol ^GSPC) from 2001, looks like the
# default N=2 shown in the formula.
#
# http://www.tradecision.com/support/tasc_tips/modified_moving_average.htm
# http://www.tradecision.com/downloads/tasc_tips/ModifiedMovingAverage.tnd
# Formula.
#
#-----------------------------------------------------------------------------
# The equivalence of the linreg a+b*endpos and the "3i" stepping weighted
lib/App/Chart/Series/Derived/RWI.pm view on Meta::CPAN
# http://store.traders.com/-v10-c01-sideran-pdf.html
# Abstract of sidebar calculation, excess of channel height (scaled by
# one-day move) over square root.
# http://store.traders.com/-v11-c11-sideran-pdf.html
# Similar.
# "Are There Persistent Cycles", E. Michael Poulos, September 1992
# TASC.
#
# http://www.prophet.net/analyze/popglossary.jsp?studyid=RWI
# Sample of McDonalds, year not shown but looks like May 2001.
#
# http://www.paritech.com/paritech-site/education/technical/indicators/momentum/random.asp
# Description, no formulas, sample of DJS.AX, year not shown but is
# 1999 (RWI period not shown either).
#
# http://trader.online.pl/MSZ/e-w-Random_Walk_Index.html
# Formula.
#
# http://trader.online.pl/MSZ/e-w-Random_Walk_Index_II.html
# Long and short term high and low forms. Chart of Telecom Polska
lib/App/Chart/Series/Derived/TDREI.pm view on Meta::CPAN
# http://www.meta-formula.com/Metastock-Formulas-T.html
# Formula.
#
# http://www.amibroker.com/library/formula.php?id=15
# Formula, showing only numerator suppressed by condition.
#
# http://www.aiqsystems.com/PriceandVolumeBasedStrategies1.htm#down17
# Code.
# http://www.aiqsystems.com/TDREI.gif
# Sample of Cabot Corp (NYSE symbol CBT) from Jan to Jun 2002. Period
# not shown, looks like 5 days.
#
sub longname { __('TD REI - Range Expansion Index') }
sub shortname { __('TDREI') }
sub manual { __p('manual-node','TD Range Expansion Index') }
use constant
{ hlines => [ -40, 45 ],
type => 'indicator',
units => 'percentage_plus_or_minus_100',
lib/App/Chart/Suffix/RBA.pm view on Meta::CPAN
$symbol =~ s/_.*//; # _4pm on TWI
$symbol = "AUD$symbol.RBA";
my $name = $row->[1];
$name =~ s/ \(4pm\)$//; # 4pm on TWI
foreach my $c (2 .. $lastcol) {
my $rate = $row->[$c];
# bank holiday columns have "BANK HOLIDAY" with one letter per row or
# blank which comes through as undef, skip those
next if ! Scalar::Util::looks_like_number($rate);
push @data, { symbol => $symbol,
name => $name,
date => $dates[$c],
last_time => '16:00:00',
close => $rate,
currency => substr($symbol,3,3),
};
}
}
lib/App/Chart/Suffix/SIMEX.pm view on Meta::CPAN
# delayed, but doesn't seem to say be how much
#
# App::Chart::Barchart::setup_quote_delay ($pred, 20);
App::Chart::Barchart::commodity_mung
($pred,
# equity index futures
'NK' => 'NX', # nikkei 225
'N3' => 'VN', # nikkei 300
#
# 'JP' MSCI Japan seems to be missing from barchart, it looks
# like that contract has had no volume for a long time, so it
# doesn't matter
#
'JP' => undef, # msci japan
#
'TW' => 'TI', # msci taiwan
'SG' => 'SV', # msci singapore
'ST' => 'VS', # straits times
'HK' => 'VK', # msci hong kong
'IN' => 'NH', # cnx nifty
lib/App/Chart/Tie/Hash/Union.pm view on Meta::CPAN
my %h1 = (a => 1, b => 2);
my %h2 = (x => 3, y => 3);
my %union;
tie %union, \%h1, \%h2;
print $union{a},"\n"; # entry in %h1
print $union{y},"\n"; # entry in %h2
=head1 DESCRIPTION
C<App::Chart::Tie::Hash::Union> makes a hash present the keys and values of a given set
of other underlying hash tables. Accessing the tied hash looks in each of
those hashes for the desired key. The tied hash hold nothing of it's own
but looks dynamically at the underlying hashes, so it reflects their current
contents at any given time.
=over
=item C<$tiedhash{$key}>
Fetching looks in each unioned hash for the first with C<exists $h->{$key}>.
=item C<$tiedhash{$key} = $value>
Storing looks in each unioned hash for one with C<exists $h->{$key}> and
stores to that entry. If none have C<$key> already then a new entry is made
in the first unioned hash. If there are no unioned hashes the store croaks.
=item C<delete $tiedhash{$key}>
Deleting deletes C<$key> from each of the unioned hashes.
=item C<clear %tiedhash>
Clearing clears each unioned hash.
lib/App/Chart/UserAgent.pm view on Meta::CPAN
# Net::HTTP made an incompatible change, circa its version 6.23,
# to its default MaxLineLength, dropping from 32 kbytes to 8 kbytes.
# This breaks on some long header lines from finance.yahoo.com in
# App::Chart::Yahoo data downloads. Those lines are somewhere up
# 6 kbytes, maybe more depending on the share symbol or something.
# That's a foolish amount to have in a header line, but want it to
# work here.
#
# MaxLineLength => 0 here means no length limit.
# Would have preferred to get this in via the UserAgent instance
# or class here, but looks like no way to get through to that
# protocol bits.
#
use LWP::Protocol::http;
push @LWP::Protocol::http::EXTRA_SOCK_OPTS, MaxLineLength => 0;
sub new {
my ($class, %options) = @_;
if (! exists $options{'keep_alive'}
&& ! exists $options{'conn_cache'}) {
lib/App/Chart/doc/chart.html view on Meta::CPAN
<a class="index-entry-id" id="index-Shift_002dW"></a>
<p><kbd class="key">Z</kbd> and <kbd class="key">Shift-Z</kbd> zoom in and out vertically. <kbd class="key">W</kbd> and
<kbd class="key">Shift-W</kbd> zoom in and out horizontally (‘<samp class="samp">W</samp>’ stands for “wider”).
The initial vertical scaling is based on apparent price volatility, so active
stocks take the full window (or more), and sedate stocks are shown fairly
flat.
</p>
<a class="index-entry-id" id="index-Latest"></a>
<p>During trading, the current day’s open/high/low/last so far is shown in yellow
(to emphasise it’s a latest quote). This is always in OHLC style, even on a
candlestick chart. The figure drawn looks like
</p>
<div class="example">
<pre class="example-preformatted"> |
|
+--
|
+-----
|
+--
|
lib/App/Chart/doc/chart.html view on Meta::CPAN
</p>
<p>The starting point (ie. the zero point) for the running total is arbitrary.
In Chart it’s merely the segment of data first displayed.
</p>
<p>The name accumulation/distribution comes from the idea that during
accumulation buyers are in control and the price will be bid up through the
day, or will make a recovery after being sold down, in any case finishing near
the high. Vice versa for distribution.
</p>
<p>Acc/Dist is somewhat similar to On-Balance Volume (see <a class="pxref" href="#On_002dBalance-Volume">On-Balance Volume</a>).
But Acc/Dist looks at close within that day’s range, whereas OBV looks just at
close-to-close up or down. An Acc/Dist calculation within an N-day window can
be made too, see <a class="ref" href="#Chaikin-Money-Flow">Chaikin Money Flow</a>.
</p>
<hr>
</div>
<div class="section-level-extent" id="Accumulative-Swing-Index">
<div class="nav-panel">
<p>
Next: <a href="#Aroon" accesskey="n" rel="next">Aroon</a>, Previous: <a href="#Accumulation_002fDistribution" accesskey="p" rel="prev">Accumulation/Distribution</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> [<a href="#Co...
lib/App/Chart/doc/chart.html view on Meta::CPAN
</div>
<h3 class="section" id="Random-Walk-Index-1"><span>10.37 Random Walk Index<a class="copiable-link" href="#Random-Walk-Index-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-Random-walk-index"></a>
<a class="index-entry-id" id="index-Index_002c-random-walk"></a>
<a class="index-entry-id" id="index-RWI"></a>
<p>The random walk index (RWI) by E. Michael Poulos is a measure of how much
price ranges over N days differ from what would be expected by a random walk
(randomly going up and down). A bigger than expected range suggests a trend.
</p>
<p>The index is in two parts, an RWI high which looks at upward movement and an
RWI low for downward movement. In Chart RWI high is shown in green, and RWI
low in red. The RWI high looks at terms like
</p>
<div class="example">
<pre class="example-preformatted">High[today] - Low[K] 1
-------------------- * ------
Average TR [K] sqrt(K)
</pre></div>
<p>which is the move from the low K days ago up to today’s high, scaled by an
average of the true range (TR, see <a class="pxref" href="#True-Range">True Range</a>). Such terms are calculated
for each number of days 2, 3, etc, up to the given RWI parameter N, and the
lib/App/Chart/doc/chart.html view on Meta::CPAN
</div>
<h3 class="section" id="TD-Range-Expansion-Index-1"><span>10.39 TD Range Expansion Index<a class="copiable-link" href="#TD-Range-Expansion-Index-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-TD-range-expansion-index"></a>
<a class="index-entry-id" id="index-Range-expansion-index"></a>
<a class="index-entry-id" id="index-TDREI"></a>
<a class="index-entry-id" id="index-DeMark_002c-Tom"></a>
<p>The range expansion index by Tom DeMark is designed to identify price
exhaustion which may be the end of a move up or down.
</p>
<p>The calculation is somewhat similar to an RSI (see <a class="pxref" href="#Relative-Strength-Index">Relative Strength Index</a>) but looks at 2-day changes in the daily high and daily low values and
smooths with a 5-day SMA (see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>). Changes are ignored
if the current day in not either within or covering price action from 5 or 6
days ago. That test effectively holds the indicator around zero while prices
are making breakaway runs.
</p>
<p>DeMark regarded values above <em class="math">+45</em> or below <em class="math">-45</em> as overbought or
oversold. Such a reading maintained for up to five days suggests a reversal,
except that if it remains there for 6 or more days then the signal may be
unreliable and trading should be avoided.
</p>
lib/App/Chart/doc/chart.html view on Meta::CPAN
<p>Additionally, on a GNU system the <code class="env">LANGUAGE</code> environment variable gives a
list of language preferences for message translations (see <a data-manual="libc" href="https://www.gnu.org/software/libc/manual/html_mono/libc.html#Using-gettextized-software">User influence on <code class="code">gettext</code></a> in <cite class="ci...
Reference Manual</cite>). For example to have Italian preferred, otherwise Spanish,
otherwise English,
</p>
<div class="example">
<pre class="example-preformatted">LANGUAGE=it_IT:es:en
export LANGUAGE
</pre></div>
<p>Chart looks at <code class="env">LANGUAGE</code> too (on all systems) for the preferred language
for stock and commodity names.
</p>
<hr>
</div>
</div>
<div class="chapter-level-extent" id="Emacs">
<div class="nav-panel">
<p>
Next: <a href="#Concept-Index" accesskey="n" rel="next">Concept Index</a>, Previous: <a href="#Internationalization" accesskey="p" rel="prev">Internationalization</a>, Up: <a href="#Top" accesskey="u" rel="up">Chart</a> [<a href="#Concept-Inde...
t/ListStoreDBISeq.t view on Meta::CPAN
use MyTestHelpers;
BEGIN { MyTestHelpers::nowarnings() }
use Test::More 0.82 tests => 1;
require App::Chart::Gtk2::Ex::ListStoreDBISeq;
# DBI::_new_dbh() and DBI::_new_sth() use substr() lvalue assignments which
# seems to keep the lexical target $imp_class alive, until the next call to
# each function, and that looks like a leak of the $imp_class values stored
# into $dbh->{'ImplementorClass'} and $sth->{'ImplementorClass'}, or rather
# in the underlying tied hash object. Dunno if this is some perl 5.10.0
# thing, but as a hack make a new run of _new_dbh() and _new_sth() here to
# clear out the scratchpad.
#
sub hack_clear_new_handle_scratchpad {
my $fh = File::Temp->new (TEMPLATE => 'dbh-scratchpad-XXXXXX',
SUFFIX => '.sqdb',
TMPDIR => 1);
my $filename = $fh->filename;
unused/Yahoo-v7.pm view on Meta::CPAN
# There's been some protocol hoops to jump through in recent times.
# It seems to be sometimes on the v7 form, maybe always on v11.
# The v7 had seemed fine asking for the latest few days daily data,
# and it's possible lately needs nothing for any amount.
#
# The hoops consist of
#
# - Fetch one of the finance.yahoo.com web pages to get a
# HTTP Set-Cookie header.
# - Maybe answer the ridiculous EU cookie consent on the page.
# Maybe that depends where your IP looks like it's from.
# - Look deep within script in that page for a "crumb" string.
# Or maybe a further "getcrumb" web fetch, but seems result
# is embedded in the page.
# - On each data download, HTTP Cookie header, and URL crumb
# field.
#
# Presumably this is designed as a level of difficulty, to stop the
# past quotes and data that could be had from a single URL (and which
# Yahoo apparently found was widely abused beyond personal use).
#
unused/Yahoo-v7.pm view on Meta::CPAN
#-----------------------------------------------------------------------------
# Info - Share Names
#
# This uses the info pages like
#
# https://query2.finance.yahoo.com/v1/finance/search?q=CSCO&enableFuzzyQuery=false
#
# which is a JSON format of various company information etc.
#
# The JSON looks like
# {"explains":[],
# "count":7,
# "quotes":[{"exchange":"NMS",
# "shortname":"Cisco Systems, Inc.",
# "quoteType":"EQUITY",
# "symbol":"CSCO",
# ...
#
# There can be multiple exchanges in the quotes list, use the first.
# Other fields include
unused/Yahoo-v7.pm view on Meta::CPAN
# case.
#
# For a public holiday it might be good to zap the volume to undef
# too, but don't have anything to distinguish holiday, suspension,
# delisting vs just no trades.
#
# On the ASX when shares are suspended the bid/offer can be crossed as
# usual for pre-open auction, and this gives high<low. For a part-day
# suspension then can have volume!=0 in this case too. Don't want to
# show a high<low, so massage high/low to open/close range if the high
# looks like a crossed offer.
if (defined $high && defined $low && $high < $low) {
$high = App::Chart::max_maybe ($open, $close);
$low = App::Chart::min_maybe ($open, $close);
}
if (defined $open && defined $low && defined $close && defined $volume
&& $open == $low && $low == $close && $volume == 0) {
$open = undef;
$high = undef;
unused/YahooOld.pm view on Meta::CPAN
# case.
#
# For a public holiday it might be good to zap the volume to undef
# too, but don't have anything to distinguish holiday, suspension,
# delisting vs just no trades.
#
# On the ASX when shares are suspended the bid/offer can be crossed as
# usual for pre-open auction, and this gives high<low. For a part-day
# suspension then can have volume!=0 in this case too. Don't want to
# show a high<low, so massage high/low to open/close range if the high
# looks like a crossed offer.
if (defined $high && defined $low && $high < $low) {
$high = App::Chart::max_maybe ($open, $close);
$low = App::Chart::min_maybe ($open, $close);
}
if (defined $open && defined $low && defined $close && defined $volume
&& $open == $low && $low == $close && $volume == 0) {
$open = undef;
$high = undef;
xt/0-META-read.t view on Meta::CPAN
BEGIN { MyTestHelpers::nowarnings(); }
# When some of META.yml is generated by explicit text in Makefile.PL it can
# be easy to make a mistake in the syntax, or indentation, etc, so the idea
# here is to check it's readable from some of the YAML readers.
#
# The various readers differ in how strictly they look at the syntax.
# There's no attempt here to say one of them is best or tightest or
# whatever, just see that they all work.
#
# See 0-Test-YAML-Meta.t for Test::YAML::Meta which looks into field
# contents, as well as maybe the YAML formatting.
my $meta_filename;
# allow for ancient perl, maybe
eval { require FindBin; 1 } # new in 5.004
or plan skip_all => "FindBin not available -- $@";
eval { require File::Spec; 1 } # new in 5.005
or plan skip_all => "File::Spec not available -- $@";
diag "FindBin $FindBin::Bin";
xtools/my-wunused.sh view on Meta::CPAN
if test -e "$i/*.pm"; then
LINT_FILES="$LINT_FILES $i/*.pm"
fi
done
echo "$LINT_FILES"
for i in $LINT_FILES; do
# warnings::unused broken by perl 5.14, so use 5.10 for checks
perl -I /usr/share/perl5 -Mwarnings::unused=-global -I lib -c $i
# # full path name or else the "require" looks through @INC
# echo "\"$i\""
# perl -e 'use Test::More tests=>1; use Test::Vars; Test::Vars::vars_ok($ARGV[0])' "`pwd`/$i"
done