App-Chart

 view release on metacpan or  search on metacpan

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

    $elem[$VOLUME] = $volumes->[$t] || 0;
    $elem[$DATE]   = $timebase->to_iso($t);
    $prices->add_prices (\@elem);  # added in ascending date order
  }
  return $prices;
}

1;
__END__

=for stopwords GeniusTrader Ryde

=head1 NAME

GT::DB::Chart - GeniusTrader access to data from Chart

=head1 SYNOPSIS

 use GT::DB::Chart;
 my $db = GT::DB::Chart->new;
 my $prices = $db->get_prices ('BHP.AX', $GT::Prices::DAYS);

=head1 DESCRIPTION

This is a C<GT::DB> module giving access to the Chart database from
GeniusTrader scripts and calculations.

=head1 FUNCTIONS

=over 4

=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) >>

Return the company name for the stock C<$symbol>, or C<undef> if unknown.

For most applications, use C<< $db->get_name() >> instead (see C<GT::DB>),
since it tries your F<~/.gt/sharenames> file if nothing from
C<get_db_name()>.

=back

=head1 SEE ALSO

L<GT::DB>, L<GT::Prices>

L<App::Chart::Series::Database>

=head1 HOME PAGE

L<http://user42.tuxfamily.org/chart/index.html>

=head1 LICENCE

Copyright 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 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.

Chart is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY 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; see the file F<COPYING>.  Failing that, see
L<http://www.gnu.org/licenses/>.

=cut



( run in 0.662 second using v1.01-cache-2.11-cpan-39bf76dae61 )