App-Chart

 view release on metacpan or  search on metacpan

COPYING  view on Meta::CPAN


  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

doc/chart.texi  view on Meta::CPAN

@cindex Investment advice
Note that Chart is only a program for displaying data.  The program and this
manual do not give financial advice.

@section Data Copying
@cindex Copying, data
@cindex Data copying
@cindex License, data

The data that Chart may download or display will be copyright to the creator
of that data and will be provided under terms decided by the creator.  You
must check each data source used to see that you and your intended use are
within the terms (@pxref{Data Sources}).  The minimum for a source in Chart is
that personal non-commercial use is permitted.  Usually no re-distribution is
permitted.

The author believes that the manipulations Chart performs on downloaded data
are purely mechanical and do not cause the program's terms to be added to any
results.  Derived forms like the database files, watchlist quotes, screenshots
of graphs, etc, will be subject only to the conditions of the data originators
(cumulatively if data from more than one source is shown).

doc/chart.texi  view on Meta::CPAN

The %K line is drawn in red and the %D line in green.

@cindex Fast stochastics
@cindex Slow stochastics
%K and %D just described are called the ``fast'' stochastics.  Corresponding
``slow'' stochastics are formed by smoothing %K with a simple moving average,
and calculating %D from that smoothed series.  The extra smoothing is the
``slow days'' parameter in Chart.  The default is 0 for no slowing, a value of
3 is often used.

Incidentally, a value of 1 for the slowing is the same as no slowing, because
a 1-period SMA of course doesn't change the data.


@c ---------------------------------------------------------------------------
@node TD Range Expansion Index, Trend Intensity Index, Stochastics, Indicators
@section TD Range Expansion Index
@cindex TD range expansion index
@cindex Range expansion index
@cindex TDREI

doc/chart.texi  view on Meta::CPAN

@c SYMBOL: AUDSDR.RBA
@end multitable
@end quotation

The historical data page
@uref{http://www.rba.gov.au/statistics/historical-data.html} has XLS files
going back to 1983 (and monthly to 1969) but the code for that in Chart has
bit-rotted and the CSV is about half the size.  The server offers compressed
downloads (@pxref{Installing}).

@c Incidentally, the historical data processing in Chart is very slow.  The main
@c bottleneck is @code{Spreadsheet::ParseExcel} apparently due to lots of
@c formatted rows in the XLS files.


@c ---------------------------------------------------------------------------
@node Thrift Savings Plan, Yahoo Finance, Reserve Bank of Australia, Data Sources
@section Thrift Savings Plan
@cindex Thrift Savings Plan
@cindex TSP
@cindex Funds, TSP

lib/App/Chart/DownloadCost.pm  view on Meta::CPAN


sub cost_get {
  my ($key, $default) = @_;
  my $cost = App::Chart::Database->read_extra ('', $key);
  return (defined $cost ? $cost : $default);
}


# going by day or by symbol
#
# Decide whether to use daily downloads or individual symbol downloads to
# update all of SYMBOL-LIST.  Download will be from the
# `download-start-tdate' of each symbol, up to AVAIL-TDATE.
#
# DAILY-COST is the cost (in bytes) to download a day.
# (SYMBOL-COST-PROC tdate) should return the cost of downloading from TDATE
# to now (ie. AVAIL-TDATE) for a symbol.
# Both costs will get `http-get-cost' added to them automatically.
#
# The return is two values (USE-SYMBOL-LIST TDATE), which is a list of
# symbols to do individually, and a tdate to start from for daily

lib/App/Chart/Glib/Ex/DirBroadcast.pm  view on Meta::CPAN

 App::Chart::Glib::Ex::DirBroadcast->send ('my-key', "hello\n");

=head1 DESCRIPTION

DirBroadcast is a message broadcasting system based on named pipes in a
given directory, with a Glib main loop IO watch listening and calling
connected handlers.  It's intended for use between multiple running copies
of a single application so they can notify each other of changes to files
etc.

Messages have a string "key" which is a name or type decided by the
application, and then any parameters which Storable can handle
(L<Storable>).  You can have either a single broadcast directory used for
all purposes, or create multiple DirBroadcast objects.  The method functions
described below take either the class name C<App::Chart::Glib::Ex::DirBroadcast> for the
single global, or a DirBroadcast object.

=head1 FUNCTIONS

=over 4

lib/App/Chart/Google.pm  view on Meta::CPAN


#-----------------------------------------------------------------------------
# download
#
# This uses the historical prices page like
#
#     http://www.google.com/finance/historical?q=AAPL
#
# which used to have a CSV link like
#
#     http://www.google.com/finance/historical?cid=22144&startdate=Aug+15%2C+2008&enddate=Aug+14%2C+2009&output=csv
#
# but maybe now is only the HTML.  No data available for ASX prefs apparently.
#

App::Chart::DownloadHandler::IndivChunks->new
  (name       => __('Google'),
   pred       => $google_pred,
   available_tdate_by_symbol => \&daily_available_tdate,
   available_tdate_extra     => 1,
   url_func   => \&daily_url,

lib/App/Chart/Google.pm  view on Meta::CPAN

   chunk_size => 500);

sub daily_available_tdate {
  my ($symbol) = @_;
  return App::Chart::Download::tdate_today_after
    (18,0, App::Chart::TZ->for_symbol ($symbol));
}

my @month_to_Mmm = qw(0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

# making: http://www.google.com/finance/historical?cid=22144&startdate=Feb+13%2C+2008&enddate=Oct+6%2C+2008&output=csv
sub daily_url {
  my ($symbol, $lo_tdate, $hi_tdate) = @_;
  my ($lo_year, $lo_month, $lo_day) = App::Chart::tdate_to_ymd ($lo_tdate);
  my ($hi_year, $hi_month, $hi_day) = App::Chart::tdate_to_ymd ($hi_tdate);

  return 'http://www.google.com/finance/historical?q='
    . URI::Escape::uri_escape($symbol)
      . '&startdate='
        . $month_to_Mmm[$lo_month] . '+' . $lo_day . '%2C+' . $lo_year
          . '&enddate='

lib/App/Chart/Gtk2/AdjScale.pm  view on Meta::CPAN

# 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/>.


# gravity up,down,centre
# stick to start/end if already there
# which of upper/lower to grow
# set_page_range wait until first size_allocate to decide vpp,ppv
# choice keep vpp same and expand page, or keep page and adjust vpp
# integer ppv



package App::Chart::Gtk2::AdjScale;
use 5.008;
use strict;
use warnings;
use Glib::Ex::FreezeNotify;

lib/App/Chart/Gtk2/Graph.pm  view on Meta::CPAN

    }
  }

 OUTER: for (my $i = $hi; $i >= $lo; $i--) {
    foreach my $array (@arrays) {
      $accumulate->($array->[$i])
        or last OUTER;
    }
  }
  if (! defined $l) { return; }
  ### decided: "$l to $h"

  my $extra = $page - ($h - $l);
  $l -= $extra / 2;
  ### expand to: "low $l on page $page"
  $vadj->set_value ($l);
}


