NAME

GT::DB::bean - Access to beancounter database of quotes


DESCRIPTION

This module is used to retrieve quotes from a MySQL/PostgreSQL database as setup by beancounter. By default, the database is supposed to be running on localhost and the only authentication done is the standard Unix one.

Configuration

You can put some configuration items in ~/.gt/options to indicate where the database is.

DB::bean::dbname : the name of the database ("beancounter" by default)
DB::bean::dbhost : the host of the database ("" = localhost by default)
DB::bean::dbport : the port where the server is running ("" = default port number)
DB::bean::dbuser : the user account on the database (current user by default)
DB::bean::dbpasswd : the password of the user account
DB::bean::db : the database being used (mysql|Pg) ("mysql" by default)

Functions

GT::DB::mysql->new()
$db->disconnect

Disconnects from the database.

$db->get_prices($code, $timeframe)

Returns a GT::Prices object containing all known prices for the symbol $code.

$db->get_last_prices($code, $limit, $timeframe)

Returns a GT::Prices object containing the $limit last known prices for the symbol $code.

Notice that beancounter only supports daily data, therefore it will throw an error if you try to retrieve data in timeframes smaller than daily.

$db->get_db_name($code)

Returns the name of the stock designated by $code.