App-Chart

 view release on metacpan or  search on metacpan

devel/makefile-from-grep.pl  view on Meta::CPAN

#------------------------------------------------------------------------------
package MyModuleDepends;
use Devel::StackTrace;
use base 'Module::Depends::Intrusive';

sub requires {
  my $self = shift;
  if (@_) {
    # store
    my $trace = Devel::StackTrace->new;
    my $frame = $trace->frame(2)
      || die "oops, no frame(2):\n$trace";
    my %writeargs = $frame->args;
    $self->{'extra_meta'} = $writeargs{'EXTRA_META'};
  }
  return $self->SUPER::requires (@_);
}

doc/chart.texi  view on Meta::CPAN

texinfo, Texinfo}) and DVI, PS and PDF require various @TeX{} and Texinfo
tools.  PDF also requires either @command{epstopdf} from Texlive or TeTeX, or
@command{ps2pdf} from Ghostscript.
@cindex DocBook manual
@cindex XML manual
@command{makeinfo} can produce other formats, including DocBook and XML
(@pxref{makeinfo options,, Options for @command{makeinfo}, texinfo, Texinfo}).

@item Scrollkeeper
@cindex OMF
@cindex Open metadata framework
@cindex Scrollkeeper
@cindex Yelp
@cindex @command{gnome-help}
A Scrollkeeper entry
(@uref{http://scrollkeeper.sourceforge.net}) @file{doc/chart.omf} is included
for the manual (HTML form).  It can be used by Gnome help (Yelp) and similar
programs.  Currently it's not automatically installed but you can copy to
@file{/usr/share/omf/chart/chart.omf} and run @command{scrollkeeper-update}.

@item User Directory

doc/chart.texi  view on Meta::CPAN

@c any average on an indicator (@pxref{View Style}).


@c ---------------------------------------------------------------------------
@node RAVI, Relative Strength Index, R-Squared Index, Indicators
@section RAVI
@cindex RAVI

RAVI is a simple indicator showing whether a stock is trending.  It calculates
the percentage difference between current prices and older prices.  Current
prices are represented by a short SMA and the longer time frame by a long SMA
(@pxref{Simple Moving Average}).  The defaults are 7 days and 65 days.

@tex
$$ RAVI = 100 \times { | SMA[short] - SMA[long] | \over SMA[long] }$$
@end tex
@ifnottex
@example
             abs (SMA[short] - SMA[long])
RAVI = 100 * ----------------------------
                      SMA[long]

doc/chart.texi  view on Meta::CPAN

watchlist (@pxref{Watchlist}) opens an intraday image window for the current
symbol, showing trading today, or so-far today.

Alas there are no longer any data sources with intraday images.

@c are only
@c available from a few data sources (@pxref{Data Sources}).

@c @cindex @key{Alt-R}
@c The default display is 1-day, downloaded when the window is opened (then
@c cached).  The option menu can select other timeframes such as 5-day, depending
@c on the data source.  The underlined mnemonics ``5'' etc in the menu are
@c accelerator keys, eg.@: @key{Alt-5}.  Click on Refresh (@key{Alt-R}) to update
@c as trading progresses through the day.
@c 
@c Multiple intraday windows can be opened, or a new symbol entered in the text
@c box to view a different symbol (press @key{Return} or click the ``Enter''
@c button).
@c 
@c To see the intraday for a symbol not in the database or watchlist just open an
@c intraday window for any symbol (or no symbol at all) then enter the desired

emacs/chartprog.el  view on Meta::CPAN

(defvar chartprog-header-line-scrolling-str nil
  "An internal part of chartprog.el.
Buffer local full `header-line-format' string to be hscrolled.")

(defun chartprog-header-line-scrolling-align ()
  "An internal part of chartprog.el.
Return a string which will align to column 0 in a `header-line-format'."
  (if (string-match "^21\\." emacs-version)
      (and (display-graphic-p)
           (concat " "  ;; the fringe
                   (and (eq 'left (frame-parameter nil 'vertical-scroll-bars))
                        "  ")))  ;; left scrollbar
    ;; in emacs 22 and up align-to understands fringe and scrollbar
    chartprog-header-line-scrolling-align0))

(defun chartprog-header-line-scrolling-eval ()
  "An internal part of chartprog.el.
Install hscrolling header line updates on the windows of the current frame."
  (concat (chartprog-header-line-scrolling-align)
          (substring chartprog-header-line-scrolling-str
                     (min (length chartprog-header-line-scrolling-str)
                          (window-hscroll)))))

(defun chartprog-header-line-scrolling (str)
  "An internal part of chartprog.el.
Set STR as `header-line-format' and make it follow any hscrolling."
  (set (make-local-variable 'chartprog-header-line-scrolling-str) str)
  (set (make-local-variable 'header-line-format)

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

                DMI      => 'indicator',
                DSS      => 'indicator',
                EMA      => 'average',
                ENV      => 'average',
                EPMA     => 'average',
                EVWMA    => 'average',
                ElderRay => 'indicator',
                FISH     => 'indicator',
                FRAMA    => 'average',
                ForceIndex    => 'indicator',
                FromTimeframe => 'special',  # time collapsing
                GAPO          => 'indicator',
                GMEAN         => [ 'indicator', __('GT Misc') ],
                HilbertPeriod => [ 'indicator', __('GT Misc') ],
                HilbertSine   => [ 'indicator', __('GT Misc') ],
                IFISH         => 'indicator',
                InstantTrendLine => 'average',
                Interquartil => 'indicator',
                KAMA    => 'average',
                Keltner => 'average',
                KirshenbaumBands => 'average',

lib/App/Chart/Pango/Ex/ANSItoMarkup.pm  view on Meta::CPAN

        } elsif ($num >= 40 && $num <= 47) {
          $attr->[_A_BACKGROUND] = 'background=' . $colour[$num-40];

          # 48 reserved (for background colour)

        } elsif ($num == 49) {
          # default background colour
          $attr->[_A_BACKGROUND] = undef;

          # 50 reserved (for cancelling 26 proportional spacing)
          # 51 framed
          # 52 encircled
          # 53 overlined
          #     no overline in pango markup
          # 54 not framed or encircled
          # 55 not overlined
          # 56-59 reserved
          # 60 ideogram underline right side line
          # 61 ideogram double underline right side line
          # 62 ideogram overline left side line
          # 63 ideogram double overline left side
          # 64 ideogram stress
          # 65 ideogram normal, ie. undo 60-64
        }
      }

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


use GT::Prices;
use GT::Conf;
use GT::Eval;
use GT::DateTime;
use GT::Tools;

use constant DEBUG => 0;


my %class_to_timeframe = ('App::Chart::Timebase::Days'   => $DAY,
                          'App::Chart::Timebase::Weeks'  => $WEEK,
                          'App::Chart::Timebase::Months' => $MONTH,
                          'App::Chart::Timebase::Years'  => $YEAR);

sub new {
  my ($class, $type, $parent, @args) = @_;
  if (DEBUG) { local $,=' '; print "GT->new type '$type' args", @args, "\n"; }
  my $indicator = GT::Eval::create_standard_object ($type, @args);
  my $nb_values = $indicator->get_nb_values;
  my $arrays = {};

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

  my $parent = $self->{'parent'};
  my $timebase = $self->timebase;
  my $indicator = $self->{'indicator'};

  require GT::DB::Chart;
  my $db = GT::DB::Chart->new ($parent, $hi);
  my $code = $parent->symbol || 'DUMMY-STOCK-CODE';
  my $timebase_class = ref $timebase;
  # ENHANCE-ME: can probably fallback to $DAYS or something for unknown
  # $timebase_class, not much in the GT indicators depends on the timebase
  my $timeframe = $class_to_timeframe{$timebase_class}
    || croak "Timebase class $timebase_class not known to GT";
  my $full = 0;
  my $start = $timebase->to_iso ($lo);
  my $end = $timebase->to_iso ($hi);
  my $nb_item = 0;
  my $max_loaded_items = $hi - $lo + 1 + $indicator->days_required;

  if (DEBUG) { print "  find_calculator  start=$start end=$end code=$code timeframe=$timeframe max_loaded_items=$max_loaded_items\n"; }
  my ($calc, $first, $last);

  if (! eval {
    ($calc, $first, $last) = GT::Tools::find_calculator
      ($db, $code, $timeframe, $full, $start,$end,$nb_item,$max_loaded_items);
    1
  }) {
    if ($@ =~ /No data available/i) { return; }
    die $@;
  }
  if (DEBUG) { print "  gives  first=$first last=$last\n"; }

  $indicator->calculate_interval ($calc, $first, $last);

  my $nb_values = $indicator->get_nb_values;

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

   choose   => [ 'Asia/Bombay', 'Asia/Calcutta', 'Asia/Kolkata' ],
   fallback => 'IST-5:30');

my $pred = App::Chart::Sympred::Suffix->new ('.NS');
$timezone_mumbai->setup_for_symbol ($pred);


#------------------------------------------------------------------------------
# weblink - NSE company info
#
# Eg., and normally shown in a frame,
#
# http://www.nseindia.com/marketinfo/companyinfo/eod/address.jsp?symbol=SESAGOA

App::Chart::Weblink->new
  (pred => $pred,
   name => __('NSE _Company Information'),
   desc => __('Open web browser at the National Stock Exchange of India page for this company'),
   proc => sub {
     my ($symbol) = @_;
     # there's links on this page to other info, including a current quote

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

my $pred = App::Chart::Sympred::Suffix->new ('.SICOM');
App::Chart::TZ->tokyo->setup_for_symbol ($pred);

# (source-help! sicom-symbol?
# 	      __p('manual-node','Singapore Commodities Exchange'))


#------------------------------------------------------------------------------
# weblink - contract specifications
#
# These links are as per the home page and they open in a frame.  The
# individual pages are http://www.sicom.com.sg/robusta.htm etc.

my %specs = ('RS' => 'http://www.sicom.com.sg/index_sub.asp?content=rss1',
             'RT' => 'http://www.sicom.com.sg/index_sub.asp?content=rss3',
             'TF' => 'http://www.sicom.com.sg/index_sub.asp?content=tsr20',
             'RI' => 'http://www.sicom.com.sg/index_sub.asp?content=rss3index',
             'CF' => 'http://www.sicom.com.sg/index_sub.asp?content=robusta');

App::Chart::Weblink->new
  (pred => $pred,

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

enough of Chart&rsquo;s Perl dependencies installed to run the <samp class="file">doc/weights.pl</samp>
script, then Info requires <code class="command">makeinfo</code> (see <a data-manual="texinfo" href="https://www.gnu.org/software/texinfo/manual/texinfo/texinfo.html#Creating-an-Info-File">Creating an Info File</a> in <cite class="cite">Texinfo</cite...
tools.  PDF also requires either <code class="command">epstopdf</code> from Texlive or TeTeX, or
<code class="command">ps2pdf</code> from Ghostscript.
<a class="index-entry-id" id="index-DocBook-manual"></a>
<a class="index-entry-id" id="index-XML-manual"></a>
<code class="command">makeinfo</code> can produce other formats, including DocBook and XML
(see <a data-manual="texinfo" href="https://www.gnu.org/software/texinfo/manual/texinfo/texinfo.html#makeinfo-options">Options for <code class="command">makeinfo</code></a> in <cite class="cite">Texinfo</cite>).
</p>
</dd>
<dt><a class="index-entry-id" id="index-Open-metadata-framework"></a>
<a class="index-entry-id" id="index-Scrollkeeper"></a>
<a class="index-entry-id" id="index-Yelp"></a>
<a class="index-entry-id" id="index-gnome_002dhelp"></a>
<a id="index-OMF"></a><span>Scrollkeeper<a class="copiable-link" href="#index-OMF"> &para;</a></span></dt>
<dd><p>A Scrollkeeper entry
(<a class="uref" href="http://scrollkeeper.sourceforge.net">http://scrollkeeper.sourceforge.net</a>) <samp class="file">doc/chart.omf</samp> is included
for the manual (HTML form).  It can be used by Gnome help (Yelp) and similar
programs.  Currently it&rsquo;s not automatically installed but you can copy to
<samp class="file">/usr/share/omf/chart/chart.omf</samp> and run <code class="command">scrollkeeper-update</code>.
</p>

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

<div class="section-level-extent" id="RAVI">
<div class="nav-panel">
<p>
Next: <a href="#Relative-Strength-Index" accesskey="n" rel="next">Relative Strength Index</a>, Previous: <a href="#R_002dSquared-Index" accesskey="p" rel="prev">R-Squared Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbs...
</div>
<h3 class="section" id="RAVI-1"><span>10.33 RAVI<a class="copiable-link" href="#RAVI-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-RAVI"></a>

<p>RAVI is a simple indicator showing whether a stock is trending.  It calculates
the percentage difference between current prices and older prices.  Current
prices are represented by a short SMA and the longer time frame by a long SMA
(see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).  The defaults are 7 days and 65 days.
</p>
<div class="example">
<pre class="example-preformatted">             abs (SMA[short] - SMA[long])
RAVI = 100 * ----------------------------
                      SMA[long]
</pre></div>


<hr>

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

<tr><td></td><td class="printindex-index-entry"><a href="#index-NYSE-1">NYSE</a></td><td class="printindex-index-section"><a href="#Yahoo-Exchanges">Yahoo Exchanges</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-NZX">NZX</a></td><td class="printindex-index-section"><a href="#New-Zealand-Stock-Exchange">New Zealand Stock Exchange</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-O">O</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OBV">OBV</a></td><td class="printindex-index-section"><a href="#On_002dBalance-Volume">On-Balance Volume</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OHLC">OHLC</a></td><td class="printindex-index-section"><a href="#Main-Window">Main Window</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OHLC-1">OHLC</a></td><td class="printindex-index-section"><a href="#View-Style">View Style</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OMF">OMF</a></td><td class="printindex-index-section"><a href="#Installing">Installing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-On_002dbalance-volume">On-balance volume</a></td><td class="printindex-index-section"><a href="#On_002dBalance-Volume">On-Balance Volume</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Open">Open</a></td><td class="printindex-index-section"><a href="#Open">Open</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Open-metadata-framework">Open metadata framework</a></td><td class="printindex-index-section"><a href="#Installing">Installing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OpenSSL">OpenSSL</a></td><td class="printindex-index-section"><a href="#Installing">Installing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Options">Options</a></td><td class="printindex-index-section"><a href="#Invocation">Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oscillator_002c-Chaikin">Oscillator, Chaikin</a></td><td class="printindex-index-section"><a href="#Chaikin-Oscillator">Chaikin Oscillator</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oscillator_002c-detrended-price">Oscillator, detrended price</a></td><td class="printindex-index-section"><a href="#Detrended-Price-Oscillator">Detrended Price Oscillator</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oscillator_002c-forecast">Oscillator, forecast</a></td><td class="printindex-index-section"><a href="#Forecast-Oscillator">Forecast Oscillator</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oscillator_002c-Klinger-volume">Oscillator, Klinger volume</a></td><td class="printindex-index-section"><a href="#Klinger-Volume-Oscillator">Klinger Volume Oscillator</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oscillator_002c-pretty-good">Oscillator, pretty good</a></td><td class="printindex-index-section"><a href="#Pretty-Good-Oscillator">Pretty Good Oscillator</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oscillators">Oscillators</a></td><td class="printindex-index-section"><a href="#Indicators">Indicators</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oslo-Bors">Oslo Bors</a></td><td class="printindex-index-section"><a href="#Yahoo-Exchanges">Yahoo Exchanges</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Oslo-Stock-Exchange">Oslo Stock Exchange</a></td><td class="printindex-index-section"><a href="#Yahoo-Exchanges">Yahoo Exchanges</a></td></tr>

lib/GT/DB/Chart.pm  view on Meta::CPAN

  return App::Chart::Database->symbol_exists ($symbol);
}

sub get_db_name {
  my ($self, $symbol) = @_;
  ### GT-DB-Chart get_db_name(): $symbol
  require App::Chart::Database;
  return App::Chart::Database->symbol_name ($symbol);
}

my %timeframe_to_class = ($WEEK  => 'Weeks',
                          $MONTH => 'Months',
                          $YEAR  => 'Years');

sub get_prices {
  my ($self, $symbol, $timeframe) = @_;
  return $self->get_last_prices ($symbol, -1, $timeframe);
}

sub get_last_prices {
  my ($self, $symbol, $limit, $timeframe) = @_;
  ### GT-DB-Chart get_last_prices(): $symbol
  ### $limit
  ### $timeframe

  $timeframe ||= $DAY;
  my $prices = GT::Prices->new;
  $prices->set_timeframe ($timeframe);

  if ($timeframe < $DAY) {
    ### no intraday data
    return $prices;
  }
  if ($limit == 0) {
    return $prices;
  }

  my $series = $self->{'series'} || do {
    require App::Chart::Series::Database;
    App::Chart::Series::Database->new ($symbol);
  };
  if ($timeframe != $DAY) {
    # can leave this to GT::Tools too, maybe
    my $class = $timeframe_to_class{$timeframe}
      or croak __PACKAGE__.": unrecognised timeframe $timeframe";
    $series = $series->collapse ($class);
  }

  my $hi = $self->{'hi'} // $series->hi;
  my $lo;
  if ($limit == -1) {
    $lo = 0; # all data
  } else {
    # the newest $limit many values
    $lo = $series->find_before ($hi, $limit-1);

lib/GT/DB/Chart.pm  view on Meta::CPAN


=item C<< $db = GT::DB::Chart->new() >>

Create and return a new C<GT::DB::Chart> object to retrieve data from
the Chart database (F<~/Chart/database.sqdb>).

=item C<< $db->disconnect() >>

Disconnect from the Chart database.

=item C<< $prices = $db->get_prices ($symbol, $timeframe) >>

=item C<< $prices = $db->get_last_prices ($symbol, $limit, $timeframe) >>

Create and return a C<GT::Prices> object with the data for C<$symbol> in the
given C<$timeframe> increments.  C<$timeframe> can be C<$DAYS>, C<$WEEKS>,
C<$MONTHS> or C<$YEARS>.

C<get_prices()> returns all available data for C<$symbol>,
C<get_last_prices()> returns only the most recent C<$limit> many values (or
as many as available).  For example to get the last 250 trading days,

    my $prices = $db->get_last_prices ('GM', 250,
                                       $GT::Prices::DAYS);

=item C<< $str = $db->get_db_name ($symbol) >>

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

# BEGIN { push @INC, '/usr/share/perl5'; }

use strict;
use warnings;
use GT::Prices;
use GT::DB::Chart;
use GT::Prices;
use GT::Conf;
use GT::Eval;
use GT::DateTime;
use GT::Tools qw(:timeframe);

GT::Conf::load();

{
  my $symbol = 'IIF.AX';
  $symbol = 'GXY.AX';


  # my $indicator = create_standard_object("I:BOL");
  # my $indicator = create_standard_object("I:SMA", 10);

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


  # my $prices = $db->get_prices ($symbol, $DAY);

  # my $indicator = GT::Eval::create_standard_object("I:SMA",
  #                                                  "12 {I:Prices CLOSE\}");

  my $nb_values = $indicator->get_nb_values;
  print "indicator nb_values $nb_values\n";

  my $code = $symbol;
  my $timeframe = $DAY;
  my $full = 0;
  my $start = '2008-03-02';
  my $end = '2008-04-01';
  my $nb_item = 10;
  my $max_loaded_items = -1;

  print "timeframe $DAY\n";

  my ($calc, $first, $last) = find_calculator
    ($db, $code, $timeframe, $full, $start, $end, $nb_item, $max_loaded_items);

  print "calc  $calc\n";
  print "first $first\n";
  print "last  $last\n";

  print "calc indicators ", $calc->indicators, "\n";

  print "name ", $indicator->get_name, "\n";

  # $indicator->calculate_all ($calc);

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

      } else {
        print "not avail\n";
      }
    }
  }

  exit 0;
}

{
  my $available_timeframes = GT::Conf::get('DB::timeframes_available');
  require Data::Dumper;
  print  Data::Dumper->Dump([$available_timeframes],['available_timeframes']);

  my @tf = GT::DateTime::list_of_timeframe;
  print  Data::Dumper->Dump([\@tf],['list_of_timeframe']);

  exit 0;
}

{
  exit 0;
}



( run in 1.714 second using v1.01-cache-2.11-cpan-e1769b4cff6 )