#------------------------------------------------------------------------------
# scrolling

lib/App/Chart/Gtk2/IntradayImage.pm  view on Meta::CPAN

  my ($self, $req) = @_;
  ### IntradayImage _do_size_request()
  my $pixbuf = _load_pixbuf ($self);
  if (ref $pixbuf) {
    $req->width ($pixbuf->get_width);
    $req->height ($pixbuf->get_height);
  } else {
    $req->width (35 * Gtk2::Ex::Units::em($self));
    $req->height (6 * Gtk2::Ex::Units::line_height($self));
  }
  ### _do_size_request() decide: $req->width."x".$req->height
}

# 'expose-event' class closure
sub _do_expose_event {
  my ($self, $event) = @_;
  ### IntradayImage _do_expose_event(): $self->get_name.' "'.($self->{'symbol'}||'[nosymbol]').'" "'.($self->{'mode'}||'[nomode]').'"'
  my $win = $self->window;

  # Reading the database on every expose probably isn't fast, but we're not
  # expecting to scroll or anything much, so leaving the data on disk might

lib/App/Chart/Gtk2/View.pm  view on Meta::CPAN

  my $value = $upper;
  my $today = $today_hrange[0];
  if (defined $today) {
    if ($upper > $today + 10) {
      $value = $today + 4;
    }
  }
  $value -= $hadj->page_size;
  $lower = min ($lower, $value);

  ### View decide hadj: "$lower to $upper, value=$value"
  Gtk2::Ex::AdjustmentBits::set_maybe ($hadj,
                                       lower => $lower,
                                       upper => $upper,
                                       value => $value);
  ### View hadj: $hadj->lower." to $upper =",$timebase->to_iso($upper)
  my ($lo, $hi) = $hadj->value_range_inc;

  foreach my $graph (@$graphs) {
    $graph->update_v_range;

lib/App/Chart/Series.pm  view on Meta::CPAN

  }
  for (my $i = $hi; $i >= $lo; $i--) {
    foreach my $value ($values->[$i], $highs->[$i], $lows->[$i]) {
      $accumulate->($value);
    }
  }

  my $extra = ($page - ($h - $l)) / 2;
  $l -= $extra;
  $h += $extra;
  ### initial range decided: "$l $h   $self"
  return ($l, $h);
}

# 	    # don't go below `datatype-minimum' (if present), so long as
# 	    # the actual data respects that minimum
# 	    (and-let* ((minimum    (datatype-minimum datatype))
# 		       (actual-min (apply min-maybe lst-closes))
# 		       (           (>= actual-min minimum)))
# 	      (set! lower (max lower minimum)))

lib/App/Chart/Series/Derived/Adjust.pm  view on Meta::CPAN

}

sub derive {
  my ($class, $parent, %options) = @_;

  my $adjust_splits     = $options{'adjust_splits'};
  my $adjust_dividends  = $options{'adjust_dividends'};
  if (! $adjust_splits && ! $adjust_dividends) { return $parent; }

  # Only go up to today (in the symbol's timezone) for adjustments.  Stuff
  # in the future shouldn't be applied until then.  Decide this at init time
  # in case we live long enough for the time to reach a new day.
  #
  my $symbol = $parent->{'symbol'};
  my $timezone = App::Chart::TZ->for_symbol ($symbol);
  my $hi_iso = $timezone->iso_date;

  my $timebase = $parent->timebase;
  my $lo_iso = $timebase->to_iso (0);

  # if for each option it's either not wanted or there's no data for it,

lib/App/Chart/Series/Derived/ZigZag.pm  view on Meta::CPAN

      my $ret_val = $extreme;
      $direction = $rising;
      $extreme = $high;
      $extreme_pos = $pos;
      $target = $extreme * $factor_decrease;
      return $ret_pos, $ret_val;
    }
    return;
  };

  # decide initial direction rising or falling
  {
    my $high;
    my $high_pos;
    my $low;
    my $low_pos;

    foreach my $i (0 .. $hi) {
      my $value = $p->[$i] // next;
      my $this_high = $ph->[$i] // $value;
      my $this_low  = $pl->[$i] // $value;

lib/App/Chart/Suffix/LJ.pm  view on Meta::CPAN

      # dividend date is empty, apparently, otherwise would show "ex" as note
      #
      # other notes:
      # A - cross
      # B - block trades
      # o - utilized tax allowance
      # S - temporary suspension
      # Z - temporary halt
      # * - 10% limit move
      # NP - data not received
      # D - shareholders meeting will decide dividend
      # V - interim dividend
      # Q - P/E calculated prev year, without Q two years before
      #
      if ($elem->{'note'} =~ /Z/ || $elem->{'note'} =~ /S/) {
        $elem->{'halt'} = 1;
      }
      if ($elem->{'note'} =~ /\*/) {
        if ($elem->{'change'} >= 0) {
          $elem->{'limit_up'} = 1;
        } else {

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<ul class="mini-toc">
<li><a href="#Data-Copying" accesskey="1">Data Copying</a></li>
</ul>
<div class="section-level-extent" id="Data-Copying">
<h3 class="section"><span>2.1 Data Copying<a class="copiable-link" href="#Data-Copying"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Copying_002c-data"></a>
<a class="index-entry-id" id="index-Data-copying"></a>
<a class="index-entry-id" id="index-License_002c-data"></a>

<p>The data that Chart may download or display will be copyright to the creator
of that data and will be provided under terms decided by the creator.  You
must check each data source used to see that you and your intended use are
within the terms (see <a class="pxref" href="#Data-Sources">Data Sources</a>).  The minimum for a source in Chart is
that personal non-commercial use is permitted.  Usually no re-distribution is
permitted.
</p>
<p>The author believes that the manipulations Chart performs on downloaded data
are purely mechanical and do not cause the program&rsquo;s terms to be added to any
results.  Derived forms like the database files, watchlist quotes, screenshots
of graphs, etc, will be subject only to the conditions of the data originators
(cumulatively if data from more than one source is shown).

lib/App/Chart/doc/chart.html  view on Meta::CPAN

The %K line is drawn in red and the %D line in green.
</p>
<a class="index-entry-id" id="index-Fast-stochastics"></a>
<a class="index-entry-id" id="index-Slow-stochastics"></a>
<p>%K and %D just described are called the &ldquo;fast&rdquo; stochastics.  Corresponding
&ldquo;slow&rdquo; stochastics are formed by smoothing %K with a simple moving average,
and calculating %D from that smoothed series.  The extra smoothing is the
&ldquo;slow days&rdquo; parameter in Chart.  The default is 0 for no slowing, a value of
3 is often used.
</p>
<p>Incidentally, a value of 1 for the slowing is the same as no slowing, because
a 1-period SMA of course doesn&rsquo;t change the data.
</p>

<hr>
</div>
<div class="section-level-extent" id="TD-Range-Expansion-Index">
<div class="nav-panel">
<p>
Next: <a href="#Trend-Intensity-Index" accesskey="n" rel="next">Trend Intensity Index</a>, Previous: <a href="#Stochastics" accesskey="p" rel="prev">Stochastics</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href="#Co...
</div>

misc/t-float.pl  view on Meta::CPAN

  my $symbol_list = [ $glob->symbols ];
  my $avail = App::Chart::Float::available_tdate();

  my ($whole_tdate, @indiv_list) = App::Chart::DownloadCost::by_day_or_by_symbol
    (available_tdate  => $avail,
     symbol_list      => $symbol_list,
     indiv_cost_key     => 'float-indiv-zip',
     indiv_cost_default => 30000, # depending when first listed
     whole_cost_key     => 'float-wholeday-zip',
     whole_cost_default => 45000); # Sep 2007
  print "Decided $whole_tdate indiv ", join(' ', @indiv_list), "\n";
  exit 0;
}

{
  App::Chart::Download::consider_historical (['SGW.AX']);
  exit 0;
}
{
  my ($whole_tdate, @indiv_list) = App::Chart::Float::by_day_or_by_symbol
    (available_tdate  => 9886,

po/README  view on Meta::CPAN

---------------------------------------------------------------------


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.




( run in 1.581 second using v1.01-cache-2.11-cpan-de7293f3b23 )